Changeset 14083 in josm for trunk/test
- Timestamp:
- 2018-08-04T19:25:42+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
r14079 r14083 160 160 } 161 161 162 private static Date readDate(String nmeaLine) throws IOException, SAXException {162 private static GpxData read(String nmeaLine) throws IOException, SAXException { 163 163 NmeaReader in = new NmeaReader(new ByteArrayInputStream(nmeaLine.getBytes(StandardCharsets.UTF_8))); 164 164 in.parse(true); 165 return in.data.tracks.iterator().next().getSegments().iterator().next().getWayPoints().iterator().next().getTime(); 165 return in.data; 166 } 167 168 private static WayPoint readWayPoint(String nmeaLine) throws IOException, SAXException { 169 return read(nmeaLine).tracks.iterator().next().getSegments().iterator().next().getWayPoints().iterator().next(); 170 } 171 172 private static Date readDate(String nmeaLine) throws IOException, SAXException { 173 return readWayPoint(nmeaLine).getTime(); 174 } 175 176 private static double readSpeed(String nmeaLine) throws IOException, SAXException { 177 return Double.parseDouble(readWayPoint(nmeaLine).getString("speed")); 166 178 } 167 179 … … 179 191 readDate("$GNRMC,162859.4,A,4543.03388,N,00058.19870,W,45.252,209.07,300518,,,D,V*13"))); 180 192 } 193 194 /** 195 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/16554">Bug #16554</a>. 196 * @throws Exception if an error occurs 197 */ 198 @Test 199 public void testTicket16554() throws Exception { 200 assertEquals(63.2420959, readSpeed( 201 "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26"), 1e-7); 202 assertEquals(63.2430000, readSpeed( 203 "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26" 204 + "$GNVTG,289.80,T,,M,34.148,N,63.243,K,D*27"), 1e-7); 205 } 181 206 }
Note:
See TracChangeset
for help on using the changeset viewer.