Skip to content

Commit 011e9f3

Browse files
record failing commit for SuccinctCountingBlockedBloom
1 parent fd7c405 commit 011e9f3

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.fastfilter;
2+
3+
import org.fastfilter.utils.Hash;
4+
import org.junit.Test;
5+
6+
import java.util.concurrent.ThreadLocalRandom;
7+
8+
import static junit.framework.TestCase.assertTrue;
9+
10+
public class SimpleFuzzer {
11+
12+
13+
@Test
14+
public void fuzzTest() {
15+
long[] keys = new long[]{ 1, 2, 3};
16+
long seed = 0;
17+
18+
for (FilterType type : FilterType.values()) {
19+
try {
20+
for (int i = 0; i < 1000_000; ++i) {
21+
seed = ThreadLocalRandom.current().nextLong();
22+
Hash.setSeed(seed);
23+
Filter filter = type.construct(keys, 8);
24+
assertTrue(filter.mayContain(1));
25+
assertTrue(filter.mayContain(2));
26+
assertTrue(filter.mayContain(3));
27+
}
28+
} catch (Exception e) {
29+
System.out.println(seed + "/" + type);
30+
throw e;
31+
}
32+
}
33+
}
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.fastfilter.bloom.count;
2+
3+
import org.fastfilter.utils.Hash;
4+
import org.junit.Test;
5+
6+
import static org.junit.Assert.*;
7+
8+
public class SuccinctCountingBlockedBloomTest {
9+
10+
@Test
11+
public void indexOutOfBoundsRegression() {
12+
long seed = 6049486880293779298L;
13+
long[] keys = new long[]{1, 2, 3};
14+
Hash.setSeed(seed);
15+
SuccinctCountingBlockedBloom filter = SuccinctCountingBlockedBloom.construct(keys, 8);
16+
assertTrue(filter.mayContain(1));
17+
assertTrue(filter.mayContain(2));
18+
assertTrue(filter.mayContain(3));
19+
}
20+
21+
}

0 commit comments

Comments
 (0)