コード例 #1
0
        public void TestEmpty()
        {
            PatriciaTrie <string> trie = new PatriciaTrie <string>();

            Assert.IsTrue(trie.IsEmpty());
            trie["hello"] = "world";
            Assert.IsFalse(trie.IsEmpty());
        }
コード例 #2
0
        public void TestEmptyInsert()
        {
            PatriciaTrie <string> trie = new PatriciaTrie <string>();

            Assert.IsTrue(trie.IsEmpty());
            trie[""] = "i am empty bottle of beer!";
            Assert.IsFalse(trie.IsEmpty());
            Assert.AreEqual("i am empty bottle of beer!", trie[""]);
            trie[""] = "...and i'm an empty bottle of sake";
            Assert.AreEqual("...and i'm an empty bottle of sake", trie[""]);
        }
コード例 #3
0
        public void TestClear()
        {
            PatriciaTrie <string> trie = new PatriciaTrie <string>();

            Assert.IsTrue(trie.IsEmpty());
            Assert.AreEqual(0, trie.Count);
            trie["hello"] = "world";
            trie["world"] = "hello";
            Assert.IsFalse(trie.IsEmpty());
            trie.Clear();
            Assert.IsTrue(trie.IsEmpty());
            Assert.AreEqual(0, trie.Count);
        }