|
|
|
|
@ -14,7 +14,7 @@ import static junit.framework.TestCase.assertEquals;
|
|
|
|
|
*/
|
|
|
|
|
public class LegTest {
|
|
|
|
|
|
|
|
|
|
private Marker ORIGIN_Compound_MARKER = new Marker(new GPSCoordinate(0, 0));
|
|
|
|
|
private Marker ORIGIN_COMPOUND_MARKER = new Marker(new GPSCoordinate(0, 0));
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void calculateDistanceHandles5nmNorth() {
|
|
|
|
|
@ -23,7 +23,7 @@ public class LegTest {
|
|
|
|
|
calc.setDirection(0, 5 * Constants.NMToMetersConversion);
|
|
|
|
|
|
|
|
|
|
Marker endMarker = getEndMarker(calc.getDestinationGeographicPoint());
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
|
|
|
|
|
assertEquals(test.getDistance(), 5, 1e-8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -34,7 +34,7 @@ public class LegTest {
|
|
|
|
|
calc.setDirection(90, 12 * Constants.NMToMetersConversion);
|
|
|
|
|
|
|
|
|
|
Marker endMarker = getEndMarker(calc.getDestinationGeographicPoint());
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
|
|
|
|
|
assertEquals(test.getDistance(), 12, 1e-8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ public class LegTest {
|
|
|
|
|
calc.setDirection(180, 0.5 * Constants.NMToMetersConversion);
|
|
|
|
|
|
|
|
|
|
Marker endMarker = getEndMarker(calc.getDestinationGeographicPoint());
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
|
|
|
|
|
assertEquals(test.getDistance(), 0.5, 1e-8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -56,14 +56,14 @@ public class LegTest {
|
|
|
|
|
calc.setDirection(-90, 0.1 * Constants.NMToMetersConversion);
|
|
|
|
|
|
|
|
|
|
Marker endMarker = getEndMarker(calc.getDestinationGeographicPoint());
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, endMarker, 0);
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, endMarker, 0);
|
|
|
|
|
assertEquals(test.getDistance(), 0.1, 1e-8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void calculateDistanceHandlesZeroDifference() {
|
|
|
|
|
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_Compound_MARKER, ORIGIN_Compound_MARKER, 0);
|
|
|
|
|
Leg test = new Leg("Test", ORIGIN_COMPOUND_MARKER, ORIGIN_COMPOUND_MARKER, 0);
|
|
|
|
|
assertEquals(test.getDistance(), 0, 1e-8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|