Amended wake tests to handle markers instead of direct coordinates
#test
This commit is contained in:
@@ -109,49 +109,50 @@ public class BoatInRaceTest {
|
|||||||
assertTrue(testBoat.getCurrentPosition() == null);
|
assertTrue(testBoat.getCurrentPosition() == null);
|
||||||
assertTrue(testBoat.toString().contains("Name can change"));
|
assertTrue(testBoat.toString().contains("Name can change"));
|
||||||
assertEquals(testBoat.getVelocity(), 20.0);
|
assertEquals(testBoat.getVelocity(), 20.0);
|
||||||
assertTrue(testBoat.getVelocityProp().toString().contains("20.0"));
|
assertTrue(testBoat.getVelocityProp().toString().contains("20"));
|
||||||
assertTrue(testBoat.getAbbrev().equals("tt"));
|
assertTrue(testBoat.getAbbrev().equals("tt"));
|
||||||
assertTrue(testBoat.getColour().equals(Color.ALICEBLUE));
|
assertTrue(testBoat.getColour().equals(Color.ALICEBLUE));
|
||||||
assertFalse(testBoat.isFinished());
|
assertFalse(testBoat.isFinished());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// @Test
|
@Test
|
||||||
// public void getWakeAtProperHeading() throws Exception {
|
public void getWakeAtProperHeading() throws Exception {
|
||||||
// BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
|
BoatInRace boat = new BoatInRace("Test", 1, Color.ALICEBLUE, "tt");
|
||||||
//
|
|
||||||
// // Construct leg of 0 degrees
|
// Construct leg of 0 degrees
|
||||||
// GPSCoordinate startPoint = new GPSCoordinate(0, 0);
|
Marker startMarker = new Marker(ORIGIN_COORDS);
|
||||||
// GPSCoordinate endPoint = new GPSCoordinate(50, 0);
|
Marker endMarker = new Marker(new GPSCoordinate(50, 0));
|
||||||
// Leg leg0deg = new Leg("Start", startPoint, endPoint, 0);
|
Leg leg0deg = new Leg("Start", startMarker, endMarker, 0);
|
||||||
// boat.setCurrentLeg(leg0deg);
|
boat.setCurrentLeg(leg0deg);
|
||||||
// boat.setCurrentPosition(new GPSCoordinate(0,0));
|
boat.setCurrentPosition(new GPSCoordinate(0, 0));
|
||||||
//
|
|
||||||
// assertEquals(0, boat.calculateHeading(), 1e-8);
|
assertEquals(0, boat.calculateHeading(), 1e-8);
|
||||||
//
|
|
||||||
// // Construct leg from wake - heading should be 180 degrees
|
// Construct leg from wake - heading should be 180 degrees
|
||||||
// Leg leg180deg = new Leg("Start", startPoint, boat.getWake(), 0);
|
Leg leg180deg = new Leg("Start", startMarker, new Marker(boat.getWake()), 0);
|
||||||
// boat.setCurrentLeg(leg180deg);
|
boat.setCurrentLeg(leg180deg);
|
||||||
//
|
|
||||||
// assertEquals(180, boat.calculateHeading(), 1e-8);
|
assertEquals(180, boat.calculateHeading(), 1e-8);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void getWakeProportionalToVelocity() throws Exception {
|
@Test
|
||||||
// BoatInRace boat = new BoatInRace("Test", 10, Color.ALICEBLUE, "tt");
|
public void getWakeProportionalToVelocity() throws Exception {
|
||||||
//
|
BoatInRace boat = new BoatInRace("Test", 10, Color.ALICEBLUE, "tt");
|
||||||
// // Construct leg of 0 degrees at 0 N
|
|
||||||
// GPSCoordinate startPoint = new GPSCoordinate(0, 0);
|
// Construct leg of 0 degrees at 0 N
|
||||||
// GPSCoordinate endPoint = new GPSCoordinate(50, 0);
|
Marker startMarker = new Marker(ORIGIN_COORDS);
|
||||||
// Leg leg0deg = new Leg("Start", startPoint, endPoint, 0);
|
Marker endMarker = new Marker(new GPSCoordinate(50, 0));
|
||||||
// boat.setCurrentLeg(leg0deg);
|
Leg leg0deg = new Leg("Start", startMarker, endMarker, 0);
|
||||||
// boat.setCurrentPosition(new GPSCoordinate(0,0));
|
boat.setCurrentLeg(leg0deg);
|
||||||
//
|
boat.setCurrentPosition(new GPSCoordinate(0,0));
|
||||||
// // Get latitude of endpoint of wake at 10 kn (longitude is 0)
|
|
||||||
// double endpointAt10Kn = boat.getWake().getLatitude();
|
// Get latitude of endpoint of wake at 10 kn (longitude is 0)
|
||||||
//
|
double endpointAt10Kn = boat.getWake().getLatitude();
|
||||||
// // Latitude of endpoint at 20 kn should be twice endpoint at 10 kn
|
|
||||||
// boat.setVelocity(20);
|
// Latitude of endpoint at 20 kn should be twice endpoint at 10 kn
|
||||||
// assertEquals(2*endpointAt10Kn, boat.getWake().getLatitude(), 1e-8);
|
boat.setVelocity(20);
|
||||||
// }
|
assertEquals(2*endpointAt10Kn, boat.getWake().getLatitude(), 1e-8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user