forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_234Test.java
40 lines (31 loc) · 1.15 KB
/
_234Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.fishercoder;
import com.fishercoder.common.classes.ListNode;
import com.fishercoder.common.utils.LinkedListUtils;
import com.fishercoder.solutions._234;
import org.junit.BeforeClass;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
public class _234Test {
private static _234.Solution1 solution1;
private static _234.Solution2 solution2;
private static ListNode head;
@BeforeClass
public static void setup(){
solution1 = new _234.Solution1();
solution2 = new _234.Solution2();
}
@Test
public void test1() {
head = LinkedListUtils.contructLinkedList(new int[]{1,2,3,2,1});
assertEquals(true, solution1.isPalindrome(head));
head = LinkedListUtils.contructLinkedList(new int[]{1,2,3,2,1});
assertEquals(true, solution2.isPalindrome(head));
}
@Test
public void test2() {
head = LinkedListUtils.contructLinkedList(new int[]{1,2,2,1});
assertEquals(true, solution1.isPalindrome(head));
head = LinkedListUtils.contructLinkedList(new int[]{1,2,3,2,1});
assertEquals(true, solution2.isPalindrome(head));
}
}