mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
deleted a whole bunch of legacy code, primarily the old controllers and old parsers #story[923]
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
package seng302;
|
||||
|
||||
import org.junit.Test;
|
||||
import seng302.models.Race;
|
||||
import seng302.models.Yacht;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Unit test for the Race class.
|
||||
*/
|
||||
public class RaceTest {
|
||||
/**
|
||||
* Test that all boats were added to the race
|
||||
*/
|
||||
@Test
|
||||
public void testAddingBoatsToRace() {
|
||||
Yacht boat1 = new Yacht("Team 1");
|
||||
Yacht boat2 = new Yacht("Team 2");
|
||||
|
||||
Race race = new Race();
|
||||
race.addBoat(boat1);
|
||||
race.addBoat(boat2);
|
||||
|
||||
assertEquals(Array.getLength(race.getBoats()), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetShuffledBoats(){
|
||||
Yacht boat1 = new Yacht("Team 1");
|
||||
Yacht boat2 = new Yacht("Team 2");
|
||||
|
||||
Race race = new Race();
|
||||
race.addBoat(boat1);
|
||||
race.addBoat(boat2);
|
||||
|
||||
assertEquals(Array.getLength(race.getShuffledBoats()), 2);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package seng302.models.parsers;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by Haoming on 23/03/17.
|
||||
*/
|
||||
public class ConfigParserTest {
|
||||
|
||||
private ConfigParser cp;
|
||||
|
||||
@Before
|
||||
public void initializeParser() throws Exception {
|
||||
cp = new ConfigParser("/config/config.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getWindDirection() throws Exception {
|
||||
assertEquals(135, cp.getWindDirection(), 1e-10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTimeScale() throws Exception {
|
||||
assertEquals(10.0, cp.getTimeScale(), 1e-10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDoubleByTagName() throws Exception {
|
||||
assertEquals(6, cp.getDoubleByTagName("race-size", 0), 1e-10);
|
||||
assertEquals(100, cp.getDoubleByTagName("noTag", 100), 1e-10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getStringByTagName() throws Exception {
|
||||
assertEquals("AC35", cp.getStringByTagName("race-name", "11"));
|
||||
assertEquals("oops", cp.getStringByTagName("noTag", "oops"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package seng302.models.parsers;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import seng302.models.mark.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* To test if course parser works as expected.
|
||||
* Created by Haoming on 17/03/17.
|
||||
*/
|
||||
public class CourseParserTest {
|
||||
|
||||
private CourseParser cp;
|
||||
|
||||
@Before
|
||||
public void initializeParser() throws Exception {
|
||||
cp = new CourseParser("/config/course.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getGates() throws Exception {
|
||||
ArrayList<Mark> course = cp.getCourse();
|
||||
|
||||
|
||||
GateMark gateMark1 = (GateMark) course.get(0);
|
||||
assertEquals(57.670633, gateMark1.getSingleMark2().getLatitude(), 0.00000001);
|
||||
assertEquals(11.8281330, gateMark1.getSingleMark2().getLongitude(), 0.00000001);
|
||||
|
||||
GateMark gateMark2 = (GateMark) course.get(5);
|
||||
|
||||
assertEquals("Finish1", gateMark2.getSingleMark1().getName());
|
||||
assertEquals("Finish2", gateMark2.getSingleMark2().getName());
|
||||
assertEquals(57.671824, gateMark2.getSingleMark2().getLatitude(), 0.00000001);
|
||||
assertEquals(11.844795, gateMark2.getSingleMark2().getLongitude(), 0.00000001);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMarks() throws Exception {
|
||||
ArrayList<Mark> course = cp.getCourse();
|
||||
assertEquals("Mid Mark", course.get(1).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOrder() {
|
||||
ArrayList<Mark> course = cp.getCourse();
|
||||
assertEquals(6, course.size());
|
||||
assertEquals("Start", course.get(0).getName());
|
||||
assertEquals("Mid Mark", course.get(1).getName());
|
||||
assertEquals("Leeward Gate", course.get(2).getName());
|
||||
assertEquals("Windward Gate", course.get(3).getName());
|
||||
assertEquals("Leeward Gate", course.get(4).getName());
|
||||
assertEquals("Finish", course.get(5).getName());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user