-
Notifications
You must be signed in to change notification settings - Fork 617
Implement BloomFilter class #4524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
de70b05
44299ec
3e3d2b0
0a3c6f9
be7071c
ffe0a1d
b50b49a
1099d17
2f5d335
3c81c7d
5305332
5f66d92
be8ebed
7eb326f
e0c6fc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,15 +43,15 @@ public class BloomFilterTest { | |
@Test | ||
public void instantiateEmptyBloomFilter() { | ||
BloomFilter bloomFilter = new BloomFilter(new byte[0], 0, 0); | ||
assertEquals(bloomFilter.getSize(), 0); | ||
assertEquals(bloomFilter.getBitCount(), 0); | ||
} | ||
|
||
@Test | ||
public void instantiateNonEmptyBloomFilter() { | ||
BloomFilter bloomFilter1 = new BloomFilter(new byte[] {1}, 0, 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For tests like
For example, the body of {
BloomFilter bloomFilter = new BloomFilter(new byte[] {1}, 0, 1);
assertEquals(bloomFilter.getBitCount(), 8);
}
{
BloomFilter bloomFilter = new BloomFilter(new byte[] {1}, 7, 1);
assertEquals(bloomFilter.getBitCount(), 1);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make this change in |
||
assertEquals(bloomFilter1.getSize(), 8); | ||
assertEquals(bloomFilter1.getBitCount(), 8); | ||
BloomFilter bloomFilter2 = new BloomFilter(new byte[] {1}, 7, 1); | ||
assertEquals(bloomFilter2.getSize(), 1); | ||
assertEquals(bloomFilter2.getBitCount(), 1); | ||
} | ||
|
||
@Test | ||
|
@@ -89,7 +89,7 @@ public void constructorShouldThrowIAEOnNegativePadding() { | |
} | ||
|
||
@Test | ||
public void constructorShouldThrowIAEOnNegativeHashValue() { | ||
public void constructorShouldThrowIAEOnNegativeHashCount() { | ||
IllegalArgumentException emptyBloomFilterException = | ||
assertThrows(IllegalArgumentException.class, () -> new BloomFilter(new byte[0], 0, -1)); | ||
assertThat(emptyBloomFilterException).hasMessageThat().contains("Invalid hash count: -1"); | ||
|
Uh oh!
There was an error while loading. Please reload this page.