mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Started adding functionality to calculate yacht velocity from the wind speed and direction using polar tables. Also began writing tests to cover this functionality, as it can't currently be tested within the game itself.
#story[986]
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package seng302.models;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import seng302.utilities.GeoPoint;
|
||||
|
||||
public class YachtTest {
|
||||
|
||||
Double windDir;
|
||||
Double windSpd;
|
||||
List<Yacht> yachts = new ArrayList<Yacht>();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
PolarTable.parsePolarFile(getClass().getResourceAsStream("/config/acc_polars.csv"));
|
||||
windDir = 90d;
|
||||
windSpd = 10d;
|
||||
|
||||
yachts.add(new Yacht("Yacht 1", "Y1", new GeoPoint(-30.0, 20.0), 160.0));
|
||||
yachts.add(new Yacht("Yacht 2", "Y2", new GeoPoint(-40.0, -20.0), 100.0));
|
||||
yachts.add(new Yacht("Yacht 3", "Y3", new GeoPoint(-35.0, -15.5), 20.0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVelocityUpdate() {
|
||||
for (Yacht yacht : yachts) {
|
||||
yacht.updateYachtVelocity(windDir, windSpd);
|
||||
System.out.println(yacht.getVelocity());
|
||||
// TODO: 20/07/17 ajm412: add assertions.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user