Changeset 32871 in osm for applications/editors/josm/plugins/pt_assistant/test
- Timestamp:
- 2016-08-23T03:38:46+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/AbstractTest.java
r32783 r32871 54 54 public static final String PATH_TO_STOP_AREA_MANY_PLATFORMS = "test/data/stop-area-many-platforms.osm"; 55 55 56 57 56 public static final String PATH_TO_SEGMENT_TEST = "test/data/segment-test.osm"; 57 public static final String PATH_TO_REPEAT_FIX = "test/data/repeat-fix.osm"; 58 58 59 59 /** -
applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/SegmentCheckerTest.java
r32784 r32871 13 13 14 14 public class SegmentCheckerTest extends AbstractTest { 15 15 16 16 @Test 17 public void test() { 18 19 17 public void testStopByStopTest() { 18 20 19 File file = new File(AbstractTest.PATH_TO_SEGMENT_TEST); 21 20 DataSet ds = ImportUtils.importOsmFile(file, "testLayer"); 22 21 PTAssistantValidatorTest test = new PTAssistantValidatorTest(); 23 22 24 23 Relation route = null; 25 26 for (Relation r : ds.getRelations()) {24 25 for (Relation r : ds.getRelations()) { 27 26 if (RouteUtils.isTwoDirectionRoute(r)) { 28 27 route = r; … … 30 29 } 31 30 } 32 31 32 SegmentChecker.reset(); 33 33 SegmentChecker segmentChecker = new SegmentChecker(route, test); 34 34 segmentChecker.performStopByStopTest(); 35 35 assertEquals(SegmentChecker.getCorrectSegmentCount(), 27); 36 36 assertEquals(segmentChecker.getErrors().size(), 0); 37 38 39 40 37 } 38 39 /** 40 * Tests the stop-by-stop test 41 */ 42 @Test 43 public void testRepeatLastFix() { 44 File file = new File(AbstractTest.PATH_TO_REPEAT_FIX); 45 DataSet ds = ImportUtils.importOsmFile(file, "testLayer"); 46 PTAssistantValidatorTest test = new PTAssistantValidatorTest(); 47 48 Relation route123 = null; 49 Relation route130 = null; 50 Relation route168 = null; 51 Relation route184 = null; 52 53 for (Relation r : ds.getRelations()) { 54 if (r.getId() == 5379737) { 55 route123 = r; 56 } else if (r.getId() == 5379738) { 57 route130 = r; 58 } else if (r.getId() == 5379739) { 59 route168 = r; 60 } else if (r.getId() == 5379740) { 61 route184 = r; 62 } 63 } 64 65 SegmentChecker.reset(); 66 SegmentChecker segmentChecker123 = new SegmentChecker(route123, test); 67 SegmentChecker segmentChecker130 = new SegmentChecker(route130, test); 68 SegmentChecker segmentChecker168 = new SegmentChecker(route168, test); 69 SegmentChecker segmentChecker184 = new SegmentChecker(route184, test); 70 segmentChecker123.performStopByStopTest(); 71 // TestError error123 = segmentChecker123.getErrors().get(0); 72 // PTRouteSegment wrongSegment123 = SegmentChecker.getWrongSegment(error123); 73 segmentChecker130.performStopByStopTest(); 74 segmentChecker168.performStopByStopTest(); 75 segmentChecker184.performStopByStopTest(); 76 77 // Check the error number: 78 assertEquals(segmentChecker123.getErrors().size(), 1); 79 assertEquals(segmentChecker130.getErrors().size(), 1); 80 assertEquals(segmentChecker168.getErrors().size(), 1); 81 assertEquals(segmentChecker184.getErrors().size(), 0); 41 82 } 42 83 }
Note:
See TracChangeset
for help on using the changeset viewer.