use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.
the class SurveyUpdaterTest method testEditStationWorks.
@Test
public void testEditStationWorks() {
Leg leg = new Leg(5, 0, 0);
Survey survey = new Survey("Test Survey");
SurveyUpdater.update(survey, leg);
Leg newEdit = new Leg(6, 0, 0);
SurveyUpdater.editLeg(survey, leg, newEdit);
Assert.assertEquals(survey.getAllLegs().size(), 1);
Assert.assertEquals(survey.getAllLegs().get(0).getDistance(), 6, ALLOWED_DOUBLE_DELTA);
}
use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.
the class SurveyUpdaterTest method testUpdateWithThreeSimilarLegsLeadsToNewStation.
@Test
public void testUpdateWithThreeSimilarLegsLeadsToNewStation() {
Leg leg = new Leg(5, 0, 0);
Leg similarLeg = new Leg(5, 0.001f, 0);
Leg anotherSimilarLeg = new Leg(5, 0, 0.001f);
Survey survey = new Survey("Test Survey");
SurveyUpdater.update(survey, leg);
SurveyUpdater.update(survey, similarLeg);
SurveyUpdater.update(survey, anotherSimilarLeg);
Assert.assertEquals(survey.getAllStations().size(), 2);
}
use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.
the class SurveyUpdaterTest method testMoveLegWorks.
@Test
public void testMoveLegWorks() {
Survey survey = BasicTestSurveyCreator.createStraightNorth();
Leg toMove = survey.getStationByName("2").getOnwardLegs().get(0);
Station originatingStation = survey.getOriginatingStation(toMove);
Station destinationStation = survey.getStationByName("1");
Assert.assertNotEquals(originatingStation, destinationStation);
SurveyUpdater.moveLeg(survey, toMove, destinationStation);
Assert.assertTrue(destinationStation.getOnwardLegs().contains(toMove));
Assert.assertFalse(originatingStation.getOnwardLegs().contains(toMove));
}
use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.
the class StationNamerTest method testNameAdvancesNumberOnPotentialBranch.
@Test
public void testNameAdvancesNumberOnPotentialBranch() {
Survey testSurvey = BasicTestSurveyCreator.createStraightNorth();
String newName = StationNamer.generateNextStationName(testSurvey, testSurvey.getStationByName("1"));
int numberOfStations = testSurvey.getAllStations().size();
Assert.assertEquals(Integer.toString(numberOfStations + 1), newName);
}
use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.
the class StationNamerTest method testNameAdvancesNumberOnEstablishedBranch.
@Test
public void testNameAdvancesNumberOnEstablishedBranch() {
Survey testSurvey = BasicTestSurveyCreator.createStraightNorthWith1EBranch();
String newName = StationNamer.generateNextStationName(testSurvey, testSurvey.getStationByName("5"));
int numberOfStations = testSurvey.getAllStations().size();
Assert.assertEquals(Integer.toString(numberOfStations + 1), newName);
}
Aggregations