コード例 #1
0
        public void FindDoubledValueTest()
        {
            ProbingHashtable table = new ProbingHashtable();

            table.Insert(1, "555");
            table.Insert(2, "555");
            table.Insert(1, "666");
            Assert.AreEqual(table.Search(1), "555");
        }
コード例 #2
0
        public void DeleteDoubledValueTest()
        {
            ProbingHashtable table = new ProbingHashtable();

            table.Insert(1, "555");
            table.Insert(2, "555");
            table.Insert(1, "666");

            table.Delete(1);
            Assert.IsNull(table.Search(1));
        }
コード例 #3
0
        public void FindAddedValueTest(int[] keys, string[] values, int keyToFind, string expectedResult)
        {
            ProbingHashtable table = new ProbingHashtable();

            for (int i = 0; i < keys.Length; i++)
            {
                table.Insert(keys[i], values[i]);
            }
            Assert.AreEqual(table.Search(keyToFind), expectedResult);
        }
コード例 #4
0
        public void DeleteValueTest(int[] keys, string[] values, int keyToDelete)
        {
            ProbingHashtable table = new ProbingHashtable();

            for (int i = 0; i < keys.Length; i++)
            {
                table.Insert(keys[i], values[i]);
            }
            table.Delete(keyToDelete);
            Assert.IsNull(table.Search(keyToDelete));
        }