Skip to content

Commit 00c5e1b

Browse files
move test to test folder
1 parent e601023 commit 00c5e1b

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

leetcode-algorithms/src/main/java/com/stevesun/solutions/_4SumII.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,4 @@ public static int fourSumCount(int[] A, int[] B, int[] C, int[] D) {
4848

4949
return result;
5050
}
51-
52-
public static void main(String...args){
53-
int[] A = new int[]{1,2};
54-
int[] B = new int[]{-2,-1};
55-
int[] C = new int[]{-1,2};
56-
int[] D = new int[]{0,2};
57-
58-
System.out.println(fourSumCount(A, B, C, D));
59-
}
6051
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.stevesun;
2+
3+
import com.stevesun.solutions._4SumII;
4+
import org.junit.Before;
5+
import org.junit.BeforeClass;
6+
import org.junit.Test;
7+
8+
import static junit.framework.Assert.assertEquals;
9+
10+
/**
11+
* Created by stevesun on 1/15/17.
12+
*/
13+
public class _4SumIITest {
14+
private static _4SumII test;
15+
private static int expected;
16+
private static int actual;
17+
private static int[] A;
18+
private static int[] B;
19+
private static int[] C;
20+
private static int[] D;
21+
22+
@BeforeClass
23+
public static void setup(){
24+
test = new _4SumII();
25+
}
26+
27+
@Before
28+
public void setupForEachTest(){
29+
expected = 0;
30+
actual = 0;
31+
A = new int[1000];
32+
B = new int[1000];
33+
C = new int[1000];
34+
D = new int[1000];
35+
}
36+
37+
@Test
38+
public void test1(){
39+
40+
A = new int[]{1,2};
41+
B = new int[]{-2,-1};
42+
C = new int[]{-1,2};
43+
D = new int[]{0,2};
44+
expected = 2;
45+
actual = test.fourSumCount(A, B, C, D);
46+
assertEquals(expected, actual);
47+
48+
}
49+
}

0 commit comments

Comments
 (0)