|
8 | 8 |
|
9 | 9 | public class _32Test {
|
10 | 10 | private static _32.Solution1 solution1;
|
| 11 | + private static _32.Solution2 solution2; |
11 | 12 |
|
12 | 13 | @BeforeClass
|
13 | 14 | public static void setup() {
|
14 | 15 | solution1 = new _32.Solution1();
|
| 16 | + solution2 = new _32.Solution2(); |
15 | 17 | }
|
16 | 18 |
|
17 | 19 | @Test
|
18 | 20 | public void test1() {
|
19 | 21 | assertEquals(2, solution1.longestValidParentheses("(()"));
|
| 22 | + assertEquals(2, solution2.longestValidParentheses("(()")); |
20 | 23 | }
|
| 24 | + |
| 25 | + @Test |
| 26 | + public void test2() { |
| 27 | + assertEquals(2, solution1.longestValidParentheses("()(()")); |
| 28 | + assertEquals(2, solution2.longestValidParentheses("()(()")); |
| 29 | + } |
| 30 | + |
| 31 | + @Test |
| 32 | + public void test3() { |
| 33 | + assertEquals(4, solution1.longestValidParentheses("(())(")); |
| 34 | + assertEquals(4, solution2.longestValidParentheses("(())(")); |
| 35 | + } |
| 36 | + |
| 37 | + @Test |
| 38 | + public void test4() { |
| 39 | + assertEquals(6, solution1.longestValidParentheses("()(())")); |
| 40 | + assertEquals(6, solution2.longestValidParentheses("()(())")); |
| 41 | + } |
| 42 | + |
| 43 | + @Test |
| 44 | + public void test5() { |
| 45 | + assertEquals(4, solution1.longestValidParentheses(")()())")); |
| 46 | + assertEquals(4, solution2.longestValidParentheses(")()())")); |
| 47 | + } |
| 48 | + |
| 49 | + @Test |
| 50 | + public void test6() { |
| 51 | + assertEquals(4, solution1.longestValidParentheses(")()())()()(")); |
| 52 | + assertEquals(4, solution2.longestValidParentheses(")()())()()(")); |
| 53 | + } |
| 54 | + |
| 55 | + @Test |
| 56 | + public void test7() { |
| 57 | + assertEquals(8, solution1.longestValidParentheses("((())())")); |
| 58 | + assertEquals(8, solution2.longestValidParentheses("((())())")); |
| 59 | + } |
| 60 | + |
| 61 | + @Test |
| 62 | + public void test8() { |
| 63 | + assertEquals(10, solution1.longestValidParentheses(")()(((())))(")); |
| 64 | + assertEquals(10, solution2.longestValidParentheses(")()(((())))(")); |
| 65 | + } |
| 66 | + |
21 | 67 | }
|
0 commit comments