Esempio n. 1
0
        public void BinarySearchTree_03_RemoveMin_01_OnEmptyTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntEmpty();

            // Act & Assert
            Assert.Throws(typeof(BinarySearchTreeEmptyException), () => tree.RemoveMin());
        }
Esempio n. 2
0
        public void BinarySearchTree_03_RemoveMin_04_OnModerateIntTree()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeIntModerate();
            string expected = "[ [ [ NIL 7 NIL ] 8 [ NIL 12 NIL ] ] 17 [ [ NIL 24 NIL ] 26 [ NIL 32 [ [ NIL 34 [ [ NIL 37 NIL ] 42 NIL ] ] 45 [ NIL 50 NIL ] ] ] ] ]";

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

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 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);
        }
Esempio n. 4
0
        public void BinarySearchTree_03_RemoveMin_02_OnTree1Element()
        {
            // Arrange
            IBinarySearchTree <int> tree = DSBuilder.CreateBinarySearchTreeInt1Element();
            string expected = "NIL";

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

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