Changeset 35291 in osm for applications/editors/josm/plugins/comfort0/test/unit
- Timestamp:
- 2020-01-13T21:45:35+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/level0l/parsergen/Level0LParserTest.java
r35288 r35291 1 1 package net.simon04.comfort0.level0l.parsergen; 2 2 3 import static org.CustomMatchers.hasSize; 3 4 import static org.hamcrest.CoreMatchers.is; 4 5 import static org.junit.Assert.assertThat; 5 6 6 7 import java.io.StringReader; 8 import java.util.List; 7 9 8 10 import org.junit.Test; 9 11 import org.openstreetmap.josm.data.osm.NodeData; 10 12 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 13 import org.openstreetmap.josm.data.osm.PrimitiveData; 11 14 import org.openstreetmap.josm.data.osm.RelationData; 12 15 import org.openstreetmap.josm.data.osm.WayData; … … 73 76 assertThat(relation.getKeys().size(), is(6)); 74 77 } 78 79 @Test 80 public void testExampleFromDocs() throws Exception { 81 // https://wiki.openstreetmap.org/wiki/Level0L#Examples 82 final String level0l = "" + 83 "node 298884269: 54.0901746, 12.2482632 # made by user SvenHRO (46882) in changeset 676636 on 2008-09-21T21:37:45Z\n" + 84 "node 261728686: 54.0906309, 12.2441924 # versions should be stored server-side\n" + 85 "node 1831881213: 54.0900666, 12.2539381 # comments are not allowed in tag values, '=' is screened (\\=) only in keys\n" + 86 " name = Neu Broderstorf\n" + 87 " traffic_sign = city_limit\n" + 88 "\n" + 89 "node 298884272: 54.0901447, 12.2516513\n" + 90 "\n" + 91 "way 26659127\n" + 92 " nd 292403538\n" + 93 " nd 298884289\n" + 94 " nd 261728686\n" + 95 " highway = unclassified\n" + 96 " name = Pastower Straße\n" + 97 "\n" + 98 "relation 56688 # member types: nd, wy, rel; roles are put after ids\n" + 99 " nd 294942404\n" + 100 " nd 364933006\n" + 101 " wy 4579143 forward\n" + 102 " nd 249673494\n" + 103 " name = Küstenbus Linie 123\n" + 104 " network = VVW\n" + 105 " operator = Regionalverkehr Küste\n" + 106 " ref = 123\n" + 107 " route = bus\n" + 108 " type = route\n"; 109 final List<PrimitiveData> primitives = new Level0LParser(new StringReader(level0l)).primitives(); 110 assertThat(primitives, hasSize(6)); 111 assertThat(primitives.get(0).toString(), is("298884269 null V NODE LatLon[lat=54.0901746,lon=12.2482632]")); 112 assertThat(primitives.get(1).toString(), is("261728686 null V NODE LatLon[lat=54.0906309,lon=12.2441924]")); 113 assertThat(primitives.get(2).toString(), is("1831881213 [name, Neu Broderstorf, traffic_sign, city_limit] V NODE LatLon[lat=54.0900666,lon=12.2539381]")); 114 assertThat(primitives.get(3).toString(), is("298884272 null V NODE LatLon[lat=54.0901447,lon=12.2516513]")); 115 assertThat(primitives.get(4).toString(), is("26659127 [highway, unclassified, name, Pastower Straße] V WAY[292403538, 298884289, 261728686]")); 116 assertThat(primitives.get(5).toString(), is("56688 [name, Küstenbus Linie 123, network, VVW, operator, Regionalverkehr Küste, ref, 123, route, bus, type, route] V REL [node 294942404, node 364933006, way 4579143, node 249673494]")); 117 } 118 75 119 }
Note:
See TracChangeset
for help on using the changeset viewer.