public void TestCuckooBuckets() { var f = new CuckooBloomFilter(100, 0.1); var buckets = f.BucketCount(); Assert.AreEqual(1024u, buckets); }
public void TestCuckooReset() { var f = new CuckooBloomFilter(100, 0.1); for (int i = 0; i < 1000; i++) { f.Add(Encoding.ASCII.GetBytes(i.ToString())); } var resetFilter = f.Reset(); Assert.AreSame(f, resetFilter); for (int i = 0; i < f.BucketCount(); i++) { for (uint j = 0; j < f.B; j++) { if (f.Buckets[i][j] != null) { Assert.Fail("Exected all buckets to be cleared"); } } } Assert.AreEqual(0u, f.Count()); }