bloom-filter: Improve test cases
The integer bloom filter test cases do not really match typical usage
of the bloom filter in actual Ceph code. In particular:
- the tests use consecutive integer ranges, while Ceph code uses
hash values uniformly distributed over the uint32_t space;
- the tests pass "int" to the insert and contains functions, which
causes the generic C++ POD type overload to be selected instead
of the uint32_t overload that is used by Ceph code. The POD
overload is dependent on host byte order, and behaves actually
different from the uint32_t overload on little-endian systems.
To fix these issues, this patch changes the integer tests to
always pass in uint32_t (instead of int), and to use results
of a pseudo-random number generator instead of consecutive
sequences. (We assume the period of the generator is long
enough that all values generated within one test instance
are distinct.)
This not only makes the test pass on both big- and little-endian
hosts now, but it also allows tightening of the allowable actual
false positive rates, as they now match much closer the expected
values.
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
(cherry picked from commit
ef17972992807f57ed6ac5dbe49f2902d0127d3d)
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>