1 # Testing conversion routines...
4 ok - txt_to_xml() with multiline string
6 ok - xml_to_txt("<&>")
7 ok - xml_to_txt() with multiline string
8 ok - postgresql_copy_safe() with empty string
9 ok - postgresql_copy_safe("abcæøåÆØÅ")
10 ok - postgresql_copy_safe("abc\t'\r\n")
11 ok - postgresql_copy_safe() with multiline, nulls and stuff
12 # Testing date routines...
13 ok - sec_to_string() without separator
14 ok - sec_to_string() with separator
15 ok - sec_to_string(-5000) — negative numbers unsupported atm
16 ok - sec_to_string("")
17 ok - sec_to_string() with invalid string
18 ok - sec_to_string() with a bunch of leading zeros
19 ok - sec_to_string() with decimals
20 ok - sec_to_string() with decimals and prefixing zeros
21 ok - sec_to_string() with decimals and extra trailing zeros
22 ok - sec_to_string() with missing zero before decimal point
23 ok - sec_to_readable(0)
24 ok - sec_to_readable() with invalid string
25 ok - sec_to_readable(86400)
26 ok - sec_to_readable(86400*1000)
27 ok - sec_to_readable(86400+7200+180+4)
28 ok - sec_to_readable("3.14")
29 ok - sec_to_readable() rejects negative numbers
30 ok - sec_to_readable() rejects negative decimal
31 ok - sec_to_readable(), missing zero before decimal point
32 ok - sec_to_readable() with empty string
33 # Testing geo routines...
34 ok - ddd_to_dms("12.34567")
36 ok - ddd_to_dms("0.00001") — Precision of DDD with five decimals
38 ok - ddd_to_dms("pH()rtY tW0")
39 ok - ddd_to_dms("-12.34567")
40 ok - ddd_to_dms("0.34567")
41 ok - ddd_to_dms(".34567")
42 ok - ddd_to_dms("-.34567")
43 ok - ddd_to_dms("-0.34567")
44 ok - ddd_to_dms("180")
45 ok - ddd_to_dms("-180")
47 ok - ddd_to_dms("2-3")
48 ok - dms_to_ddd() with no parameters
49 ok - dms_to_ddd(0, 0, 0)
50 ok - dms_to_ddd(12, 30, 45)
51 ok - dms_to_ddd() with invalid degrees
52 ok - dms_to_ddd() with invalid minutes
53 ok - dms_to_ddd() with invalid seconds
54 ok - dms_to_ddd() with empty degree string
55 ok - dms_to_ddd() with empty second string
56 ok - dms_to_ddd() doesn’t accept negative degrees atm
57 ok - dms_to_ddd() doesn’t accept negative minutes atm
58 ok - dms_to_ddd() doesn’t accept negative seconds atm
59 ok - dms_to_ddd(0, 0, 0.1) — Precision of DMS with one decimal
60 ok - dms_to_ddd(2, 30)
63 ok - dms_to_ddd(120.5, 0.3)
64 # Testing trackpoint()...
65 ok - trackpoint() receives empty hash
66 ok - trackpoint() (gpsml)
67 ok - trackpoint() (gpx)
68 ok - trackpoint(): {'format'} with invalid value ("2d") returns undef
69 ok - trackpoint(): {'lat'} with invalid value ("2d") returns undef
70 ok - trackpoint(): {'lon'} with invalid value ("2d") returns undef
71 ok - trackpoint(): {'type'} with invalid value ("2d") returns undef
72 ok - trackpoint(): {'year'} with empty value skips time
73 ok - trackpoint(): {'year'} with invalid value ("2d") skips time
74 ok - trackpoint(): Strip prefixing zeros from {'year'}
75 ok - trackpoint(): {'year'} is negative, skip time
76 ok - trackpoint(): Decimals in {'year'}, skip time
77 ok - trackpoint(): {'month'} with empty value skips time
78 ok - trackpoint(): {'month'} with invalid value ("2d") skips time
79 ok - trackpoint(): Strip prefixing zeros from {'month'}
80 ok - trackpoint(): {'month'} is negative, skip time
81 ok - trackpoint(): Decimals in {'month'}, skip time
82 ok - trackpoint(): {'day'} with empty value skips time
83 ok - trackpoint(): {'day'} with invalid value ("2d") skips time
84 ok - trackpoint(): Strip prefixing zeros from {'day'}
85 ok - trackpoint(): {'day'} is negative, skip time
86 ok - trackpoint(): Decimals in {'day'}, skip time
87 ok - trackpoint(): {'hour'} with empty value skips time
88 ok - trackpoint(): {'hour'} with invalid value ("2d") skips time
89 ok - trackpoint(): Strip prefixing zeros from {'hour'}
90 ok - trackpoint(): {'hour'} is negative, skip time
91 ok - trackpoint(): Decimals in {'hour'}, skip time
92 ok - trackpoint(): {'min'} with empty value skips time
93 ok - trackpoint(): {'min'} with invalid value ("2d") skips time
94 ok - trackpoint(): Strip prefixing zeros from {'min'}
95 ok - trackpoint(): {'min'} is negative, skip time
96 ok - trackpoint(): Decimals in {'min'}, skip time
97 ok - trackpoint(): {'sec'} with empty value skips time
98 ok - trackpoint(): {'sec'} with invalid value ("2d") skips time
99 ok - trackpoint(): Strip prefixing zeros from {'sec'}
100 ok - trackpoint(): {'sec'} is negative, skip time
101 ok - trackpoint(): Remove trailing zeros in {'sec'} decimals
102 ok - trackpoint(): Missing {'format'}, return undef
103 ok - trackpoint(): Missing {'type'}, return undef
104 ok - trackpoint(): Missing {'error'}, return undef
105 # Testing output from ../gpst
106 # Read empty input (/dev/null)...
107 ok - "../gpst </dev/null" - Read from /dev/null
108 ok - "../gpst </dev/null" - Read from /dev/null (stderr)
109 ok - "../gpst -o gpx </dev/null" - Output gpx from /dev/null
110 ok - "../gpst -o gpx </dev/null" - Output gpx from /dev/null (stderr)
111 # Read empty files...
112 ok - "echo '<tp> </tp>' | ../gpst" - Don’t print empty trackpoints
113 ok - "echo '<tp> </tp>' | ../gpst" - Don’t print empty trackpoints (stderr)
114 # Testing --chronology option...
115 ok - "../gpst --chronology chronology-error.gpsml" - Check for chronology errors and duplicated times
116 ok - "../gpst --chronology chronology-error.gpsml" - Check for chronology errors and duplicated times (stderr)
117 # Testing --skip-dups option...
118 ok - "../gpst -d no_signal.mayko" - Remove duplicated positions from gpsml
119 ok - "../gpst -d no_signal.mayko" - Remove duplicated positions from gpsml (stderr)
120 ok - "../gpst -d -o csv no_signal.mayko" - Remove duplicated positions from csv output format
121 ok - "../gpst -d -o csv no_signal.mayko" - Remove duplicated positions from csv output format (stderr)
122 ok - "../gpst -d -o clean no_signal.mayko" - Remove duplicated positions from clean output format
123 ok - "../gpst -d -o clean no_signal.mayko" - Remove duplicated positions from clean output format (stderr)
124 ok - "../gpst -d -o pgtab no_signal.mayko" - Remove duplicated positions from pgtab output format
125 ok - "../gpst -d -o pgtab no_signal.mayko" - Remove duplicated positions from pgtab output format (stderr)
126 # Testing --epoch option...
127 ok - "../gpst -e pause.gpx" - --epoch is ignored in gpsml output
128 ok - "../gpst -e pause.gpx" - --epoch is ignored in gpsml output (stderr)
129 ok - "../gpst -e -o gpx pause.gpx" - --epoch is ignored in gpx output
130 ok - "../gpst -e -o gpx pause.gpx" - --epoch is ignored in gpx output (stderr)
131 # Testing --fix option...
132 ok - "../gpst --fix --chronology chronology-error.gpsml" - Remove bad timestamps
133 ok - "../gpst --fix --chronology chronology-error.gpsml" - Remove bad timestamps (stderr)
134 # Testing --from-date option...
135 # Testing --help option...
136 ok - Check -h (--help) option
137 # Testing --inside option...
138 ok - "../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx" - Check --inside option (gpx to gpst)
139 ok - "../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx" - Check --inside option (gpx to gpst) (stderr)
140 # Testing --undefined option...
141 # Testing --near option...
142 # Testing --output option...
143 ok - "../gpst log.mcsv" - Read Mapsource TAB-separated format
144 ok - "../gpst log.mcsv" - Read Mapsource TAB-separated format (stderr)
145 ok - "../gpst two-digit_year.mcsv" - Read Mapsource TAB-separated format with two-digit year
146 ok - "../gpst two-digit_year.mcsv" - Read Mapsource TAB-separated format with two-digit year (stderr)
147 ok - "../gpst log.gpstxt" - Read Garmin serial text format
148 ok - "../gpst log.gpstxt" - Read Garmin serial text format (stderr)
149 ok - "../gpst log.dos.mayko" - Read DOS-formatted Mayko format
150 ok - "../gpst log.dos.mayko" - Read DOS-formatted Mayko format (stderr)
151 ok - "../gpst log.dos.gpstxt" - Read DOS-formatted Garmin serial text format
152 ok - "../gpst log.dos.gpstxt" - Read DOS-formatted Garmin serial text format (stderr)
153 ok - "../gpst log.unix.mcsv" - Read UNIX-formatted Garmin Mapsource TAB-separated format
154 ok - "../gpst log.unix.mcsv" - Read UNIX-formatted Garmin Mapsource TAB-separated format (stderr)
155 ok - "../gpst multitrack.gpx" - Read GPX file with multiple tracks
156 ok - "../gpst multitrack.gpx" - Read GPX file with multiple tracks (stderr)
157 ok - "../gpst compact.gpx" - Read GPX one-liner
158 ok - "../gpst compact.gpx" - Read GPX one-liner (stderr)
159 ok - "../gpst missing.gpsml" - Read gpsml with various data missing
160 ok - "../gpst missing.gpsml" - Read gpsml with various data missing (stderr)
161 ok - "../gpst different_dateformats.gpsml" - Read different date formats from gpsml file
162 ok - "../gpst different_dateformats.gpsml" - Read different date formats from gpsml file (stderr)
163 ok - "../gpst multitrack-pause.gpx" - Should be equal to multitrack-pause.gpsml
164 ok - "../gpst multitrack-pause.gpx" - Should be equal to multitrack-pause.gpsml (stderr)
165 ok - "../gpst -o gpx no_signal.mayko" - Output GPX from Mayko file with duplicates
166 ok - "../gpst -o gpx no_signal.mayko" - Output GPX from Mayko file with duplicates (stderr)
167 ok - "../gpst -o gpx comments.mayko" - Output GPX from Mayko file with commented-out lines
168 ok - "../gpst -o gpx comments.mayko" - Output GPX from Mayko file with commented-out lines (stderr)
169 ok - "../gpst -o gpx missing.gpsml" - Output GPX from gpsml with missing data
170 ok - "../gpst -o gpx missing.gpsml" - Output GPX from gpsml with missing data (stderr)
171 ok - "../gpst -o xgraph multitrack.gpx" - Output xgraph format from GPX
172 ok - "../gpst -o xgraph multitrack.gpx" - Output xgraph format from GPX (stderr)
173 ok - "../gpst -o pgtab compact.gpx" - Output pgtab from gpx format
174 ok - "../gpst -o pgtab compact.gpx" - Output pgtab from gpx format (stderr)
175 ok - "../gpst -o pgtab no_signal.mayko" - Output pgtab from mayko format
176 ok - "../gpst -o pgtab no_signal.mayko" - Output pgtab from mayko format (stderr)
177 ok - "../gpst -o pgtab missing.gpsml" - Output pgtab from missing.gpsml
178 ok - "../gpst -o pgtab missing.gpsml" - Output pgtab from missing.gpsml (stderr)
179 ok - "../gpst -o csv log.dos.mayko" - Output csv from DOS-formatted Mayko format
180 ok - "../gpst -o csv log.dos.mayko" - Output csv from DOS-formatted Mayko format (stderr)
181 ok - "../gpst -o pgwtab multitrack.gpx" - Test pgwtab format
182 ok - "../gpst -o pgwtab multitrack.gpx" - Test pgwtab format (stderr)
183 ok - "../gpst -o pgwupd multitrack.gpx" - Test pgwupd format
184 ok - "../gpst -o pgwupd multitrack.gpx" - Test pgwupd format (stderr)
185 ok - "../gpst -t -o clean pause.gpx" - Output clean format with time breaks
186 ok - "../gpst -t -o clean pause.gpx" - Output clean format with time breaks (stderr)
187 # Testing --outside option...
188 ok - "../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx" - Check --outside option (gpx to gpst)
189 ok - "../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx" - Check --outside option (gpx to gpst) (stderr)
190 # Testing --pos1 and --pos2 options...
191 # Testing --require option...
192 ok - "../gpst -re multitrack.gpx" - Require elevation from GPX data
193 ok - "../gpst -re multitrack.gpx" - Require elevation from GPX data (stderr)
194 ok - "../gpst tracks.gpsman" - Output gpsml format from gpsman
195 ok - "../gpst tracks.gpsman" - Output gpsml format from gpsman (stderr)
196 not ok - "../gpst -o gpx -R lat=7,lon=7,ele=2 tracks.gpsman" - Output GPX format from gpsman
197 # Failed test '"../gpst -o gpx -R lat=7,lon=7,ele=2 tracks.gpsman" - Output GPX format from gpsman'
198 # in ./run-tests.pl at line 2023.
199 # got: '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
202 # creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
203 # xmlns="http://www.topografix.com/GPX/1/1"
204 # xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
205 # xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
209 # <trkpt lat="60.2891111" lon="5.2276111"> <ele>54.45</ele> <time>2003-12-01T04:21:09Z</time> </trkpt>
210 # <trkpt lat="60.2885833" lon="5.2261667"> <ele>54.45</ele> <time>2003-12-01T04:21:26Z</time> </trkpt>
213 # <trkpt lat="52.1221667" lon="14.0295278"> <ele>1494.99</ele> <time>2003-12-01T09:27:21Z</time> </trkpt>
216 # <trkpt lat="52.0858889" lon="14.0401389"> <ele>1494.99</ele> <time>2003-12-01T09:27:42Z</time> </trkpt>
217 # <trkpt lat="52.0842778" lon="14.0406667"> <ele>1494.03</ele> <time>2003-12-01T09:27:43Z</time> </trkpt>
220 # <trkpt lat="50.0858333" lon="14.4290833"> <ele>183.27</ele> <time>2003-12-01T21:26:07Z</time> </trkpt>
221 # <trkpt lat="50.0859722" lon="14.4291111"> <ele>184.71</ele> <time>2003-12-01T21:26:31Z</time> </trkpt>
224 # <trkpt lat="50.092" lon="14.43625"> <ele>180.38</ele> <time>2003-12-01T21:47:30Z</time> </trkpt>
225 # <trkpt lat="50.092" lon="14.43625"> <ele>181.35</ele> <time>2003-12-01T21:47:47Z</time> </trkpt>
226 # <trkpt lat="50.092" lon="14.4362222"> <ele>182.31</ele> <time>2003-12-01T21:47:53Z</time> </trkpt>
231 # expected: '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
234 # creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
235 # xmlns="http://www.topografix.com/GPX/1/1"
236 # xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
237 # xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
240 # <title>ACTIVE LOG</title>
242 # <trkpt lat="60.2891111" lon="5.2276111"> <ele>54.45</ele> <time>2003-12-01T04:21:09Z</time> </trkpt>
243 # <trkpt lat="60.2885833" lon="5.2261667"> <ele>54.45</ele> <time>2003-12-01T04:21:26Z</time> </trkpt>
246 # <trkpt lat="52.1221667" lon="14.0295278"> <ele>1494.99</ele> <time>2003-12-01T09:27:21Z</time> </trkpt>
249 # <trkpt lat="52.0858889" lon="14.0401389"> <ele>1494.99</ele> <time>2003-12-01T09:27:42Z</time> </trkpt>
250 # <trkpt lat="52.0842778" lon="14.0406667"> <ele>1494.03</ele> <time>2003-12-01T09:27:43Z</time> </trkpt>
253 # <trkpt lat="50.0858333" lon="14.4290833"> <ele>183.27</ele> <time>2003-12-01T21:26:07Z</time> </trkpt>
254 # <trkpt lat="50.0859722" lon="14.4291111"> <ele>184.71</ele> <time>2003-12-01T21:26:31Z</time> </trkpt>
257 # <trkpt lat="50.092" lon="14.43625"> <ele>180.38</ele> <time>2003-12-01T21:47:30Z</time> </trkpt>
258 # <trkpt lat="50.092" lon="14.43625"> <ele>181.35</ele> <time>2003-12-01T21:47:47Z</time> </trkpt>
259 # <trkpt lat="50.092" lon="14.4362222"> <ele>182.31</ele> <time>2003-12-01T21:47:53Z</time> </trkpt>
264 ok - "../gpst -o gpx -R lat=7,lon=7,ele=2 tracks.gpsman" - Output GPX format from gpsman (stderr)
265 ok - "../gpst -re one_ele.dos.gpsml" - Require elevation from gpsml
266 ok - "../gpst -re one_ele.dos.gpsml" - Require elevation from gpsml (stderr)
267 ok - "../gpst -re missing.gpsml" - Require elevation # TODO Shall lat/lon be cleared if one is missing?
268 ok - "../gpst -re missing.gpsml" - Require elevation (stderr) # TODO Shall lat/lon be cleared if one is missing?
269 ok - "../gpst -rt missing.gpsml" - Require time # TODO Shall lat/lon be cleared if one is missing?
270 ok - "../gpst -rt missing.gpsml" - Require time (stderr) # TODO Shall lat/lon be cleared if one is missing?
271 ok - "../gpst -rp missing.gpsml" - Require position # TODO Shall lat/lon be cleared if one is missing?
272 ok - "../gpst -rp missing.gpsml" - Require position (stderr) # TODO Shall lat/lon be cleared if one is missing?
273 ok - "../gpst -ret missing.gpsml" - Require elevation and time # TODO Shall lat/lon be cleared if one is missing?
274 ok - "../gpst -ret missing.gpsml" - Require elevation and time (stderr) # TODO Shall lat/lon be cleared if one is missing?
275 ok - "../gpst -retp missing.gpsml" - Require elevation, time and position # TODO Shall lat/lon be cleared if one is missing?
276 ok - "../gpst -retp missing.gpsml" - Require elevation, time and position (stderr) # TODO Shall lat/lon be cleared if one is missing?
277 ok - "../gpst -rep missing.gpsml" - Require elevation and position # TODO Shall lat/lon be cleared if one is missing?
278 ok - "../gpst -rep missing.gpsml" - Require elevation and position (stderr) # TODO Shall lat/lon be cleared if one is missing?
279 # Testing --round option...
280 ok - "../gpst -R lat=4,lon=5,ele=1 pause.gpx" - --round works with lat, lon, ele from gpx
281 ok - "../gpst -R lat=4,lon=5,ele=1 pause.gpx" - --round works with lat, lon, ele from gpx (stderr)
282 # Testing --short-date option...
283 # Testing --save-to-file option...
284 # Testing --create-breaks option...
285 ok - "../gpst -t pause.gpx" - Output gpsml with <pause> elements from GPX files
286 ok - "../gpst -t pause.gpx" - Output gpsml with <pause> elements from GPX files (stderr)
287 ok - "../gpst -t multitrack-pause.gpx" - Insert <pause> between gpx tracks
288 ok - "../gpst -t multitrack-pause.gpx" - Insert <pause> between gpx tracks (stderr)
289 ok - "../gpst -t multitrack-pause.gpsml" - Insert <pause> between gpsml titles
290 ok - "../gpst -t multitrack-pause.gpsml" - Insert <pause> between gpsml titles (stderr)
291 # Testing --comment-out-dups option...
292 ok - "../gpst -u no_signal.mayko >nosignal.tmp" - Redirect stdout
293 ok - "../gpst -u no_signal.mayko >nosignal.tmp" - Redirect stdout (stderr)
294 ok - "../gpst nosignal.tmp" - Read output from 'gpst -u *.mayko'
295 ok - "../gpst nosignal.tmp" - Read output from 'gpst -u *.mayko' (stderr)
296 ok - "../gpst -u no_signal.mayko" - Read Mayko format with no signal, output old Mayko format
297 ok - "../gpst -u no_signal.mayko" - Read Mayko format with no signal, output old Mayko format (stderr)
298 # Testing --verbose option...
299 # Testing --version option...
300 ok - "../gpst --version" - The --version option outputs Id strings
301 # Testing --strip-whitespace option...
302 ok - "../gpst -w -o gpx pause.gpx" - Strip whitespace from GPX output
303 ok - "../gpst -w -o gpx pause.gpx" - Strip whitespace from GPX output (stderr)
304 ok - "../gpst -o gpx -w comments.mayko" - Output whitespace-stripped GPX from Mayko file with commented-out lines
305 ok - "../gpst -o gpx -w comments.mayko" - Output whitespace-stripped GPX from Mayko file with commented-out lines (stderr)
306 # Testing --double-y-scale option...
307 ok - "../gpst -y -o clean pause.gpx" - Double y scale, clean output from gpx format
308 ok - "../gpst -y -o clean pause.gpx" - Double y scale, clean output from gpx format (stderr)
309 ok - "../gpst -y -o clean log.dos.mayko" - Double y scale, clean output from mayko format
310 ok - "../gpst -y -o clean log.dos.mayko" - Double y scale, clean output from mayko format (stderr)
311 # Testing --debug option...
312 # Strip error from Mayko format...
313 ok - "../gpst -o csv date_error.mayko" - Strip error from mayko format in csv output
314 ok - "../gpst -o csv date_error.mayko" - Strip error from mayko format in csv output (stderr)
315 ok - "../gpst -o clean date_error.mayko" - Strip error from mayko format in clean output
316 ok - "../gpst -o clean date_error.mayko" - Strip error from mayko format in clean output (stderr)
317 ok - "../gpst -o gpsml date_error.mayko" - Strip error from mayko format in gpsml output
318 ok - "../gpst -o gpsml date_error.mayko" - Strip error from mayko format in gpsml output (stderr)
319 ok - "../gpst -o gpx date_error.mayko" - Strip error from mayko format in gpx output
320 ok - "../gpst -o gpx date_error.mayko" - Strip error from mayko format in gpx output (stderr)
321 ok - "../gpst -o gpstrans date_error.mayko" - Strip error from mayko format in gpstrans output
322 ok - "../gpst -o gpstrans date_error.mayko" - Strip error from mayko format in gpstrans output (stderr)
323 ok - "../gpst -o pgtab date_error.mayko" - Strip error from mayko format in pgtab output
324 ok - "../gpst -o pgtab date_error.mayko" - Strip error from mayko format in pgtab output (stderr)
325 ok - "../gpst -o poscount date_error.mayko" - Strip error from mayko format in poscount output
326 ok - "../gpst -o poscount date_error.mayko" - Strip error from mayko format in poscount output (stderr)
327 ok - "../gpst -o xgraph date_error.mayko" - Strip error from mayko format in xgraph output
328 ok - "../gpst -o xgraph date_error.mayko" - Strip error from mayko format in xgraph output (stderr)
329 ok - "../gpst -o ygraph date_error.mayko" - Strip error from mayko format in ygraph output
330 ok - "../gpst -o ygraph date_error.mayko" - Strip error from mayko format in ygraph output (stderr)
333 # Looks like you failed 1 test of 232.