Subversion Repositories programming

Rev

Rev 29 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29 Rev 30
Line 8... Line 8...
8
    
8
    
9
        System.out.println( test_12_2() );
9
        System.out.println( test_12_2() );
10
    
10
    
11
    } //end main
11
    } //end main
12
 
12
 
13
    public static boolean test_12_2() {
13
    public static BinaryTree createTestTree() {
14
        BinaryTree treeB = new BinaryTree("B");
14
        BinaryTree treeB = new BinaryTree("B");
15
        BinaryTree treeD = new BinaryTree("D");
15
        BinaryTree treeD = new BinaryTree("D");
16
        BinaryTree treeE = new BinaryTree("E");
16
        BinaryTree treeE = new BinaryTree("E");
17
        BinaryTree treeC = new BinaryTree("C",treeD,treeE);
17
        BinaryTree treeC = new BinaryTree("C",treeD,treeE);
18
        BinaryTree treeA = new BinaryTree("A",treeB,treeC);
18
        BinaryTree treeA = new BinaryTree("A",treeB,treeC);
19
        
19
        
20
        String experimentalResult = treeA.toString();
20
        return treeA;
-
 
21
    }
21
 
22
 
-
 
23
    public static String test_12_2() {
-
 
24
        BinaryTree treeA = createTestTree();
-
 
25
        
-
 
26
        String experimentalResult = treeA.toString();
22
        String correctResult = "((B),A,((D),C,(E)))";
27
        String correctResult = "((B),A,((D),C,(E)))";
23
 
28
 
24
        return correctResult.equals(experimentalResult);
29
        if( correctResult.equals(experimentalResult) )
-
 
30
            return "test_12_2: PASSED";
-
 
31
 
-
 
32
        return "test_12_2: *** FAILED ***";
25
    }
33
    }
26
 
34
 
27
 
35
 
28
} //end class Driver
36
} //end class Driver
29
 
37