public void TernarySearchTree_Smoke_Test() { var tree = new TernarySearchTree <char>(); tree.Insert("cat".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("cats".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("cut".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("cuts".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("up".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("bug".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Insert("bugs".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); Assert.IsTrue(tree.Contains("cat".ToCharArray())); Assert.IsTrue(tree.Contains("cut".ToCharArray())); Assert.IsFalse(tree.Contains("bu".ToCharArray())); Assert.IsTrue(tree.ContainsPrefix("bu".ToCharArray())); tree.Delete("cuts".ToCharArray()); Assert.IsFalse(tree.Contains("cuts".ToCharArray())); var matches = tree.StartsWith("u".ToCharArray()); Assert.IsTrue(matches.Count == 1); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); matches = tree.StartsWith("cu".ToCharArray()); Assert.IsTrue(matches.Count == 1); matches = tree.StartsWith("bu".ToCharArray()); Assert.IsTrue(matches.Count == 2); matches = tree.StartsWith("c".ToCharArray()); Assert.IsTrue(matches.Count == 3); matches = tree.StartsWith("ca".ToCharArray()); Assert.IsTrue(matches.Count == 2); tree.Delete("cats".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Delete("up".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Delete("bug".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Delete("bugs".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Delete("cat".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); tree.Delete("cut".ToCharArray()); //IEnumerable test Assert.AreEqual(tree.Count, tree.Count()); }