use of org.apache.commons.collections4.bloomfilter.hasher.HashFunctionIdentity in project commons-collections by apache.
the class HasherBloomFilterTest method getBitsTest_LowestBitOnly.
/**
* Test the edge case where the filter has only 1 bit in the lowest index and the getBits()
* function returns an array of length 1.
*/
@Test
public void getBitsTest_LowestBitOnly() {
final BloomFilter filter = createEmptyFilter(shape);
// Set the lowest bit index only.
filter.merge(new Hasher() {
@Override
public OfInt iterator(final Shape shape) {
return Arrays.stream(new int[] { 0 }).iterator();
}
@Override
public HashFunctionIdentity getHashFunctionIdentity() {
return shape.getHashFunctionIdentity();
}
});
assertArrayEquals(new long[] { 1L }, filter.getBits());
}
Aggregations