Skip to content

Commit 8d52856

Browse files
committed
Fix exhaustive test check
The old test was not doing anything; it would exit the loop instantly at i==0 rather than at the end of the range.
1 parent ea986a8 commit 8d52856

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ void TestExhaustive(uint32_t bits, size_t capacity) {
109109
// Compare
110110
CHECK(serialized == serialized_rebuild);
111111
// Count it
112-
if (elements_0.size() <= capacity) ++counts[elements_0.size()];
112+
if (impl == 0 && elements_0.size() <= capacity) ++counts[elements_0.size()];
113113
}
114114
}
115115
}
116116

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

0 commit comments

Comments
 (0)