public void TestDeletableTestAndRemove() { var d = new DeletableBloomFilter(100, 10, 0.1); // 'a' is not in the filter. if (d.TestAndRemove(A_BYTES)) { Assert.Fail("'a' should not be a member"); } d.Add(A_BYTES); // 'a' is now in the filter. if (!d.TestAndRemove(A_BYTES)) { Assert.Fail("'a' should be a member"); } // 'a' is no longer in the filter. if (d.TestAndRemove(A_BYTES)) { Assert.Fail("'a' should not be a member"); } }
public void BenchmarkDeletableTestAndRemove() { var n = 100000; var d = new DeletableBloomFilter(100, 10, 0.1); var data = new byte[n][]; for (int i = 0; i < n; i++) { data[i] = Encoding.ASCII.GetBytes(i.ToString()); } for (int i = 0; i < n; i++) { d.TestAndRemove(data[i]); } }
public void TestDeletableCount() { var d = new DeletableBloomFilter(100, 10, 0.1); for (uint i = 0; i < 10; i++) { d.Add(Encoding.ASCII.GetBytes(i.ToString())); } for (int i = 0; i < 5; i++) { d.TestAndRemove(Encoding.ASCII.GetBytes(i.ToString())); } var count = d.Count(); Assert.AreEqual(5u, count); }