예제 #1
0
        public void TestHashCode()
        {
            var map = new Dictionary <byte[], int>();

            map.Add(EmptyBytes, 1);
            map.Add(new byte[] { 1 }, 32);
            map.Add(new byte[] { 2 }, 33);
            map.Add(new byte[] { 0, 1 }, 962);
            map.Add(new byte[] { 1, 2 }, 994);
            map.Add(new byte[] { 0, 1, 2, 3, 4, 5 }, 63504931);
            map.Add(new byte[] { 6, 7, 8, 9, 0, 1 }, unchecked ((int)97180294697L));

            foreach (KeyValuePair <byte[], int> e in map)
            {
                IByteBuffer buffer = WrappedBuffer(e.Key);
                Assert.Equal(e.Value, ByteBufferUtil.HashCode(buffer));
                buffer.Release();
            }
        }