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

Commitfd336d9

Browse files
add test for 4
1 parente2127f9 commitfd336d9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
packagecom.fishercoder;
2+
3+
importcom.fishercoder.solutions._4;
4+
importorg.junit.BeforeClass;
5+
importorg.junit.Test;
6+
7+
importstaticorg.junit.Assert.assertEquals;
8+
9+
publicclass_4Test {
10+
privatestatic_4.Solution1solution1;
11+
privatestatic_4.Solution2solution2;
12+
privatestaticint[]A;
13+
privatestaticint[]B;
14+
15+
@BeforeClass
16+
publicstaticvoidsetup() {
17+
solution1 =new_4.Solution1();
18+
solution2 =new_4.Solution2();
19+
}
20+
21+
@Test
22+
publicvoidtest1() {
23+
A =newint[]{1,3};
24+
B =newint[]{2};
25+
assertEquals(2.0,solution1.findMedianSortedArrays(A,B),0.0);
26+
assertEquals(2.0,solution2.findMedianSortedArrays(A,B),0.0);
27+
}
28+
29+
@Test
30+
publicvoidtest2() {
31+
A =newint[]{1,2};
32+
B =newint[]{3,4};
33+
assertEquals(2.5,solution1.findMedianSortedArrays(A,B),0.0);
34+
assertEquals(2.5,solution2.findMedianSortedArrays(A,B),0.0);
35+
}
36+
37+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp