Skip to content

Commit fd336d9

Browse files
add test for 4
1 parent e2127f9 commit fd336d9

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+
package com.fishercoder;
2+
3+
import com.fishercoder.solutions._4;
4+
import org.junit.BeforeClass;
5+
import org.junit.Test;
6+
7+
import static org.junit.Assert.assertEquals;
8+
9+
public class _4Test {
10+
private static _4.Solution1 solution1;
11+
private static _4.Solution2 solution2;
12+
private static int[] A;
13+
private static int[] B;
14+
15+
@BeforeClass
16+
public static void setup() {
17+
solution1 = new _4.Solution1();
18+
solution2 = new _4.Solution2();
19+
}
20+
21+
@Test
22+
public void test1() {
23+
A = new int[]{1, 3};
24+
B = new int[]{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+
public void test2() {
31+
A = new int[]{1, 2};
32+
B = new int[]{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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy