Beispiel #1
0
        public void TestMin()
        {
            IBinIntTree sut = new BinaryIntTree(
                5
                , new BinaryTree <int>(1)
                , new BinaryIntTree(33));

            int min = sut.Menor();

            Assert.Equal(1, min);
        }
Beispiel #2
0
        public void TestToArray()
        {
            IBinTree <int> sut = new BinaryIntTree(
                5
                , new BinaryTree <int>(1)
                , new BinaryIntTree(33));

            int[] actual   = sut.ToArray();
            int[] expected = new int[] { 33, 5, 1 };

            Assert.Equal(expected, actual);
        }
        public void CanFizzBuzz()
        {
            BinaryIntTree inputTree = new BinaryIntTree();

            inputTree.Root             = new IntNode(1);
            inputTree.Root.Left        = new IntNode(3);
            inputTree.Root.Right       = new IntNode(5);
            inputTree.Root.Left.Left   = new IntNode(7);
            inputTree.Root.Left.Right  = new IntNode(9);
            inputTree.Root.Right.Left  = new IntNode(12);
            inputTree.Root.Right.Right = new IntNode(15);

            Assert.Equal(GenerateTree(), Program.CreateFizzBuzzTree(inputTree));
        }
Beispiel #4
0
        public void TestSuma()
        {
            IBinIntTree sut = new BinaryIntTree(
                5,
                new BinaryIntTree(4),
                new BinaryIntTree(
                    9,
                    new BinaryTree <int>(8),
                    null
                    )
                );

            Assert.Equal(26, sut.Sumar());
        }