Example #1
0
        public void BinarySearchTree_05_ToString_02_OnSmallTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntSmall();
            string expected = "2 4 5 6 7";

            // Act
            string actual = tree.ToString();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void BinarySearchTree_02_FindMin_03_OnSmallIntTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntSmall();
            int expected = 2;

            // Act
            int actual = tree.FindMin();

            // Act & Assert
            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void BinarySearchTree_03_RemoveMin_03_OnSmallIntTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntSmall();
            string expected = "[ [ NIL 4 [ NIL 5 NIL ] ] 6 [ NIL 7 NIL ] ]";

            // Act
            tree.RemoveMin();
            string actual = tree.ToInfixString();

            // Assert
            Assert.AreEqual(expected, actual);
        }