Пример #1
0
        public void ShouldReturnFalseIfTreesNotEqual()
        {
            var leftSubtree = new BTN()
            {
                Value = 2
            };
            var rightSubtree = new BTN()
            {
                Value = 3
            };

            var firstTree = new BTN
            {
                Value = 1,
                Right = rightSubtree,
                Left  = leftSubtree
            };

            var secondTree = new BTN
            {
                Value = 1,
                Right = leftSubtree,
                Left  = rightSubtree
            };


            var comparisonResult = TreeComparator.Compare(firstTree, secondTree);

            Assert.IsFalse(comparisonResult);
        }
Пример #2
0
        public void ShouldReturnTrueIfTreesAreEmpty()
        {
            var firstTree  = new BTN();
            var secondTree = new BTN();

            var comparisonResult = TreeComparator.Compare(firstTree, secondTree);

            Assert.IsTrue(comparisonResult);
        }
Пример #3
0
        public void ShouldReturnFalseIfExactlyOneTreeIsEmpty()
        {
            var firstTree  = new BTN();
            var secondTree = new BTN {
                Value = 1
            };


            var comparisonResult = TreeComparator.Compare(firstTree, secondTree);

            Assert.IsFalse(comparisonResult);
        }