public void BenchmarkInverseAdd() { for (int i = 0; i < n; i++) { f.Add(data[i]); } }
public void TestInverseTestAndAdd() { var f = new InverseBloomFilter(3); if (f.TestAndAdd(A_BYTES)) { Assert.Fail("'a' should not be a member"); } if (!f.Test(A_BYTES)) { Assert.Fail("'a' should be a member"); } // 'd' hashes to the same index as 'a' if (f.TestAndAdd(D_BYTES)) { Assert.Fail("'d' should not be a member"); } // 'a' was swapped out. if (f.TestAndAdd(A_BYTES)) { Assert.Fail("'a' should not be a member"); } if (!f.Test(A_BYTES)) { Assert.Fail("'a' should be a member"); } // 'b' hashes to another index if (f.TestAndAdd(B_BYTES)) { Assert.Fail("'b' should not be a member"); } if (!f.Test(B_BYTES)) { Assert.Fail("'b' should be a member"); } // 'a' should still be a member. if (!f.Test(A_BYTES)) { Assert.Fail("'a' should be a member"); } if (f.Test(C_BYTES)) { Assert.Fail("'c' should not be a member"); } var addedC = f.Add(C_BYTES); Assert.AreSame(f, addedC, "Returned InverseBloomFilter should be the same instance"); if (!f.Test(C_BYTES)) { Assert.Fail("'c' should be a member"); } }