コード例 #1
0
        public void GetTwoIdenticalKey()
        {
            var hashTable = new task4.HashTable(3);

            hashTable.PutPair("4", "Четыре");
            hashTable.PutPair("4", "четыре!");

            Assert.AreEqual(hashTable.GetValueByKey("4"), "четыре!");
        }
コード例 #2
0
        public void TenThousandElements()
        {
            var hashTable = new task4.HashTable(10000);

            for (int i = 0; i < 10000; i++)
            {
                hashTable.PutPair(i, i + " элемент");
            }

            Assert.AreEqual(hashTable.GetValueByKey(18), "18 элемент");
        }
コード例 #3
0
        public void GetAndFindThreeElements()
        {
            var hashTable = new task4.HashTable(3);

            hashTable.PutPair("4", "Четыре");
            hashTable.PutPair("7", "Семь");
            hashTable.PutPair("13", "Тринадцать");

            Assert.AreEqual(hashTable.GetValueByKey("4"), "Четыре");
            Assert.AreEqual(hashTable.GetValueByKey("7"), "Семь");
            Assert.AreEqual(hashTable.GetValueByKey("13"), "Тринадцать");
        }
コード例 #4
0
        public void OneThousandNotAddedElements()
        {
            var hashTable = new task4.HashTable(10000);

            for (int i = 0; i < 10000; i++)
            {
                hashTable.PutPair(i, i + " элемент");
            }

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