public void Construct_WordSequence_AddsToTrie() { Word w1 = new Word("aaaa"); Word w2 = new Word("zzzz"); WordTrie trie = new WordTrie(new Word[] { w1, w2 }); Assert.True(trie.Contains(w1)); Assert.True(trie.Contains(w2)); }
public void Contains_ReturnsTrueIfFoundFalseOtherwise() { WordTrie trie = new WordTrie(); Assert.False(trie.Contains(new Word("a"))); trie.Add(new Word("a")); Assert.True(trie.Contains(new Word("a"))); Assert.False(trie.Contains(new Word("ab"))); trie.Add(new Word("abc")); Assert.False(trie.Contains(new Word("ab"))); Assert.True(trie.Contains(new Word("abc"))); trie.Remove(new Word("abc")); Assert.False(trie.Contains(new Word("ab"))); Assert.False(trie.Contains(new Word("abc"))); trie.Add(new Word("abcdefghijklmno")); Assert.False(trie.Contains(new Word("ab"))); Assert.False(trie.Contains(new Word("abc"))); Assert.False(trie.Contains(new Word("abcd"))); Assert.False(trie.Contains(new Word("abcde"))); Assert.False(trie.Contains(new Word("abcdef"))); Assert.False(trie.Contains(new Word("abcdefg"))); Assert.False(trie.Contains(new Word("abcdefgh"))); Assert.False(trie.Contains(new Word("abcdefghi"))); Assert.False(trie.Contains(new Word("abcdefghij"))); Assert.False(trie.Contains(new Word("abcdefghijk"))); Assert.False(trie.Contains(new Word("abcdefghijkl"))); Assert.False(trie.Contains(new Word("abcdefghijklm"))); Assert.False(trie.Contains(new Word("abcdefghijklmn"))); Assert.True(trie.Contains(new Word("abcdefghijklmno"))); }