public void TestGetHashes()
        {
            var bc = new BucketCounter(2);

            for (var i = 0; i <= 255; i++)
            {
                var hash = bc.GetHash(new[] { (byte)i });
                Assert.True(hash < bc.RowCount);
            }
        }
        public void TestHashUniqueness()
        {
            var set = new HashSet <int>();
            // For SHA-1, we require 16 bits from the hash to uniquely distribute 256 values.
            var bc = new BucketCounter(16);

            for (var i = 0; i <= 255; i++)
            {
                var hash = bc.GetHash(new[] { (byte)i });
                Assert.DoesNotContain(hash, set);
                set.Add(hash);
            }
        }
        public void TestHashIncrements()
        {
            var bc = new BucketCounter(8);

            for (int i = 0; i <= 255; i++)
            {
                var hash     = bc.GetHash(new[] { (byte)i });
                var baseline = bc.Get(hash);
                Assert.Equal(baseline, bc.Get(hash));
                bc.Increment(hash);
                Assert.Equal(baseline + 1, bc.Get(hash));
                bc.Increment(hash);
                Assert.Equal(baseline + 2, bc.Get(hash));
            }
        }