Skip to content

Commit

Permalink
[NOMERGE] Fix exhaustive test check
Browse files Browse the repository at this point in the history
The old test was not doing anything; it would exit the loop instantly
at i==0 rather than at the end of the range.
  • Loading branch information
sipa authored and fanquake committed Sep 30, 2021
1 parent e0d7e88 commit eb7b16b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/minisketch/src/test.cpp
Expand Up @@ -109,14 +109,15 @@ void TestExhaustive(uint32_t bits, size_t capacity) {
// Compare
CHECK(serialized == serialized_rebuild);
// Count it
if (elements_0.size() <= capacity) ++counts[elements_0.size()];
if (impl == 0 && elements_0.size() <= capacity) ++counts[elements_0.size()];
}
}
}

// Verify that the number of decodable sketches with given elements is expected.
for (uint64_t i = 0; i <= capacity && i >> bits; ++i) {
CHECK(counts[i] == Combination((uint64_t{1} << bits) - 1, i));
uint64_t mask = bits == 64 ? UINT64_MAX : (uint64_t{1} << bits) - 1;
for (uint64_t i = 0; i <= capacity && (i & mask) == i; ++i) {
CHECK(counts[i] == Combination(mask, i));
}
}

Expand Down

0 comments on commit eb7b16b

Please sign in to comment.