use of org.hwyl.sexytopo.model.survey.Leg 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.Leg 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.Leg 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.Leg in project sexytopo by richsmith.
the class SurveyStatsTest method testLegCountsWithSplays.
@Test
public void testLegCountsWithSplays() {
Survey survey = BasicTestSurveyCreator.createStraightNorthWith2EBranchFromS2();
Station subStation = survey.getStationByName("2");
survey.setActiveStation(subStation);
Leg leg2 = new Leg(5, 0, 0);
SurveyUpdater.update(survey, leg2);
Assert.assertEquals(5, SurveyStats.calcNumberSubStations(subStation));
Assert.assertEquals(5, SurveyStats.calcNumberSubLegs(subStation));
}
Aggregations