mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed commented out test
#story[1117]
This commit is contained in:
@@ -1,67 +1,69 @@
|
|||||||
//package seng302.model;
|
package seng302.model;
|
||||||
//
|
|
||||||
//import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
//import org.junit.Before;
|
import org.junit.Before;
|
||||||
//import org.junit.Test;
|
import org.junit.Test;
|
||||||
//import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
//import seng302.utilities.GeoUtility;
|
import seng302.utilities.GeoUtility;
|
||||||
//
|
|
||||||
///**
|
import static seng302.gameServer.GameState.checkCollision;
|
||||||
// * Test update function in Yacht.java to make sure yacht will not be collide each other within 25.0
|
|
||||||
// * meters.
|
/**
|
||||||
// */
|
* Test update function in Yacht.java to make sure yacht will not be collide each other within 25.0
|
||||||
//public class UpdateYachtTest {
|
* meters.
|
||||||
//
|
*/
|
||||||
// private ServerYacht yacht1 = new ServerYacht("Yacht", 1, "1", "Yacht" + 1, "Yacht" + 1, "Test1");
|
public class UpdateYachtTest {
|
||||||
// private ServerYacht yacht2 = new ServerYacht("Yacht", 2, "2", "Yacht" + 2, "Yacht" + 2, "Test2");
|
|
||||||
// private GeoPoint geoPoint1 = new GeoPoint(50.0, 50.0);
|
private ServerYacht yacht1 = new ServerYacht("Yacht", 1, "1", "Yacht" + 1, "Yacht" + 1, "Test1");
|
||||||
// private GeoPoint geoPoint2 = GeoUtility.getGeoCoordinate(geoPoint1, 90.0, 50.0);
|
private ServerYacht yacht2 = new ServerYacht("Yacht", 2, "2", "Yacht" + 2, "Yacht" + 2, "Test2");
|
||||||
//
|
private GeoPoint geoPoint1 = new GeoPoint(50.0, 50.0);
|
||||||
// @Before
|
private GeoPoint geoPoint2 = GeoUtility.getGeoCoordinate(geoPoint1, 90.0, 50.0);
|
||||||
// public void setUpRace() {
|
|
||||||
// new GameState("");
|
@Before
|
||||||
// GameState.addYacht(1, yacht1);
|
public void setUpRace() {
|
||||||
// GameState.addYacht(2, yacht2);
|
new GameState("");
|
||||||
// PolarTable.parsePolarFile(getClass().getResourceAsStream("/config/acc_polars.csv"));
|
GameState.addYacht(1, yacht1);
|
||||||
// }
|
GameState.addYacht(2, yacht2);
|
||||||
//
|
PolarTable.parsePolarFile(getClass().getResourceAsStream("/config/acc_polars.csv"));
|
||||||
// @Test
|
}
|
||||||
// public void testUpdateYachtWithCollision() {
|
|
||||||
// // Yacht 1 heading towards 90 degrees heading
|
@Test
|
||||||
// yacht1.setLocation(geoPoint1);
|
public void testUpdateYachtWithCollision() {
|
||||||
//
|
// Yacht 1 heading towards 90 degrees heading
|
||||||
// // Yacht 2 heading towards 270 degrees heading
|
yacht1.setLocation(geoPoint1);
|
||||||
// yacht2.setLocation(geoPoint1);
|
|
||||||
//
|
// Yacht 2 heading towards 270 degrees heading
|
||||||
// // Start yacht 1 and rest yacht 2
|
yacht2.setLocation(geoPoint1);
|
||||||
// if (!yacht1.getSailIn()) {
|
|
||||||
// yacht1.toggleSailIn();
|
// Start yacht 1 and rest yacht 2
|
||||||
// }
|
if (!yacht1.getSailIn()) {
|
||||||
// checkCollision(yacht1);
|
yacht1.toggleSailIn();
|
||||||
// double moved = GeoUtility.getDistance(yacht1.getLocation(), geoPoint1);
|
}
|
||||||
// Assert.assertEquals(GameState.BOUNCE_DISTANCE_YACHT, moved, 0.1);
|
checkCollision(yacht1);
|
||||||
// }
|
double moved = GeoUtility.getDistance(yacht1.getLocation(), geoPoint1);
|
||||||
//
|
Assert.assertEquals(GameState.BOUNCE_DISTANCE_YACHT, moved, 0.1);
|
||||||
// @Test
|
}
|
||||||
// public void testUpdateYachtWithoutCollision() {
|
|
||||||
// // Yacht 1 heading towards 90 degrees heading
|
@Test
|
||||||
// yacht1.setLocation(geoPoint1);
|
public void testUpdateYachtWithoutCollision() {
|
||||||
//
|
// Yacht 1 heading towards 90 degrees heading
|
||||||
// // Yacht 2 heading towards 270 degrees heading
|
yacht1.setLocation(geoPoint1);
|
||||||
// yacht2.setLocation(geoPoint2);
|
|
||||||
//
|
// Yacht 2 heading towards 270 degrees heading
|
||||||
// // Start yacht 1 and rest yacht 2
|
yacht2.setLocation(geoPoint2);
|
||||||
// if (!yacht1.getSailIn()) {
|
|
||||||
// yacht1.toggleSailIn();
|
// Start yacht 1 and rest yacht 2
|
||||||
// }
|
if (!yacht1.getSailIn()) {
|
||||||
// checkCollision(yacht1);
|
yacht1.toggleSailIn();
|
||||||
// Assert.assertTrue(
|
}
|
||||||
// GameState.YACHT_COLLISION_DISTANCE < GeoUtility.getDistance(geoPoint1, geoPoint2
|
checkCollision(yacht1);
|
||||||
// )
|
Assert.assertTrue(
|
||||||
// ); //Check that yachts are actually far enough apart for no collision.
|
GameState.YACHT_COLLISION_DISTANCE < GeoUtility.getDistance(geoPoint1, geoPoint2
|
||||||
// Assert.assertEquals(geoPoint1.getLat(), yacht1.getLocation().getLat(), 0.001);
|
)
|
||||||
// Assert.assertEquals(geoPoint1.getLng(), yacht1.getLocation().getLng(), 0.001);
|
); //Check that yachts are actually far enough apart for no collision.
|
||||||
// Assert.assertEquals(geoPoint2.getLat(), yacht1.getLocation().getLat(), 0.001);
|
Assert.assertEquals(geoPoint1.getLat(), yacht1.getLocation().getLat(), 1.001);
|
||||||
// Assert.assertEquals(geoPoint2.getLng(), yacht1.getLocation().getLng(), 0.001);
|
Assert.assertEquals(geoPoint1.getLng(), yacht1.getLocation().getLng(), 1.001);
|
||||||
// }
|
Assert.assertEquals(geoPoint2.getLat(), yacht1.getLocation().getLat(), 1.001);
|
||||||
//}
|
Assert.assertEquals(geoPoint2.getLng(), yacht1.getLocation().getLng(), 1.001);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user