Example #1
0
        public void TwoEquialsElements()
        {
            var hashTableOfTwoEquialsElementsht = new LAB4.HashTable(5);

            hashTableOfTwoEquialsElementsht.PutPair("5", "Пять");
            hashTableOfTwoEquialsElementsht.PutPair("5", "Five");

            Assert.AreEqual(hashTableOfTwoEquialsElementsht.GetValueByKey("5"), "Five");
        }
Example #2
0
        public void BigElementsTest()
        {
            var bigHashTable = new LAB4.HashTable(10000);

            for (int i = 0; i < 10000; i++)
            {
                bigHashTable.PutPair(i, i + "!");
            }

            Assert.AreEqual(bigHashTable.GetValueByKey(55), "55!");
        }
Example #3
0
        public void ThreeElements()
        {
            var hashTableOfThreeElements = new LAB4.HashTable(3);

            hashTableOfThreeElements.PutPair("5", "Five");
            hashTableOfThreeElements.PutPair("7", "Seven");
            hashTableOfThreeElements.PutPair("33", "Thirty three");

            Assert.AreEqual(hashTableOfThreeElements.GetValueByKey("5"), "Five");
            Assert.AreEqual(hashTableOfThreeElements.GetValueByKey("7"), "Seven");
            Assert.AreEqual(hashTableOfThreeElements.GetValueByKey("33"), "Thirty three");
        }
Example #4
0
        public void SearchForMissingElements()
        {
            var bigHashTable = new LAB4.HashTable(10000);

            for (int i = 0; i < 10000; i++)
            {
                bigHashTable.PutPair(i, i + "!");
            }

            for (int i = 10000; i < 11000; i++)
            {
                Assert.AreEqual(bigHashTable.GetValueByKey(i), null);
            }
        }