@@ -123,7 +123,7 @@ void TestExhaustive(uint32_t bits, size_t capacity) {
123
123
/* * Test properties of sketches with random elements put in. */
124
124
void TestRandomized (uint32_t bits, size_t max_capacity, size_t iter) {
125
125
std::random_device rnd;
126
- std::uniform_int_distribution<uint64_t > capacity_dist (1 , std::min<uint64_t >(std::numeric_limits<uint64_t >::max () >> (64 - bits), max_capacity));
126
+ std::uniform_int_distribution<uint64_t > capacity_dist (0 , std::min<uint64_t >(std::numeric_limits<uint64_t >::max () >> (64 - bits), max_capacity));
127
127
std::uniform_int_distribution<uint64_t > element_dist (1 , std::numeric_limits<uint64_t >::max () >> (64 - bits));
128
128
std::uniform_int_distribution<uint64_t > rand64 (0 , std::numeric_limits<uint64_t >::max ());
129
129
std::uniform_int_distribution<int64_t > size_offset_dist (-3 , 3 );
@@ -298,8 +298,11 @@ int main(int argc, char** argv) {
298
298
TestRandomized (j, 4096 , test_complexity / j);
299
299
}
300
300
301
- for (int weight = 2 ; weight <= 40 ; ++weight) {
302
- for (int bits = 2 ; bits <= 32 && bits <= weight; ++bits) {
301
+ // Test capacity==0 together with all field sizes, and then
302
+ // all combinations of bits and capacity up to a certain bits*capacity,
303
+ // depending on test_complexity.
304
+ for (int weight = 0 ; weight <= 40 ; ++weight) {
305
+ for (int bits = 2 ; weight == 0 ? bits <= 64 : (bits <= 32 && bits <= weight); ++bits) {
303
306
int capacity = weight / bits;
304
307
if (capacity * bits != weight) continue ;
305
308
TestExhaustive (bits, capacity);
0 commit comments