forked from alxsoares/topcoder-6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntersectTest.java
More file actions
80 lines (58 loc) · 1.7 KB
/
Copy pathIntersectTest.java
File metadata and controls
80 lines (58 loc) · 1.7 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class IntersectTest {
protected Intersect solution;
@Before
public void setUp() {
solution = new Intersect();
}
@Test(timeout = 2000)
public void testCase0() {
int[] x = new int[] { 0, 2, 3, -4 };
int[] y = new int[] { 17, 1000, 18, 6 };
int expected = 2;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase1() {
int[] x = new int[] { 10000, -10000 };
int[] y = new int[] { -10000, 10000 };
int expected = 400000000;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase2() {
int[] x = new int[] { 3, 8, 6, 12, 10, 15 };
int[] y = new int[] { 7, 17, 7, 17, 7, 17 };
int expected = 0;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase3() {
int[] x = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
int[] y = new int[] { 5, 5, 5, 5, 5, 5, 5, 5 };
int expected = 0;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase4() {
int[] x = new int[] { 2, 100, 5, 32, 1000, -20, 47, 12 };
int[] y = new int[] { 29, -1000, -800, -200, -900, 300, -600, -650 };
int expected = 1000;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
@Test(timeout = 2000)
public void testCase5() {
int[] x = new int[] { 1, 7, 12, 3, 16, 8, 3, 12 };
int[] y = new int[] { -90, -60, -70, 3, -60, -90, -80, -100 };
int expected = 0;
int actual = solution.area(x, y);
Assert.assertEquals(expected, actual);
}
}