Пример #1
0
        public void Constructor_RootNodeReference()
        {
            TrieNode <Char> rootNode = null;

            testCharacterTrie = new CharacterTrie(out rootNode);
            foreach (String currentTestWord in new List <String>()
            {
                "cop", "d", "apple", "apps", "app"
            })
            {
                testCharacterTrie.Insert(currentTestWord);
            }

            Assert.AreEqual(3, rootNode.ChildNodes.Count());
            Assert.IsTrue(rootNode.ChildNodeExists('a'));
            Assert.IsTrue(rootNode.ChildNodeExists('c'));
            Assert.IsTrue(rootNode.ChildNodeExists('d'));
        }
Пример #2
0
        public void Constructor_RootNodeReferenceMaintainedAfterClearIsCalled()
        {
            TrieNode <Char> rootNode = null;

            testCharacterTrie = new CharacterTrie(out rootNode);
            foreach (String currentTestWord in new List <String>()
            {
                "cop", "d", "apple", "apps", "app"
            })
            {
                testCharacterTrie.Insert(currentTestWord);
            }
            testCharacterTrie.Clear();
            testCharacterTrie.Insert("apple");

            Assert.AreEqual(1, rootNode.ChildNodes.Count());
            Assert.IsTrue(rootNode.ChildNodeExists('a'));
        }
Пример #3
0
 protected void SetUp()
 {
     testCharacterTrie = new CharacterTrie();
 }