13
13
import static junit .framework .Assert .assertEquals ;
14
14
15
15
public class _653Test {
16
- private static _653 .ListSolution listSolution ;
17
- private static _653 .MapSolution mapSolution ;
16
+ private static _653 .Solution1 solution1 ;
18
17
private static boolean expected ;
19
18
private static TreeNode root ;
20
19
21
20
@ BeforeClass
22
21
public static void setup () {
23
- listSolution = new _653 .ListSolution ();
24
- mapSolution = new _653 .MapSolution ();
22
+ solution1 = new _653 .Solution1 ();
25
23
}
26
24
27
25
@ Before
@@ -33,24 +31,21 @@ public void setupForEachTest() {
33
31
public void test1 () {
34
32
root = TreeUtils .constructBinaryTree (new ArrayList <>(Arrays .asList (5 , 3 , 2 , 4 , 6 , 7 )));
35
33
expected = true ;
36
- assertEquals (expected , listSolution .findTarget (root , 9 ));
37
- assertEquals (expected , mapSolution .findTarget (root , 9 ));
34
+ assertEquals (expected , solution1 .findTarget (root , 9 ));
38
35
}
39
36
40
37
@ Test
41
38
public void test2 () {
42
39
root = TreeUtils .constructBinaryTree (new ArrayList <>(Arrays .asList (2 , 1 , 3 )));
43
40
expected = true ;
44
- assertEquals (expected , listSolution .findTarget (root , 4 ));
45
- assertEquals (expected , mapSolution .findTarget (root , 4 ));
41
+ assertEquals (expected , solution1 .findTarget (root , 4 ));
46
42
}
47
43
48
44
@ Test
49
45
public void test3 () {
50
46
root = new TreeNode (1 );
51
47
expected = false ;
52
- assertEquals (expected , listSolution .findTarget (root , 2 ));
53
- assertEquals (expected , mapSolution .findTarget (root , 2 ));
48
+ assertEquals (expected , solution1 .findTarget (root , 2 ));
54
49
}
55
50
56
51
@ Test
@@ -68,16 +63,14 @@ public void test4() {
68
63
69
64
root = TreeUtils .constructBinaryTree (new ArrayList <>(Arrays .asList (2 , 0 , -4 , 1 , 3 )));
70
65
expected = true ;
71
- assertEquals (expected , listSolution .findTarget (root , -1 ));
72
- assertEquals (expected , mapSolution .findTarget (root , -1 ));
66
+ assertEquals (expected , solution1 .findTarget (root , -1 ));
73
67
}
74
68
75
69
@ Test
76
70
public void test5 () {
77
71
root = TreeUtils .constructBinaryTree (new ArrayList <>(Arrays .asList (2 , 1 , 3 , -4 , 0 )));
78
72
expected = true ;
79
- assertEquals (expected , listSolution .findTarget (root , 2 ));
80
- assertEquals (expected , mapSolution .findTarget (root , 2 ));
73
+ assertEquals (expected , solution1 .findTarget (root , 2 ));
81
74
}
82
75
83
76
@ Test
@@ -93,7 +86,7 @@ public void test6() {
93
86
null , null , 170 , 376 , 1421 , 1613 , null , null , 2534 , null ,
94
87
null , null , 96 , null , null , null , 1303 )));
95
88
expected = true ;
96
- assertEquals (expected , listSolution .findTarget (root , 5831 ));
89
+ assertEquals (expected , solution1 .findTarget (root , 5831 ));
97
90
// TreeUtils.printBinaryTree(root);
98
91
// assertEquals(expected, mapSolution.findTarget(root, 5831));
99
92
}
0 commit comments