|
7 | 7 | importstaticorg.junit.Assert.assertEquals;
|
8 | 8 |
|
9 | 9 | publicclass_716Test {
|
10 |
| -privatestatic_716.Solution1.MaxStackmaxStackSolution1; |
11 |
| -privatestatic_716.Solution2.MaxStackmaxStackSolution2; |
| 10 | +privatestatic_716.Solution1.MaxStackmaxStackSolution1; |
| 11 | +privatestatic_716.Solution2.MaxStackmaxStackSolution2; |
| 12 | +privatestatic_716.Solution3.MaxStackmaxStackSolution3; |
12 | 13 |
|
13 |
| -@Before |
14 |
| -publicvoidsetup() { |
15 |
| -maxStackSolution1 =new_716.Solution1.MaxStack(); |
16 |
| -maxStackSolution2 =new_716.Solution2.MaxStack(); |
17 |
| - } |
| 14 | +@Before |
| 15 | +publicvoidsetup() { |
| 16 | +maxStackSolution1 =new_716.Solution1.MaxStack(); |
| 17 | +maxStackSolution2 =new_716.Solution2.MaxStack(); |
| 18 | +maxStackSolution3 =new_716.Solution3.MaxStack(); |
| 19 | + } |
18 | 20 |
|
19 |
| -@Test |
20 |
| -publicvoidtest1() { |
21 |
| -maxStackSolution1.push(5); |
22 |
| -assertEquals(5,maxStackSolution1.peekMax()); |
23 |
| -assertEquals(5,maxStackSolution1.popMax()); |
24 |
| - } |
| 21 | +@Test |
| 22 | +publicvoidtest1() { |
| 23 | +maxStackSolution1.push(5); |
| 24 | +assertEquals(5,maxStackSolution1.peekMax()); |
| 25 | +maxStackSolution2.push(5); |
| 26 | +assertEquals(5,maxStackSolution2.popMax()); |
| 27 | +maxStackSolution3.push(5); |
| 28 | +assertEquals(5,maxStackSolution3.popMax()); |
| 29 | + } |
25 | 30 |
|
26 |
| -@Test |
27 |
| -publicvoidtest2() { |
28 |
| -maxStackSolution1.push(5); |
29 |
| -maxStackSolution1.push(1); |
30 |
| -assertEquals(5,maxStackSolution1.popMax()); |
31 |
| -assertEquals(1,maxStackSolution1.peekMax()); |
32 |
| - } |
| 31 | +@Test |
| 32 | +publicvoidtest2() { |
| 33 | +maxStackSolution1.push(5); |
| 34 | +maxStackSolution1.push(1); |
| 35 | +assertEquals(5,maxStackSolution1.popMax()); |
| 36 | +assertEquals(1,maxStackSolution1.peekMax()); |
| 37 | +} |
33 | 38 |
|
34 |
| -@Test |
35 |
| -publicvoidtest3() { |
36 |
| -maxStackSolution1.push(74); |
37 |
| -assertEquals(74,maxStackSolution1.popMax()); |
38 |
| -maxStackSolution1.push(89); |
39 |
| -maxStackSolution1.push(67); |
40 |
| -assertEquals(89,maxStackSolution1.popMax()); |
41 |
| -assertEquals(67,maxStackSolution1.pop()); |
42 |
| -maxStackSolution1.push(61); |
43 |
| -maxStackSolution1.push(-77); |
44 |
| -assertEquals(61,maxStackSolution1.peekMax()); |
45 |
| -assertEquals(61,maxStackSolution1.popMax()); |
46 |
| -maxStackSolution1.push(81); |
47 |
| -assertEquals(81,maxStackSolution1.peekMax()); |
48 |
| -assertEquals(81,maxStackSolution1.popMax()); |
49 |
| -maxStackSolution1.push(81); |
50 |
| -assertEquals(81,maxStackSolution1.pop()); |
51 |
| -maxStackSolution1.push(-71); |
52 |
| -maxStackSolution1.push(32); |
53 |
| - } |
| 39 | +@Test |
| 40 | +publicvoidtest3() { |
| 41 | +maxStackSolution1.push(74); |
| 42 | +assertEquals(74,maxStackSolution1.popMax()); |
| 43 | +maxStackSolution1.push(89); |
| 44 | +maxStackSolution1.push(67); |
| 45 | +assertEquals(89,maxStackSolution1.popMax()); |
| 46 | +assertEquals(67,maxStackSolution1.pop()); |
| 47 | +maxStackSolution1.push(61); |
| 48 | +maxStackSolution1.push(-77); |
| 49 | +assertEquals(61,maxStackSolution1.peekMax()); |
| 50 | +assertEquals(61,maxStackSolution1.popMax()); |
| 51 | +maxStackSolution1.push(81); |
| 52 | +assertEquals(81,maxStackSolution1.peekMax()); |
| 53 | +assertEquals(81,maxStackSolution1.popMax()); |
| 54 | +maxStackSolution1.push(81); |
| 55 | +assertEquals(81,maxStackSolution1.pop()); |
| 56 | +maxStackSolution1.push(-71); |
| 57 | +maxStackSolution1.push(32); |
| 58 | +} |
54 | 59 |
|
55 |
| -@Test |
56 |
| -publicvoidtest4() { |
57 |
| -maxStackSolution2.push(5); |
58 |
| -assertEquals(5,maxStackSolution2.peekMax()); |
59 |
| -assertEquals(5,maxStackSolution2.popMax()); |
60 |
| - } |
| 60 | +@Test |
| 61 | +publicvoidtest4() { |
| 62 | +maxStackSolution2.push(5); |
| 63 | +assertEquals(5,maxStackSolution2.peekMax()); |
| 64 | +assertEquals(5,maxStackSolution2.popMax()); |
| 65 | +} |
61 | 66 |
|
62 |
| -@Test |
63 |
| -publicvoidtest5() { |
64 |
| -maxStackSolution2.push(5); |
65 |
| -maxStackSolution2.push(1); |
66 |
| -assertEquals(5,maxStackSolution2.popMax()); |
67 |
| -assertEquals(1,maxStackSolution2.peekMax()); |
68 |
| - } |
| 67 | +@Test |
| 68 | +publicvoidtest5() { |
| 69 | +maxStackSolution2.push(5); |
| 70 | +maxStackSolution2.push(1); |
| 71 | +assertEquals(5,maxStackSolution2.popMax()); |
| 72 | +assertEquals(1,maxStackSolution2.peekMax()); |
| 73 | +} |
69 | 74 |
|
70 |
| -@Test |
71 |
| -publicvoidtest6() { |
72 |
| -maxStackSolution2.push(74); |
73 |
| -assertEquals(74,maxStackSolution2.popMax()); |
74 |
| -maxStackSolution2.push(89); |
75 |
| -maxStackSolution2.push(67); |
76 |
| -assertEquals(89,maxStackSolution2.popMax()); |
77 |
| -assertEquals(67,maxStackSolution2.pop()); |
78 |
| -maxStackSolution2.push(61); |
79 |
| -maxStackSolution2.push(-77); |
80 |
| -assertEquals(61,maxStackSolution2.peekMax()); |
81 |
| -assertEquals(61,maxStackSolution2.popMax()); |
82 |
| -maxStackSolution2.push(81); |
83 |
| -assertEquals(81,maxStackSolution2.peekMax()); |
84 |
| -assertEquals(81,maxStackSolution2.popMax()); |
85 |
| -maxStackSolution2.push(81); |
86 |
| -assertEquals(81,maxStackSolution2.pop()); |
87 |
| -maxStackSolution2.push(-71); |
88 |
| -maxStackSolution2.push(32); |
89 |
| - } |
| 75 | +@Test |
| 76 | +publicvoidtest6() { |
| 77 | +maxStackSolution2.push(74); |
| 78 | +assertEquals(74,maxStackSolution2.popMax()); |
| 79 | +maxStackSolution2.push(89); |
| 80 | +maxStackSolution2.push(67); |
| 81 | +assertEquals(89,maxStackSolution2.popMax()); |
| 82 | +assertEquals(67,maxStackSolution2.pop()); |
| 83 | +maxStackSolution2.push(61); |
| 84 | +maxStackSolution2.push(-77); |
| 85 | +assertEquals(61,maxStackSolution2.peekMax()); |
| 86 | +assertEquals(61,maxStackSolution2.popMax()); |
| 87 | +maxStackSolution2.push(81); |
| 88 | +assertEquals(81,maxStackSolution2.peekMax()); |
| 89 | +assertEquals(81,maxStackSolution2.popMax()); |
| 90 | +maxStackSolution2.push(81); |
| 91 | +assertEquals(81,maxStackSolution2.pop()); |
| 92 | +maxStackSolution2.push(-71); |
| 93 | +maxStackSolution2.push(32); |
| 94 | +} |
90 | 95 | }
|