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)); }
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()); }