Skip to content

Commit

Permalink
more bloomfilter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Apodaca committed Jun 30, 2009
1 parent 7c215e5 commit 02f6001
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/metamolecular/mx/fingerprint/BloomFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class BloomFilter<E> implements Set<E>

/**
* Simplified constructor that sets the number of expected elements equal to
* the number of bits (a standard practice for cheminformatics applications).
* the number of bits.
*
* @param bitArraySize
* The number of bits in the bit array (often called 'm' in the
Expand Down
19 changes: 19 additions & 0 deletions src/com/metamolecular/mx/test/BloomFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ public void testItLacksAStringNotIncludedInBulkAdd()

assertFalse(filter.contains("CCCCC"));
}

public void testItSetsBitsOnAddingString()
{
doNew();

filter.add("Foo");

assertFalse(filter.toBitSet().cardinality() == 0);
}

public void testItClears()
{
doNew();

filter.addAll(Arrays.asList("C", "CC", "CCC", "CCCC"));
filter.clear();

assertEquals(0, filter.toBitSet().cardinality());
}

public void testItGivesTheExpectedFalsePositiveRate()
{
Expand Down

0 comments on commit 02f6001

Please sign in to comment.