예제 #1
0
        public void Can_append_tries()
        {
            var one = new LcrsTrie('\0', false);

            one.Add("ape");
            one.Add("app");
            one.Add("banana");

            var two = new LcrsTrie('\0', false);

            two.Add("apple");
            two.Add("banana");

            one.Merge(two);

            Word found;

            Assert.IsTrue(one.HasWord("ape", out found));
            Assert.IsTrue(one.HasWord("app", out found));
            Assert.IsTrue(one.HasWord("apple", out found));
            Assert.IsTrue(one.HasWord("banana", out found));
        }
예제 #2
0
        public void Can_merge_tries()
        {
            var one = new LcrsTrie('\0', false);

            one.Add("ape");
            one.Add("app");
            one.Add("bananas");

            var two = new LcrsTrie('\0', false);

            two.Add("apple");
            two.Add("banana");
            two.Add("citron");

            one.Merge(two);

            Assert.IsTrue(one.IsWord("ape").Any());
            Assert.IsTrue(one.IsWord("app").Any());
            Assert.IsTrue(one.IsWord("apple").Any());
            Assert.IsTrue(one.IsWord("banana").Any());
            Assert.IsTrue(one.IsWord("bananas").Any());
            Assert.IsTrue(one.IsWord("citron").Any());
        }