|
7 | 7 | import static org.junit.Assert.assertEquals;
|
8 | 8 |
|
9 | 9 | public class _409Test {
|
10 |
| - private static _409.Solution1 solution1; |
11 |
| - |
12 |
| - @BeforeClass |
13 |
| - public static void setup() { |
14 |
| - solution1 = new _409.Solution1(); |
15 |
| - } |
16 |
| - |
17 |
| - @Test |
18 |
| - public void test1() { |
19 |
| - assertEquals(7, solution1.longestPalindrome("abccccdd")); |
20 |
| - } |
21 |
| - |
22 |
| - @Test |
23 |
| - public void test2() { |
24 |
| - assertEquals(7, solution1.longestPalindrome("abccAccdd")); |
25 |
| - } |
26 |
| - |
27 |
| - @Test |
28 |
| - public void test3() { |
29 |
| - assertEquals(983, solution1.longestPalindrome( |
30 |
| - "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
31 |
| - } |
32 |
| - |
33 |
| - @Test |
34 |
| - public void test4() { |
35 |
| - assertEquals(3, solution1.longestPalindrome("ccc")); |
36 |
| - } |
| 10 | + private static _409.Solution1 solution1; |
| 11 | + private static _409.Solution2 solution2; |
| 12 | + |
| 13 | + @BeforeClass |
| 14 | + public static void setup() { |
| 15 | + solution1 = new _409.Solution1(); |
| 16 | + solution2 = new _409.Solution2(); |
| 17 | + } |
| 18 | + |
| 19 | + @Test |
| 20 | + public void test1() { |
| 21 | + assertEquals(7, solution1.longestPalindrome("abccccdd")); |
| 22 | + assertEquals(7, solution2.longestPalindrome("abccccdd")); |
| 23 | + } |
| 24 | + |
| 25 | + @Test |
| 26 | + public void test2() { |
| 27 | + assertEquals(7, solution1.longestPalindrome("abccAccdd")); |
| 28 | + assertEquals(7, solution2.longestPalindrome("abccAccdd")); |
| 29 | + } |
| 30 | + |
| 31 | + @Test |
| 32 | + public void test3() { |
| 33 | + assertEquals(983, solution1.longestPalindrome( |
| 34 | + "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
| 35 | + assertEquals(983, solution2.longestPalindrome( |
| 36 | + "civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
| 37 | + } |
| 38 | + |
| 39 | + @Test |
| 40 | + public void test4() { |
| 41 | + assertEquals(3, solution1.longestPalindrome("ccc")); |
| 42 | + assertEquals(3, solution2.longestPalindrome("ccc")); |
| 43 | + } |
37 | 44 | }
|
0 commit comments