Added test for changing wind direction.
#story[882]
This commit is contained in:
@@ -42,6 +42,7 @@ public class Race implements Runnable {
|
|||||||
private static int boatOffset = 0;
|
private static int boatOffset = 0;
|
||||||
private int finished = 0;
|
private int finished = 0;
|
||||||
private int windDir;
|
private int windDir;
|
||||||
|
private int changeWindChance = 4;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,7 +118,7 @@ public class Race implements Runnable {
|
|||||||
* Changes the wind direction. Checks to make sure wind direction is between 0 - 65535
|
* Changes the wind direction. Checks to make sure wind direction is between 0 - 65535
|
||||||
*/
|
*/
|
||||||
protected void changeWindDir(){
|
protected void changeWindDir(){
|
||||||
int r = new Random().nextInt(4) + 1;
|
int r = new Random().nextInt(changeWindChance) + 1;
|
||||||
if (r == 1){
|
if (r == 1){
|
||||||
windDir+=100;
|
windDir+=100;
|
||||||
} else if (r == 2) {
|
} else if (r == 2) {
|
||||||
@@ -129,7 +130,18 @@ public class Race implements Runnable {
|
|||||||
if (windDir < 0){
|
if (windDir < 0){
|
||||||
windDir += 65535;
|
windDir += 65535;
|
||||||
}
|
}
|
||||||
System.out.println(windDir);
|
}
|
||||||
|
|
||||||
|
protected void setWindDir(int windDir){
|
||||||
|
this.windDir = windDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setWindChangeChance(int windChance){
|
||||||
|
this.changeWindChance = windChance;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getWindDir(){
|
||||||
|
return this.windDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,230 +20,247 @@
|
|||||||
//import static org.junit.Assert.fail;
|
//import static org.junit.Assert.fail;
|
||||||
//import static org.mockito.Matchers.any;
|
//import static org.mockito.Matchers.any;
|
||||||
//import static org.mockito.Mockito.atLeast;
|
//import static org.mockito.Mockito.atLeast;
|
||||||
|
//import static org.mockito.Mockito.mock;
|
||||||
//import static org.mockito.Mockito.verify;
|
//import static org.mockito.Mockito.verify;
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by esa46 on 15/03/17.
|
|
||||||
// */
|
|
||||||
//public class RaceTest{
|
|
||||||
//
|
|
||||||
// private static MockOutput mockOutput;
|
|
||||||
// SharedModel.Leg START_LEG = new SharedModel.Leg("Start", new SharedModel.Marker(new SharedModel.GPSCoordinate(0, 0)), new SharedModel.Marker(new SharedModel.GPSCoordinate(1, 1)), 0);
|
|
||||||
// SharedModel.Leg FINISH_LEG = new SharedModel.Leg("Finish", new SharedModel.Marker(new SharedModel.GPSCoordinate(1, 1)), new SharedModel.Marker(new SharedModel.GPSCoordinate(2, 2)), 0);
|
|
||||||
//
|
|
||||||
//// @Override
|
|
||||||
//// public void start(Stage primaryStage) throws Exception{}
|
|
||||||
////
|
////
|
||||||
//// public static void main(String[] args) {
|
/////**
|
||||||
//// launch(args);
|
//// * Created by esa46 on 15/03/17.
|
||||||
//// }
|
//// */
|
||||||
//
|
////public class RaceTest{
|
||||||
//
|
//////
|
||||||
//// @BeforeClass
|
////// private static MockOutput mockOutput;
|
||||||
//// public static void initJFX() {
|
////// SharedModel.Leg START_LEG = new SharedModel.Leg("Start", new SharedModel.Marker(new SharedModel.GPSCoordinate(0, 0)), new SharedModel.Marker(new SharedModel.GPSCoordinate(1, 1)), 0);
|
||||||
//// Thread t = new Thread("JavaFX Init Thread") {
|
////// SharedModel.Leg FINISH_LEG = new SharedModel.Leg("Finish", new SharedModel.Marker(new SharedModel.GPSCoordinate(1, 1)), new SharedModel.Marker(new SharedModel.GPSCoordinate(2, 2)), 0);
|
||||||
//// public void run() {
|
//////
|
||||||
//// Application.launch(TestApp.class, new String[0]);
|
//////// @Override
|
||||||
//// }
|
//////// public void start(Stage primaryStage) throws Exception{}
|
||||||
//// };
|
////////
|
||||||
//// t.setDaemon(true);
|
//////// public static void main(String[] args) {
|
||||||
//// t.start();
|
//////// launch(args);
|
||||||
//// }
|
//////// }
|
||||||
//
|
//////
|
||||||
// @BeforeClass
|
//////
|
||||||
// public static void setUp() {
|
//////// @BeforeClass
|
||||||
// try {
|
//////// public static void initJFX() {
|
||||||
// mockOutput = new MockOutput();
|
//////// Thread t = new Thread("JavaFX Init Thread") {
|
||||||
// } catch(IOException e) {
|
//////// public void run() {
|
||||||
// fail();
|
//////// Application.launch(TestApp.class, new String[0]);
|
||||||
// }
|
//////// }
|
||||||
// }
|
//////// };
|
||||||
//
|
//////// t.setDaemon(true);
|
||||||
// @Ignore
|
//////// t.start();
|
||||||
// @Test
|
//////// }
|
||||||
// public void boatLocationMessagesAreGenerated() {
|
//////
|
||||||
// try {
|
////// @BeforeClass
|
||||||
// RaceDataSource raceDataSource = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
////// public static void setUp() {
|
||||||
//
|
////// try {
|
||||||
// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
////// mockOutput = new MockOutput();
|
||||||
// Race race = new Race(raceDataSource, 100, mockOutput);
|
////// } catch(IOException e) {
|
||||||
// new Thread((race)).start();
|
////// fail();
|
||||||
//
|
////// }
|
||||||
// try {
|
////// }
|
||||||
// Thread.sleep(5000);
|
//////
|
||||||
// } catch (InterruptedException e) {
|
////// @Ignore
|
||||||
// fail();
|
////// @Test
|
||||||
// }
|
////// public void boatLocationMessagesAreGenerated() {
|
||||||
// verify(mockOutput, atLeast(400)).parseBoatLocation(any());
|
////// try {
|
||||||
//
|
////// RaceDataSource raceDataSource = new RaceXMLReader("raceXML/bermuda_AC35.xml");
|
||||||
// } catch (IOException e) {
|
//////
|
||||||
// fail();
|
////// MockOutput mockOutput = Mockito.mock(MockOutput.class);
|
||||||
// } catch (SAXException e) {
|
////// Race race = new Race(raceDataSource, 100, mockOutput);
|
||||||
// fail();
|
////// new Thread((race)).start();
|
||||||
// } catch (ParserConfigurationException e) {
|
//////
|
||||||
// fail();
|
////// try {
|
||||||
// }
|
////// Thread.sleep(5000);
|
||||||
// }
|
////// } catch (InterruptedException e) {
|
||||||
|
////// fail();
|
||||||
|
////// }
|
||||||
|
////// verify(mockOutput, atLeast(400)).parseBoatLocation(any());
|
||||||
|
//////
|
||||||
|
////// } catch (IOException e) {
|
||||||
|
////// fail();
|
||||||
|
////// } catch (SAXException e) {
|
||||||
|
////// fail();
|
||||||
|
////// } catch (ParserConfigurationException e) {
|
||||||
|
////// fail();
|
||||||
|
////// }
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Test
|
||||||
|
////// public void timerCanBeDisabled() {
|
||||||
|
////// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("Test 1", 10000, Color.ALICEBLUE, "t1", 1);
|
||||||
|
////// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("Test 2", 10000, Color.BURLYWOOD, "t2", 2);
|
||||||
|
////// List<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
////// boats.add(boat1);
|
||||||
|
////// boats.add(boat2);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(START_LEG);
|
||||||
|
////// legs.add(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 5, mockOutput);
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
////// long timeStarted = System.currentTimeMillis();
|
||||||
|
////// race.run();
|
||||||
|
////// assertTrue(System.currentTimeMillis() - timeStarted < 4000);
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Test
|
||||||
|
////// public void checkPositionUpdatesNumberFinishedBoats() {
|
||||||
|
//////
|
||||||
|
////// SharedModel.BoatInRace finishedBoat = new SharedModel.BoatInRace("Test", 1000, Color.ALICEBLUE, "tt", 1);
|
||||||
|
////// finishedBoat.setDistanceTravelledInLeg(500);
|
||||||
|
//////
|
||||||
|
////// finishedBoat.setCurrentLeg(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
////// boats.add(finishedBoat);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 5, mockOutput);
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
////// assertEquals(race.boatsFinished, 0);
|
||||||
|
//////
|
||||||
|
////// race.checkPosition(finishedBoat, 100000);
|
||||||
|
////// assertEquals(race.boatsFinished, 1);
|
||||||
|
////// assertEquals(finishedBoat.getTimeFinished(), 100000);
|
||||||
|
//////
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Test
|
||||||
|
////// public void checkPositionDoesntUpdateNumberFinishedBoats() {
|
||||||
|
//////
|
||||||
|
////// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 1);
|
||||||
|
////// unFinishedBoat.setDistanceTravelledInLeg(0);
|
||||||
|
//////
|
||||||
|
////// unFinishedBoat.setCurrentLeg(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
////// boats.add(unFinishedBoat);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 1, mockOutput);
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
////// assertEquals(race.boatsFinished, 0);
|
||||||
|
////// race.checkPosition(unFinishedBoat, 100);
|
||||||
|
////// assertEquals(race.boatsFinished, 0);
|
||||||
|
//////
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Test
|
||||||
|
////// public void distanceTravelledBeforeUpdatingLegIsRetained() {
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
//////
|
||||||
|
////// legs.add(START_LEG);
|
||||||
|
////// legs.add(FINISH_LEG);
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 1, mockOutput);
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
//////
|
||||||
|
////// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 4);
|
||||||
|
////// unFinishedBoat.setDistanceTravelledInLeg(100);
|
||||||
|
////// unFinishedBoat.setCurrentLeg(START_LEG);
|
||||||
|
//////
|
||||||
|
////// race.checkPosition(unFinishedBoat, 100);
|
||||||
|
////// assertEquals(unFinishedBoat.getCurrentLeg().getName(), "Finish");
|
||||||
|
////// assertTrue(unFinishedBoat.getDistanceTravelledInLeg() > 0);
|
||||||
|
////// assertTrue(unFinishedBoat.getDistanceTravelledInLeg() < 100);
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Ignore
|
||||||
|
////// @Test
|
||||||
|
////// public void timerDelaysByHalfSecond() throws InterruptedException {
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(START_LEG);
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 1, mockOutput);
|
||||||
|
////// race.PRERACE_TIME = 500;
|
||||||
|
////// race.runRace = false;
|
||||||
|
//////
|
||||||
|
////// race.countdownTimer();
|
||||||
|
//////
|
||||||
|
////// long timeStarted = System.currentTimeMillis();
|
||||||
|
////// long currentTime = System.currentTimeMillis();
|
||||||
|
////// while (!race.countdownFinish) {
|
||||||
|
////// currentTime = System.currentTimeMillis();
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// assertTrue(currentTime - timeStarted > 500);
|
||||||
|
////// }
|
||||||
|
//////
|
||||||
|
////// @Test
|
||||||
|
////// public void scalerScalesVelocityCorrectly() {
|
||||||
|
//////
|
||||||
|
////// int scaleFactor = 3;
|
||||||
|
////// float vel1 = 0;
|
||||||
|
////// float vel2 = (float) 1.999;
|
||||||
|
////// float vel3 = (float) 32.5;
|
||||||
|
////// float vel4 = 500;
|
||||||
|
////// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("test", vel1, Color.ALICEBLUE, "tt",1);
|
||||||
|
////// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("test", vel2, Color.ALICEBLUE, "tt", 2);
|
||||||
|
////// SharedModel.BoatInRace boat3 = new SharedModel.BoatInRace("test", vel3, Color.ALICEBLUE, "tt", 3);
|
||||||
|
////// SharedModel.BoatInRace boat4 = new SharedModel.BoatInRace("test", vel4, Color.ALICEBLUE, "tt", 4);
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
////// boats.add(boat1);
|
||||||
|
////// boats.add(boat2);
|
||||||
|
////// boats.add(boat3);
|
||||||
|
////// boats.add(boat4);
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(START_LEG);
|
||||||
|
//////
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, scaleFactor, mockOutput);
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
//////
|
||||||
|
////// assertEquals(race.getStartingBoats().get(0).getScaledVelocity(), vel1 * scaleFactor, 1e-6);
|
||||||
|
////// assertEquals(race.getStartingBoats().get(1).getScaledVelocity(), vel2 * scaleFactor, 1e-6);
|
||||||
|
////// assertEquals(race.getStartingBoats().get(2).getScaledVelocity(), vel3 * scaleFactor, 1e-6);
|
||||||
|
////// assertEquals(race.getStartingBoats().get(3).getScaledVelocity(), vel4 * scaleFactor, 1e-6);
|
||||||
|
//////
|
||||||
|
////// }
|
||||||
|
////// @Test
|
||||||
|
////// public void doNotFinishCorrectly() {
|
||||||
|
////// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
||||||
|
//////
|
||||||
|
////// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
||||||
|
////// legs.add(START_LEG);
|
||||||
|
//////
|
||||||
|
////// Race race = new Race(boats, legs, 1, mockOutput);
|
||||||
|
//////
|
||||||
|
////// race.setDnfChance(100);
|
||||||
|
////// assertTrue(race.doNotFinish());
|
||||||
|
//////
|
||||||
|
////// race.setDnfChance(0);
|
||||||
|
////// assertTrue(!race.doNotFinish());
|
||||||
|
////// }
|
||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
// public void timerCanBeDisabled() {
|
// public void windDirectionCorrectMaxMinValue() {
|
||||||
// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("Test 1", 10000, Color.ALICEBLUE, "t1", 1);
|
// ArrayList<Boat> boats = new ArrayList<>();
|
||||||
// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("Test 2", 10000, Color.BURLYWOOD, "t2", 2);
|
// ArrayList<Leg> legs = new ArrayList<>();
|
||||||
// List<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
// boats.add(boat1);
|
|
||||||
// boats.add(boat2);
|
|
||||||
//
|
//
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
// Race race = new Race(boats, legs, 1, 1, null);
|
||||||
// legs.add(START_LEG);
|
// race.setWindDir(65535);
|
||||||
// legs.add(FINISH_LEG);
|
// race.setWindChangeChance(1);
|
||||||
|
// race.changeWindDir();
|
||||||
|
// assertEquals(100, race.getWindDir());
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Race race = new Race(boats, legs, 5, mockOutput);
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
// long timeStarted = System.currentTimeMillis();
|
|
||||||
// race.run();
|
|
||||||
// assertTrue(System.currentTimeMillis() - timeStarted < 4000);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionUpdatesNumberFinishedBoats() {
|
|
||||||
//
|
|
||||||
// SharedModel.BoatInRace finishedBoat = new SharedModel.BoatInRace("Test", 1000, Color.ALICEBLUE, "tt", 1);
|
|
||||||
// finishedBoat.setDistanceTravelledInLeg(500);
|
|
||||||
//
|
|
||||||
// finishedBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
// boats.add(finishedBoat);
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
// legs.add(FINISH_LEG);
|
|
||||||
//
|
|
||||||
// Race race = new Race(boats, legs, 5, mockOutput);
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
// assertEquals(race.boatsFinished, 0);
|
|
||||||
//
|
|
||||||
// race.checkPosition(finishedBoat, 100000);
|
|
||||||
// assertEquals(race.boatsFinished, 1);
|
|
||||||
// assertEquals(finishedBoat.getTimeFinished(), 100000);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void checkPositionDoesntUpdateNumberFinishedBoats() {
|
|
||||||
//
|
|
||||||
// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 1);
|
|
||||||
// unFinishedBoat.setDistanceTravelledInLeg(0);
|
|
||||||
//
|
|
||||||
// unFinishedBoat.setCurrentLeg(FINISH_LEG);
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
// boats.add(unFinishedBoat);
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
// legs.add(FINISH_LEG);
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Race race = new Race(boats, legs, 1, mockOutput);
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
// assertEquals(race.boatsFinished, 0);
|
|
||||||
// race.checkPosition(unFinishedBoat, 100);
|
|
||||||
// assertEquals(race.boatsFinished, 0);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void distanceTravelledBeforeUpdatingLegIsRetained() {
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// legs.add(START_LEG);
|
|
||||||
// legs.add(FINISH_LEG);
|
|
||||||
//
|
|
||||||
// Race race = new Race(boats, legs, 1, mockOutput);
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
//
|
|
||||||
// SharedModel.BoatInRace unFinishedBoat = new SharedModel.BoatInRace("Test", 10, Color.ALICEBLUE, "tt", 4);
|
|
||||||
// unFinishedBoat.setDistanceTravelledInLeg(100);
|
|
||||||
// unFinishedBoat.setCurrentLeg(START_LEG);
|
|
||||||
//
|
|
||||||
// race.checkPosition(unFinishedBoat, 100);
|
|
||||||
// assertEquals(unFinishedBoat.getCurrentLeg().getName(), "Finish");
|
|
||||||
// assertTrue(unFinishedBoat.getDistanceTravelledInLeg() > 0);
|
|
||||||
// assertTrue(unFinishedBoat.getDistanceTravelledInLeg() < 100);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Ignore
|
|
||||||
// @Test
|
|
||||||
// public void timerDelaysByHalfSecond() throws InterruptedException {
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
// legs.add(START_LEG);
|
|
||||||
//
|
|
||||||
// Race race = new Race(boats, legs, 1, mockOutput);
|
|
||||||
// race.PRERACE_TIME = 500;
|
|
||||||
// race.runRace = false;
|
|
||||||
//
|
|
||||||
// race.countdownTimer();
|
|
||||||
//
|
|
||||||
// long timeStarted = System.currentTimeMillis();
|
|
||||||
// long currentTime = System.currentTimeMillis();
|
|
||||||
// while (!race.countdownFinish) {
|
|
||||||
// currentTime = System.currentTimeMillis();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// assertTrue(currentTime - timeStarted > 500);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void scalerScalesVelocityCorrectly() {
|
|
||||||
//
|
|
||||||
// int scaleFactor = 3;
|
|
||||||
// float vel1 = 0;
|
|
||||||
// float vel2 = (float) 1.999;
|
|
||||||
// float vel3 = (float) 32.5;
|
|
||||||
// float vel4 = 500;
|
|
||||||
// SharedModel.BoatInRace boat1 = new SharedModel.BoatInRace("test", vel1, Color.ALICEBLUE, "tt",1);
|
|
||||||
// SharedModel.BoatInRace boat2 = new SharedModel.BoatInRace("test", vel2, Color.ALICEBLUE, "tt", 2);
|
|
||||||
// SharedModel.BoatInRace boat3 = new SharedModel.BoatInRace("test", vel3, Color.ALICEBLUE, "tt", 3);
|
|
||||||
// SharedModel.BoatInRace boat4 = new SharedModel.BoatInRace("test", vel4, Color.ALICEBLUE, "tt", 4);
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
// boats.add(boat1);
|
|
||||||
// boats.add(boat2);
|
|
||||||
// boats.add(boat3);
|
|
||||||
// boats.add(boat4);
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
// legs.add(START_LEG);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Race race = new Race(boats, legs, scaleFactor, mockOutput);
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
//
|
|
||||||
// assertEquals(race.getStartingBoats().get(0).getScaledVelocity(), vel1 * scaleFactor, 1e-6);
|
|
||||||
// assertEquals(race.getStartingBoats().get(1).getScaledVelocity(), vel2 * scaleFactor, 1e-6);
|
|
||||||
// assertEquals(race.getStartingBoats().get(2).getScaledVelocity(), vel3 * scaleFactor, 1e-6);
|
|
||||||
// assertEquals(race.getStartingBoats().get(3).getScaledVelocity(), vel4 * scaleFactor, 1e-6);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// @Test
|
|
||||||
// public void doNotFinishCorrectly() {
|
|
||||||
// ArrayList<SharedModel.BoatInRace> boats = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// ArrayList<SharedModel.Leg> legs = new ArrayList<>();
|
|
||||||
// legs.add(START_LEG);
|
|
||||||
//
|
|
||||||
// Race race = new Race(boats, legs, 1, mockOutput);
|
|
||||||
//
|
|
||||||
// race.setDnfChance(100);
|
|
||||||
// assertTrue(race.doNotFinish());
|
|
||||||
//
|
|
||||||
// race.setDnfChance(0);
|
|
||||||
// assertTrue(!race.doNotFinish());
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user