Beispiel #1
0
        public void CanAddKeyValuePairToHashtable()
        {
            MyHashTable hash = new MyHashTable();

            hash.Add(5, "naming");
            hash.Add(7, "conventions");
            hash.Add(9, "destroy");
            hash.Add(21, "time");

            int findValue = hash.FindKey("destroy");

            Assert.Equal(9, findValue);
        }
Beispiel #2
0
        public void CanHandleCollision()
        {
            MyHashTable hash = new MyHashTable();

            hash.Add(5, "olive");
            hash.Add(7, "ilove");
            hash.Add(8, "evian");
            hash.Add(22, "olive");
            hash.Add(9, "niave");

            int findValue = hash.FindKey("olive");

            Assert.Equal(5, findValue);
        }
Beispiel #3
0
        public void CanFindKey()
        {
            MyHashTable hash = new MyHashTable();

            hash.Add(5, "missing");
            hash.Add(7, "curly");
            hash.Add(8, "braces");
            hash.Add(9, "make");
            hash.Add(21, "you");
            hash.Add(27, "cry");

            int findValue = hash.FindKey("cry");

            Assert.Equal(27, findValue);
        }