Fixed a bug where the polar parser would attempt to insert (wind speed, windspeed, windangle) instead of (windspeed, windangle, boatspeed). Removed some unused constructors from RaceXMLReader, and fixed a bug where it wouldn't actually use the polar table correctly. Boat's constructor now expects a Polars table. Added some comments to the Polars class, and specified the HashMap's template parameters Added PolarsTest - which needs to be implemented properly when the VMG calculations have been added. #story[900]main
parent
4f8d6b14d4
commit
693da8a82a
@ -0,0 +1,47 @@
|
||||
package seng302.Model;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import seng302.DataInput.PolarParser;
|
||||
import seng302.Exceptions.InvalidPolarFileException;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by f123 on 10-May-17.
|
||||
*/
|
||||
public class PolarsTest {
|
||||
|
||||
@Test
|
||||
/**
|
||||
* Tests if we can parse a polar data file (stored in a string), create a polar table, and calculate VMG for a variety of values.
|
||||
*/
|
||||
public void testParseAndVMG() throws Exception {
|
||||
|
||||
//Read data.
|
||||
Polars polars;
|
||||
try {
|
||||
//Parse data file.
|
||||
polars = PolarParser.parse("polars/acc_polars.csv");
|
||||
}
|
||||
catch (InvalidPolarFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
||||
//Test 1.
|
||||
//TODO make these tests actually do something when the calculateVMG function is added.
|
||||
double windAngle1 = 31.5;
|
||||
double destAngle1 = 65.32;
|
||||
double windSpeed1 = 15;//knots
|
||||
//double vmgAngle1 = TODO;
|
||||
//double vmgSpeed1 = TODO;
|
||||
|
||||
//VMG calcVMG1 = Polars.calculateVMG(windAngle1, destAngle1, windSpeed1);
|
||||
//double calcVMGAngle1 = calcVMG1.getKey();
|
||||
//double calcVMGSpeed1 = calcVMG1.getValue();
|
||||
|
||||
//assertEquals(vmgAngle1, calcVMGAngle1, 0.1);
|
||||
//assertEquals(vmgSpeed1, calcVMGSpeed1, 0.1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in new issue