-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSweeplineTest.java
More file actions
89 lines (63 loc) · 2.28 KB
/
SweeplineTest.java
File metadata and controls
89 lines (63 loc) · 2.28 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
81
82
83
84
85
86
87
88
89
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*;
class SweeplineTest {
// Trivial overlap
@Test
void sweeplineTrue() {
Parameters parameters = new Parameters();
ArrayList<Rectangle> rectangles = new ArrayList<>();
Rectangle rectangle1 = new Rectangle(10, 10);
Rectangle rectangle2 = new Rectangle(10, 10);
rectangles.add(rectangle1);
rectangles.add(rectangle2);
parameters.rectangles = rectangles;
Solution solution = new Solution(parameters);
assertTrue(Util.sweepline(solution));
}
// Trivial overlap
@Test
void sweeplineTrue2() {
Parameters parameters = new Parameters();
ArrayList<Rectangle> rectangles = new ArrayList<>();
Rectangle rectangle1 = new Rectangle(10, 10);
Rectangle rectangle2 = new Rectangle(10, 10);
rectangle2.x = 5;
rectangle2.y = 5;
rectangles.add(rectangle1);
rectangles.add(rectangle2);
parameters.rectangles = rectangles;
Solution solution = new Solution(parameters);
assertTrue(Util.sweepline(solution));
}
// Trivial overlap
@Test
void sweeplineFalse() {
Parameters parameters = new Parameters();
ArrayList<Rectangle> rectangles = new ArrayList<>();
Rectangle rectangle1 = new Rectangle(10, 10);
Rectangle rectangle2 = new Rectangle(10, 10);
rectangle2.x = 10;
rectangle2.y = 10;
rectangles.add(rectangle1);
rectangles.add(rectangle2);
parameters.rectangles = rectangles;
Solution solution = new Solution(parameters);
assertFalse(Util.sweepline(solution));
}
// Trivial overlap
@Test
void sweeplineFalse2() {
Parameters parameters = new Parameters();
ArrayList<Rectangle> rectangles = new ArrayList<>();
Rectangle rectangle1 = new Rectangle(10, 10);
Rectangle rectangle2 = new Rectangle(10, 10);
rectangle2.x = 15;
rectangle2.y = 15;
rectangles.add(rectangle1);
rectangles.add(rectangle2);
parameters.rectangles = rectangles;
Solution solution = new Solution(parameters);
assertFalse(Util.sweepline(solution));
}
}