-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAltitudeNonCollisionTest.java
More file actions
62 lines (54 loc) · 2.29 KB
/
AltitudeNonCollisionTest.java
File metadata and controls
62 lines (54 loc) · 2.29 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
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Test class to make sure a collision is not wrongly predicted when a craft
* will pass over another craft with adequate vertical distance separating them.
*/
public class AltitudeNonCollisionTest {
/** xyz velocities */
private static final double[] HEADING1 = {0.0, 550.0, 0.0};
/** latitude, longitude, and altitude */
private static final double[] LOCATION1 = {0.0, 0.0, 1000.0};
/** xyz velocities */
private static final double[] HEADING2 = {-550.0, 0.0, 0.0};
/** latitude, longitude, and altitude */
private static final double[] LOCATION2 = {550.0, 550.0, 2000.0};
/** latitude, longitude, and altitude */
private static final double[] LOCATION3 = {550.0, 550.0, 1000.0};
/** Value for a warning level corresponding to no warning */
private static final int WARNING_LEVEL_GREEN = 0;
/** Ownship test object */
private final Aircraft thisPlane = new Aircraft("thisPlane", HEADING1,
LOCATION1, WARNING_LEVEL_GREEN);
/** Other aircraft test object */
private final Aircraft otherPlaneA = new Aircraft("otherPlane", HEADING2,
LOCATION2, WARNING_LEVEL_GREEN);
/** Another aircraft test object */
private final Aircraft otherPlaneB = new Aircraft("otherPlane", HEADING2,
LOCATION3, WARNING_LEVEL_GREEN);
/**
* Test that no collision is predicted when one plane will pass over another
* with adequate vertical distance
*/
@Test
public void testAltitudeSeparation() {
System.out.println("testAltitudeSeparation");
Collision expResult = null; // No collision
Collision result;
WarningLevelCalculator wlc = new WarningLevelCalculator();
result = wlc.detectCollision(thisPlane, otherPlaneA);
assertEquals(expResult, result);
}
/**
* Test that a collision is predicted when planes have no vertical distance
* between them and are on a clear collision vector with each other
*/
@Test
public void testAltitudeMatch() {
System.out.println("testAltitudeMatch");
Collision result;
WarningLevelCalculator wlc = new WarningLevelCalculator();
result = wlc.detectCollision(thisPlane, otherPlaneB);
assertTrue(result != null);
}
}