Search in sources :

Example 21 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class MetadataTranslaterTest method testActiveStationIsTranslatedToJson.

@Test
public void testActiveStationIsTranslatedToJson() throws Exception {
    Survey survey = new Survey("test");
    String translated = MetadataTranslater.translate(survey);
    String expected = "{\"active-station\":\"1\",\"connections\":{}}";
    Assert.assertEquals(expected, translated.replaceAll("\\s", ""));
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 22 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurvexImporterTest method testBasicImportRecordsPromotions.

@Test
public void testBasicImportRecordsPromotions() throws Exception {
    final String testContent = "1\t2\t5.0\t0.0\t0.0\t; {from: 5.0 0.0 0.0, 5.0 0.0 0.0, 5.0 0.0 0.0}";
    Survey survey = new Survey("Test");
    SurvexImporter.parse(testContent, survey);
    Leg leg = survey.getOrigin().getConnectedOnwardLegs().get(0);
    Assert.assertEquals(3, leg.getPromotedFrom().length);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 23 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyJsonTranslaterTest method testSlightlyBiggerSurveyIsParsed.

@Test
public void testSlightlyBiggerSurveyIsParsed() throws Exception {
    Survey survey = BasicTestSurveyCreator.createRightRight();
    String text = SurveyJsonTranslater.toText(survey, "test", 0);
    Survey newSurvey = new Survey(TEST_SURVEY_NAME);
    SurveyJsonTranslater.populateSurvey(survey, text);
    SurveyChecker.areEqual(survey, newSurvey);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 24 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyJsonTranslaterTest method testEmptySurveyResultsIn1Station.

@Test
public void testEmptySurveyResultsIn1Station() throws Exception {
    Survey survey = new Survey(TEST_SURVEY_NAME);
    String text = SurveyJsonTranslater.toText(survey, "test", 0);
    Survey newSurvey = new Survey(TEST_SURVEY_NAME);
    SurveyJsonTranslater.populateSurvey(survey, text);
    assert newSurvey.getAllStations().size() == 1;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 25 with Survey

use of org.hwyl.sexytopo.model.survey.Survey in project sexytopo by richsmith.

the class SurveyJsonTranslaterTest method testRandomSurveyIsParsed.

@Test
public void testRandomSurveyIsParsed() throws Exception {
    Survey survey = TestSurveyCreator.create(TEST_SURVEY_NAME, 10, 10);
    String text = SurveyJsonTranslater.toText(survey, "test", 0);
    Survey newSurvey = new Survey(TEST_SURVEY_NAME);
    SurveyJsonTranslater.populateSurvey(survey, text);
    SurveyChecker.areEqual(survey, newSurvey);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Aggregations

Survey (org.hwyl.sexytopo.model.survey.Survey)101 Test (org.junit.Test)56 Station (org.hwyl.sexytopo.model.survey.Station)31 Leg (org.hwyl.sexytopo.model.survey.Leg)24 AlertDialog (android.app.AlertDialog)10 SuppressLint (android.annotation.SuppressLint)9 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)9 ArrayAdapter (android.widget.ArrayAdapter)8 File (java.io.File)6 HashMap (java.util.HashMap)6 View (android.view.View)5 EditText (android.widget.EditText)5 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 Context (android.content.Context)4 SharedPreferences (android.content.SharedPreferences)4 Editable (android.text.Editable)4 List (java.util.List)4 Map (java.util.Map)4 R (org.hwyl.sexytopo.R)4