Example #1
0
        public void InsertWordsAndSearchForThemBySubstring5()
        {
            TrieBase trie   = new TrieBase();
            string   word   = "Bor";
            string   word01 = "YesPesho";

            trie.Insert(word01);
            string word1 = "IskamPomo";

            trie.Insert(word1);
            string word2 = "GoshoPesho";

            trie.Insert(word2);
            string word3 = "GoshoPeshoVanio";

            trie.Insert(word3);
            string word4 = "GoshoPeshoBore";

            trie.Insert(word4);

            ICollection <string> results = trie.Search(word, SearchType.Substring);
            bool actual = results.Contains(word4);

            Assert.AreEqual(true, actual);
        }
Example #2
0
        public void InsertTwoWordsAndTestIfNotContainsWordTest()
        {
            TrieBase trie = new TrieBase();
            string   word = "GOSHO";

            trie.Insert(word);
            string word2 = "GOSHO2";

            trie.Insert(word2);
            bool actual = trie.Contains("HA");

            Assert.AreEqual(false, actual);
        }
Example #3
0
        public void InsertTwoWordsAndTestIfContainsSecondWordTest()
        {
            TrieBase trie = new TrieBase();
            string   word = "GOSHO";

            trie.Insert(word);
            string word2 = "GOSHO2";

            trie.Insert(word2);
            bool actual = trie.Contains(word2);

            Assert.AreEqual(true, actual);
        }
Example #4
0
        public void InsertWordsAndSearchForThem()
        {
            TrieBase trie = new TrieBase();
            string   word = "Gosho";

            trie.Insert(word);
            string word2 = "GoshoPesho";

            trie.Insert(word2);
            ICollection <string> results = trie.Search(word);
            bool actual = results.Contains(word) && results.Contains(word2);

            Assert.AreEqual(true, actual);
        }
Example #5
0
        public void InserWordTest()
        {
            TrieBase trie = new TrieBase();
            string   word = "GOSHO";

            trie.Insert(word);

            Assert.AreEqual('G', trie.Root.Children['G'].Value);
        }
Example #6
0
        public void InsertWordWithSpaceAndCheckIfNoContains()
        {
            TrieBase trie = new TrieBase();
            string   word = "GOSHO GOSHO";

            trie.Insert(word);
            bool actual = trie.Contains("GOSHO");

            Assert.AreEqual(true, actual);
        }
Example #7
0
        public void InsertNumbersAndCheckIfNoContains()
        {
            TrieBase trie = new TrieBase();
            string   word = "123";

            trie.Insert(word);
            bool actual = trie.Contains("1234");

            Assert.AreEqual(false, actual);
        }
Example #8
0
        public void CheckIfContainsWordTest()
        {
            TrieBase trie = new TrieBase();
            string   word = "GOSHO";

            trie.Insert(word);
            bool actual   = trie.Contains(word);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
Example #9
0
 public void Insert(string key, T value)
 {
     InsertToDictionary(key.ToLower(), value);
     TrieBase.Insert(key.ToLower());
 }