Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit00c5e1b

Browse files
move test to test folder
1 parente601023 commit00c5e1b

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
returnresult;
5050
}
51-
52-
publicstaticvoidmain(String...args){
53-
int[]A =newint[]{1,2};
54-
int[]B =newint[]{-2,-1};
55-
int[]C =newint[]{-1,2};
56-
int[]D =newint[]{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+
packagecom.stevesun;
2+
3+
importcom.stevesun.solutions._4SumII;
4+
importorg.junit.Before;
5+
importorg.junit.BeforeClass;
6+
importorg.junit.Test;
7+
8+
importstaticjunit.framework.Assert.assertEquals;
9+
10+
/**
11+
* Created by stevesun on 1/15/17.
12+
*/
13+
publicclass_4SumIITest {
14+
privatestatic_4SumIItest;
15+
privatestaticintexpected;
16+
privatestaticintactual;
17+
privatestaticint[]A;
18+
privatestaticint[]B;
19+
privatestaticint[]C;
20+
privatestaticint[]D;
21+
22+
@BeforeClass
23+
publicstaticvoidsetup(){
24+
test =new_4SumII();
25+
}
26+
27+
@Before
28+
publicvoidsetupForEachTest(){
29+
expected =0;
30+
actual =0;
31+
A =newint[1000];
32+
B =newint[1000];
33+
C =newint[1000];
34+
D =newint[1000];
35+
}
36+
37+
@Test
38+
publicvoidtest1(){
39+
40+
A =newint[]{1,2};
41+
B =newint[]{-2,-1};
42+
C =newint[]{-1,2};
43+
D =newint[]{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)

[8]ページ先頭

©2009-2025 Movatter.jp