public void TrieLowerTest() { var trie = new WordTrie(); trie.Insert("Ab"); Assert.True(trie.Search("ab")); }
public void SearchTest() { var trie = new WordTrie(); trie.Insert("ab"); trie.Insert("abc"); trie.Insert("abd"); trie.Insert("abcd"); Assert.True(trie.Search("ab")); Assert.True(trie.Search("abc")); Assert.True(trie.Search("abd")); Assert.True(trie.Search("abcd")); Assert.False(trie.Search("z")); Assert.False(trie.Search("zb")); Assert.False(trie.Search("bc")); Assert.False(trie.Search("acb")); Assert.False(trie.Search("?")); }
public void TrieDeleteTest() { var trie = new WordTrie(); trie.Insert("ab"); trie.Insert("abc"); trie.Insert("abd"); trie.Delete("ab"); Assert.False(trie.Search("ab")); Assert.True(trie.Search("abc")); Assert.True(trie.Search("abd")); trie.Delete("abc"); Assert.False(trie.Search("ab")); Assert.False(trie.Search("abc")); Assert.True(trie.Search("abd")); trie.Delete("abd"); Assert.False(trie.Search("ab")); Assert.False(trie.Search("abc")); Assert.False(trie.Search("abd")); }