public void EmptyTreeContainsNode() { // Arrange var emptyTree = new ADTAVLTree <int>(); // Act bool contains = emptyTree.Contains(1); // Assert Assert.AreEqual(false, contains); }
public void EmptyTreeAddDeleteContainsNode() { // Arrange var oneElemTree = new ADTAVLTree <int>().Add(1).Delete(1); // Act bool contains = oneElemTree.Contains(1); // Assert Assert.AreEqual(false, contains); }
public void OneElemTreeContainsNode() { // Arrange var oneElemTree = new ADTAVLTree <int>().Add(1); // Act bool contains = oneElemTree.Contains(1); // Assert Assert.AreEqual(true, contains); }
public void SameElemTreeContainsNode() { // Arrange var fiveElemTree = new ADTAVLTree <int>() .Add(1).Add(1).Add(1).Add(1).Add(1); // Act bool contains = fiveElemTree.Contains(1); int height = fiveElemTree.Height(); // Assert Assert.AreEqual(true, contains); Assert.AreEqual(3, height); }
public void ThreeElemTreeDeleteNode() { // Arrange var threeElemTree = new ADTAVLTree <int>() .Add(1).Add(1).Add(1); threeElemTree.PrettyPrintTree(); Console.WriteLine(); threeElemTree.Delete(1); threeElemTree.PrettyPrintTree(); // Act bool contains = threeElemTree.Contains(1); int height = threeElemTree.Height(); // Assert Assert.AreEqual(true, contains); Assert.AreEqual(2, height); }