[apps/shared/expression_model_store] Better assertions

This commit is contained in:
Ruben Dashyan
2019-09-09 17:55:01 +02:00
committed by LeaNumworks
parent 77cdc32813
commit 71e0c5a556

View File

@@ -54,13 +54,12 @@ int ExpressionModelStore::numberOfModelsSatisfyingTest(ModelTest test) const {
}
Ion::Storage::Record ExpressionModelStore::recordSatisfyingTestAtIndex(int i, ModelTest test) const {
assert(i >= 0 && i < numberOfDefinedModels());
assert(0 <= i && i < numberOfModelsSatisfyingTest(test));
int index = 0;
int currentModelIndex = 0;
Ion::Storage::Record r = recordAtIndex(currentModelIndex++);
ExpressionModelHandle * m = privateModelForRecord(r);
while (!m->isNull()) {
assert(currentModelIndex <= numberOfModels());
if (test(m)) {
if (i == index) {
return r;