public void SingleElementTest() { var tree = UnbalancedSet <string> .Empty; tree = UnbalancedSet <string> .Insert("a", tree); Assert.AreEqual("[a]", DumpTree(tree)); }
public void ElementTest() { const string data = "How now, brown cow?"; var tree = data.Split().Aggregate(UnbalancedSet <string> .Empty, (current, word) => UnbalancedSet <string> .Insert(word, current)); foreach (var word in data.Split()) { Assert.IsTrue(UnbalancedSet <string> .Member(word, tree)); } Assert.IsFalse(UnbalancedSet <string> .Member("wow", tree)); }
public void DumpTreeTest() { const string data = "How now, brown cow?"; var tree = data.Split().Aggregate(UnbalancedSet <string> .Empty, (current, word) => UnbalancedSet <string> .Insert(word, current)); Assert.AreEqual("[[brown,[cow?]],How,[now,]]", DumpTree(tree)); }