|
|
|
|
@ -5,6 +5,7 @@ import mock.exceptions.InvalidPolarFileException;
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import shared.model.Bearing;
|
|
|
|
|
import shared.model.CompoundMark;
|
|
|
|
|
import shared.model.GPSCoordinate;
|
|
|
|
|
import shared.model.Mark;
|
|
|
|
|
|
|
|
|
|
@ -19,6 +20,7 @@ public class MockBoatTest {
|
|
|
|
|
private MockBoat firstTestBoat;
|
|
|
|
|
|
|
|
|
|
private Mark markToTest;
|
|
|
|
|
private Mark markToTest2;
|
|
|
|
|
|
|
|
|
|
private GPSCoordinate highGPS;
|
|
|
|
|
private GPSCoordinate middleGPS;
|
|
|
|
|
@ -35,10 +37,11 @@ public class MockBoatTest {
|
|
|
|
|
Polars polars = PolarParser.parse("mock/polars/acc_polars.csv");
|
|
|
|
|
|
|
|
|
|
firstTestBoat = new MockBoat(1, "test", "NZ", polars);
|
|
|
|
|
highGPS = new GPSCoordinate(100, 100);
|
|
|
|
|
middleGPS = new GPSCoordinate(100, 75);
|
|
|
|
|
lowGPS = new GPSCoordinate(100, 50);
|
|
|
|
|
highGPS = new GPSCoordinate(-64.854000, 32.296577);
|
|
|
|
|
middleGPS = new GPSCoordinate(-64.854000, 32.292500);
|
|
|
|
|
lowGPS = new GPSCoordinate(-64.854000, 32.290000);
|
|
|
|
|
markToTest = new Mark(1, "test MARK", middleGPS);
|
|
|
|
|
markToTest2 = new Mark(2, "test MARK2", middleGPS);
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidPolarFileException e) {
|
|
|
|
|
fail("Couldn't parse polar file.");
|
|
|
|
|
@ -153,4 +156,19 @@ public class MockBoatTest {
|
|
|
|
|
|
|
|
|
|
assertEquals(firstTestBoat.isStarboardSide(markToTest), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests if a boat is between a gate
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testIsBetweenGate(){
|
|
|
|
|
markToTest.setPosition(highGPS);
|
|
|
|
|
markToTest2.setPosition(lowGPS);
|
|
|
|
|
CompoundMark testGate = new CompoundMark(1, "test GATE", markToTest, markToTest2);
|
|
|
|
|
|
|
|
|
|
firstTestBoat.setCurrentPosition(middleGPS);
|
|
|
|
|
|
|
|
|
|
assertEquals(firstTestBoat.isBetweenGate(testGate), true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|