Пример #1
0
        private void IncorrectTreeLengthsTest(ISubtreeChecker subtreeChecker)
        {
            BinaryTreeNode t1 = CreateMainTree();
            BinaryTreeNode t2 = CreateSubtree();

            RunExceptionTest <ArgumentException>(t2, t1, subtreeChecker);
        }
Пример #2
0
 private void RunTests(ISubtreeChecker subtreeChecker)
 {
     //NullTreeTest(subtreeChecker);
     //IncorrectTreeLengthsTest(subtreeChecker);
     IsSubtreeTest(subtreeChecker);
     IsNotSubtreeTest(subtreeChecker);
 }
Пример #3
0
        private void IsNotSubtreeTest(ISubtreeChecker subtreeChecker)
        {
            BinaryTreeNode t1     = CreateMainTree();
            BinaryTreeNode t2     = CreateNotSubtree();
            bool           result = subtreeChecker.IsSubtree(t1, t2);

            Assert.AreEqual(false, result);
        }
Пример #4
0
        private void NullTreeTest(ISubtreeChecker subtreeChecker)
        {
            BinaryTreeNode t1 = new BinaryTreeNode(1);
            BinaryTreeNode t2 = null;

            RunExceptionTest <ArgumentException>(t1, t2, subtreeChecker);
            RunExceptionTest <ArgumentException>(t2, t1, subtreeChecker);
        }
Пример #5
0
 private void RunExceptionTest <TException>(BinaryTreeNode t1, BinaryTreeNode t2, ISubtreeChecker subtreeChecker) where TException : Exception
 {
     try
     {
         subtreeChecker.IsSubtree(t1, t2);
         Assert.Fail();
     }
     catch (TException)
     {
     }
 }