|
7 | 7 | importstaticorg.junit.Assert.assertEquals;
|
8 | 8 |
|
9 | 9 | publicclass_409Test {
|
10 |
| -privatestatic_409.Solution1solution1; |
11 |
| - |
12 |
| -@BeforeClass |
13 |
| -publicstaticvoidsetup() { |
14 |
| -solution1 =new_409.Solution1(); |
15 |
| - } |
16 |
| - |
17 |
| -@Test |
18 |
| -publicvoidtest1() { |
19 |
| -assertEquals(7,solution1.longestPalindrome("abccccdd")); |
20 |
| - } |
21 |
| - |
22 |
| -@Test |
23 |
| -publicvoidtest2() { |
24 |
| -assertEquals(7,solution1.longestPalindrome("abccAccdd")); |
25 |
| - } |
26 |
| - |
27 |
| -@Test |
28 |
| -publicvoidtest3() { |
29 |
| -assertEquals(983,solution1.longestPalindrome( |
30 |
| -"civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
31 |
| - } |
32 |
| - |
33 |
| -@Test |
34 |
| -publicvoidtest4() { |
35 |
| -assertEquals(3,solution1.longestPalindrome("ccc")); |
36 |
| - } |
| 10 | +privatestatic_409.Solution1solution1; |
| 11 | +privatestatic_409.Solution2solution2; |
| 12 | + |
| 13 | +@BeforeClass |
| 14 | +publicstaticvoidsetup() { |
| 15 | +solution1 =new_409.Solution1(); |
| 16 | +solution2 =new_409.Solution2(); |
| 17 | + } |
| 18 | + |
| 19 | +@Test |
| 20 | +publicvoidtest1() { |
| 21 | +assertEquals(7,solution1.longestPalindrome("abccccdd")); |
| 22 | +assertEquals(7,solution2.longestPalindrome("abccccdd")); |
| 23 | + } |
| 24 | + |
| 25 | +@Test |
| 26 | +publicvoidtest2() { |
| 27 | +assertEquals(7,solution1.longestPalindrome("abccAccdd")); |
| 28 | +assertEquals(7,solution2.longestPalindrome("abccAccdd")); |
| 29 | + } |
| 30 | + |
| 31 | +@Test |
| 32 | +publicvoidtest3() { |
| 33 | +assertEquals(983,solution1.longestPalindrome( |
| 34 | +"civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
| 35 | +assertEquals(983,solution2.longestPalindrome( |
| 36 | +"civilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth")); |
| 37 | + } |
| 38 | + |
| 39 | +@Test |
| 40 | +publicvoidtest4() { |
| 41 | +assertEquals(3,solution1.longestPalindrome("ccc")); |
| 42 | +assertEquals(3,solution2.longestPalindrome("ccc")); |
| 43 | + } |
37 | 44 | }
|