Esempio n. 1
0
        public void Construct_WordSequence_AddsToTrie()
        {
            Word3 w1 = new Word3("aaa");
            Word3 w2 = new Word3("zzz");

            Word3Trie trie = new Word3Trie(new Word3[] { w1, w2 });

            Assert.True(trie.Contains(w1));
            Assert.True(trie.Contains(w2));
        }
Esempio n. 2
0
        public void Contains_ReturnsTrueIfFoundFalseOtherwise()
        {
            Word3Trie trie = new Word3Trie();

            Assert.False(trie.Contains(new Word3("abc")));

            trie.Add(new Word3("abc"));

            Assert.True(trie.Contains(new Word3("abc")));
            Assert.False(trie.Contains(new Word3("abd")));

            trie.Add(new Word3("abd"));

            Assert.True(trie.Contains(new Word3("abd")));

            trie.Remove(new Word3("abc"));

            Assert.False(trie.Contains(new Word3("abc")));
        }