Пример #1
0
        public void InvertibleBloomFilterQuasiDecodeTest()
        {
            var size          = 100000;
            var data          = DataGenerator.Generate().Take(size).ToList();
            var errorRate     = 0.001F;
            var configuration = new DefaultBloomFilterConfiguration();
            var bloomFilter   = new InvertibleBloomFilter <TestEntity, long, sbyte>(configuration);

            bloomFilter.Initialize(size, errorRate);
            foreach (var itm in data)
            {
                bloomFilter.Add(itm);
            }
            data = DataGenerator.Generate().Skip(500).Take(8000).ToList();
            data.Modify(1000);
            var estimate = bloomFilter.QuasiDecode(data);

            Assert.IsTrue(estimate > 90500 && estimate < 97000, "Unexpected estimate for difference.");
        }