Example #1
0
        public void TestAssociatedContainerWithCollisions()
        {
            Console.WriteLine("Test an associated container of pairs: <int, object> with bad hash");
            AssociatedContainer <IInt, object> container3 = new AssociatedContainer <IInt, object>();

            for (int i = 0; i < Iterations; i++)
            {
                IntHashCollision integer = i;
                integer = integer.GetHashCode();
                try
                {
                    container3.Add(integer, string.Format(ObjectName, i));
                }
                catch (ArgumentException) { }
            }
        }
Example #2
0
        public void TestAssociatedContainerWithHash2()
        {
            Console.WriteLine("Test an associated container of pairs: <int, object> with hash = ((x >> 16) ^ x) * 0x45d9f3b");
            AssociatedContainer <IInt, object> container2 = new AssociatedContainer <IInt, object>();

            for (int i = 0; i < Iterations; i++)
            {
                IntHash2 integer = i;
                integer = integer.GetHashCode();
                try
                {
                    container2.Add(integer, string.Format(ObjectName, i));
                }
                catch (ArgumentException) { }
            }
        }