Пример #1
0
        public void FirstInsertion()
        {
            var AT = new AlphaTrie <string>();

            AT.Insert("first", "word");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
        }
Пример #2
0
        public void RemoveTest()
        {
            var AT = new AlphaTrie <string>();

            AT.Insert("first", "word");
            AT.Insert("firsts", "awesome");
            AT.Insert("second", "time");
            AT.Insert("seconds", "matter");
            AT.Insert("secondary", "place");

            Assert.IsTrue(AT.Remove("first"));
            Assert.IsTrue(AT.Remove("seconds"));
            Assert.IsFalse(AT.Remove("seconds"));

            AT.Insert("seconds", "matter");
            Assert.IsTrue(AT.Remove("seconds"));

            Assert.IsFalse(AT.Remove("pancakes"));
            Assert.IsNotNull(AT.FindByKeyExact("firsts"));
            Assert.IsNotNull(AT.FindByKeyExact("second"));
            Assert.IsNotNull(AT.FindByKeyExact("secondary"));
        }
Пример #3
0
        public void MultipleInsertion()
        {
            var AT = new AlphaTrie <string>();

            AT.Insert("first", "word");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
            AT.Insert("firsts", "awesome");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
            Assert.IsNotNull(AT.FindByKeyExact("firsts"));
            AT.Insert("second", "time");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
            Assert.IsNotNull(AT.FindByKeyExact("firsts"));
            Assert.IsNotNull(AT.FindByKeyExact("second"));
            AT.Insert("seconds", "matter");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
            Assert.IsNotNull(AT.FindByKeyExact("firsts"));
            Assert.IsNotNull(AT.FindByKeyExact("second"));
            Assert.IsNotNull(AT.FindByKeyExact("seconds"));
            AT.Insert("secondary", "place");
            Assert.IsNotNull(AT.FindByKeyExact("first"));
            Assert.IsNotNull(AT.FindByKeyExact("firsts"));
            Assert.IsNotNull(AT.FindByKeyExact("second"));
            Assert.IsNotNull(AT.FindByKeyExact("seconds"));
            Assert.IsNotNull(AT.FindByKeyExact("secondary"));
        }