public void Empty() { var tree = new AvlTree <int, int>(); Assert.Equal(0, tree.Count()); AssertTreeValid("", tree); }
static void Main() { var tree = new AvlTree <int>(); Console.WriteLine("Count: " + tree.Count()); Console.WriteLine("Height: " + tree.Height()); for (int i = 0; i < 10000; ++i) { tree.Add(i); } Console.WriteLine("Count: " + tree.Count()); Console.WriteLine("Height: " + tree.Height()); for (int i = 0; i < 10000; ++i) { if (!tree.Contains(i)) { throw new Exception("Doesn't work"); } } for (int i = 0; i < 10000; ++i) { tree.Remove(i); } Console.WriteLine("Count: " + tree.Count()); Console.WriteLine("Height: " + tree.Height()); for (int i = 0; i < 10000; ++i) { if (tree.Contains(i)) { throw new Exception("Doesn't work"); } } Console.WriteLine("Works"); }