Ejemplo n.º 1
0
        public void Remove_TrieEmpty_AlwaysReturnsFalse()
        {
            Word3Trie trie = new Word3Trie();

            Assert.False(trie.Remove(new Word3("zzz")));
            Assert.False(trie.Remove(new Word3("zzy")));
            Assert.False(trie.Remove(new Word3("zxy")));
            Assert.False(trie.Remove(new Word3("wxy")));
        }
Ejemplo 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")));
        }
Ejemplo n.º 3
0
        public void Remove_FirstTimeReturnsTrueNextTimeReturnsFalse()
        {
            Word3Trie trie = new Word3Trie();

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

            Assert.True(trie.Remove(new Word3("zzz")));
            Assert.False(trie.Remove(new Word3("zzz")));
            Assert.False(trie.Remove(new Word3("zzz")));

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

            Assert.True(trie.Remove(new Word3("zzy")));
            Assert.False(trie.Remove(new Word3("zzy")));
            Assert.False(trie.Remove(new Word3("zzy")));

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

            Assert.True(trie.Remove(new Word3("zxy")));
            Assert.False(trie.Remove(new Word3("zxy")));
            Assert.False(trie.Remove(new Word3("zxy")));

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

            Assert.True(trie.Remove(new Word3("wxy")));
            Assert.False(trie.Remove(new Word3("wxy")));
            Assert.False(trie.Remove(new Word3("wxy")));
        }