3 #=======================================================================
5 # File ID: b9e66fa2-f924-11dd-b57f-0001805bf4b1
6 # Test suite for gpst(1).
9 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 3 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
18 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
19 use Test
::More
qw{no_plan
};
46 $progname =~ s/^.*\/(.*?)$/$1/;
47 our $VERSION = "0.00";
49 Getopt
::Long
::Configure
("bundling");
52 "all|a" => \
$Opt{'all'},
53 "debug" => \
$Opt{'debug'},
54 "help|h" => \
$Opt{'help'},
55 "todo|t" => \
$Opt{'todo'},
56 "verbose|v+" => \
$Opt{'verbose'},
57 "version" => \
$Opt{'version'},
59 ) || die("$progname: Option error. Use -h for help.\n");
62 'gpsbabel' => 'gpsbabel',
65 $Opt{'debug'} && ($Debug = 1);
66 $Opt{'help'} && usage
(0);
67 if ($Opt{'version'}) {
72 diag
(sprintf("========== Executing %s v%s ==========",
76 chomp(my $gpx_header = <<END);
77 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
80 creator="gpst - http://sunny256.github.com/gpstools/"
81 xmlns="http://www.topografix.com/GPX/1/1"
82 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
83 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
86 my $stripped_gpx_header = $gpx_header;
87 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
89 if ($Opt{'todo'} && !$Opt{'all'}) {
95 testcmd("$CMD command", # {{{
108 diag
("Testing conversion routines...");
110 # txt_to_xml() and xml_to_txt() {{{
112 is
(txt_to_xml
("abc"),
114 "txt_to_xml(\"abc\")");
115 is
(txt_to_xml
("<&>"),
117 "txt_to_xml(\"<&>\")");
118 is
(txt_to_xml
("first line\nsecond <\rthird\r\n<&>"),
119 "first line\nsecond <\rthird\r\n<&>",
120 "txt_to_xml() with multiline string");
122 is
(xml_to_txt
("abc"),
124 "xml_to_txt(\"abc\")");
125 is
(xml_to_txt
("<&>"),
127 "xml_to_txt(\"<&>\")");
128 is
(xml_to_txt
("first line\nsecond <\rthird\r\n<&>"),
129 "first line\nsecond <\rthird\r\n<&>",
130 "xml_to_txt() with multiline string");
132 # txt_to_xml() and xml_to_txt() }}}
133 # postgresql_copy_safe() {{{
135 is
(postgresql_copy_safe
(""),
137 "postgresql_copy_safe() with empty string");
139 is
(postgresql_copy_safe
("abcæøåÆØÅ"),
141 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
143 is
(postgresql_copy_safe
("abc\t'\r\n"),
145 "postgresql_copy_safe(\"abc\\t'\\r\\n\")");
147 is
(postgresql_copy_safe
("¤%/&gurgle\t325\\wer\ndfv'\r!\"#\n%\twe\r\x00sdf\xFFsadc\n\t\x00sdc\n"),
148 "¤%/&gurgle\\t325\\\\wer\\ndfv'\\r!\"#\\n%\\twe\\r\x00sdf\xFFsadc\\n\\t\x00sdc\\n",
149 "postgresql_copy_safe() with multiline, nulls and stuff");
151 # postgresql_copy_safe() }}}
156 "num_expand(\"\") returns empty string");
158 is
(num_expand
("6.5"),
160 "num_expand(\"6.5\") returns same value");
161 is
(num_expand
("-6.5"),
163 "num_expand(\"-6.5\") returns same value");
164 is
(num_expand
("+6.5"),
166 "num_expand(\"+6.5\") removes leading plus sign");
168 is
(num_expand
("0.0000000000123"),
170 "num_expand(\"0.0000000000123\") returns same value");
171 is
(num_expand
("-0.0000000000123"),
173 "num_expand(\"-0.0000000000123\") returns same value");
174 is
(num_expand
("+0.0000000000123"),
176 "num_expand(\"+0.0000000000123\") removes leading plus sign");
178 is
(num_expand
("1e-06"),
180 "num_expand(\"1e-06\") returns 0.000001");
181 is
(num_expand
("-1e-06"),
183 "num_expand(\"-1e-06\") returns -0.000001");
184 is
(num_expand
("+1e-06"),
186 "num_expand(\"+1e-06\") removes leading plus sign");
188 is
(num_expand
("1e-6"),
190 "num_expand(\"1e-6\") returns 0.000001");
191 is
(num_expand
("1e+6"),
193 "num_expand(\"1e+6\") returns 1000000");
195 is
(num_expand
("3.14159265358979e-10"),
196 "0.000000000314159265358979",
197 "num_expand(\"3.14159265358979e-10\") returns 0.000000000314159265358979");
199 is
(num_expand
("1.2000e-10"),
201 "Strip trailing zeroes from num_expand(\"1.2000e-10\")");
202 is
(num_expand
("1.2000e+10"),
204 "num_expand(\"1.2000e+10\") returns 12000000000");
206 is
(num_expand
("0000000000000"),
208 "num_expand(\"0000000000000\") returns 0");
209 is
(num_expand
("-0000000000000"),
211 "num_expand(\"-0000000000000\") returns 0");
212 is
(num_expand
("+0000000000000"),
214 "num_expand(\"+0000000000000\") returns 0");
216 is
(num_expand
("000000.0000000"),
218 "num_expand(\"000000.0000000\") returns 0");
219 is
(num_expand
("-000000.0000000"),
221 "num_expand(\"-000000.0000000\") returns 0");
222 is
(num_expand
("+000000.0000000"),
224 "num_expand(\"+000000.0000000\") returns 0");
226 is
(num_expand
("1e+20"),
227 "100000000000000000000",
228 "num_expand(\"1e+20\") returns 100000000000000000000");
230 is
(num_expand
("3.14159e+10"),
232 "num_expand(\"314159e+10\") returns 31415900000");
234 is
(num_expand
("2.50000"),
236 "num_expand(\"2.50000\") removes trailing zeroes");
238 is
(num_expand
("0002.5"),
240 "num_expand(\"0002.5\") removes leading zeroes");
241 is
(num_expand
("-0002.5"),
243 "num_expand(\"-0002.5\") removes leading zeroes");
244 is
(num_expand
("+0002.5"),
246 "num_expand(\"+0002.5\") removes leading zeroes and leading plus sign");
248 is
(num_expand
("0002.50000"),
250 "num_expand(\"0002.50000\") removes both leading and trailing zeroes");
252 is
(num_expand
("300"),
254 "Don’t remove trailing zeroes from integers");
256 is
(num_expand
("0004"),
258 "num_expand(\"0004\") removes leading zeroes from integer");
259 is
(num_expand
("-0004"),
261 "num_expand(\"-0004\") removes leading zeroes from negative integer");
262 is
(num_expand
("+0004"),
264 "num_expand(\"+0004\") removes leading plus sign and zeroes from integer");
268 diag
("Testing date routines...");
270 # sec_to_string() {{{
272 is
(sec_to_string
(1148220825),
273 "2006-05-21 14:13:45",
274 "sec_to_string() without separator");
275 is
(sec_to_string
(1148220825, "T"),
276 "2006-05-21T14:13:45",
277 "sec_to_string() with separator");
278 is
(sec_to_string
(-5000),
280 "sec_to_string(-5000) — negative numbers unsupported atm");
281 is
(sec_to_string
(""),
283 "sec_to_string(\"\")");
284 is
(sec_to_string
("pH()rtY tW0"),
286 "sec_to_string() with invalid string");
287 is
(sec_to_string
("00000000000000000000001148220825"),
288 "2006-05-21 14:13:45",
289 "sec_to_string() with a bunch of leading zeros");
290 is
(sec_to_string
("1148220825.93"),
291 "2006-05-21 14:13:45.93",
292 "sec_to_string() with decimals");
293 is
(sec_to_string
("000000000000000000000000000001148220825.7312"),
294 "2006-05-21 14:13:45.7312",
295 "sec_to_string() with decimals and prefixing zeros");
296 is
(sec_to_string
("1148220825.93000"),
297 "2006-05-21 14:13:45.93",
298 "sec_to_string() with decimals and extra trailing zeros");
299 is
(sec_to_string
(".863"),
300 "1970-01-01 00:00:00.863",
301 "sec_to_string() with missing zero before decimal point");
303 # sec_to_string() }}}
304 # sec_to_readable() {{{
306 is
(sec_to_readable
(0),
308 "sec_to_readable(0)");
309 is
(sec_to_readable
("pH()rtY tW0"),
311 "sec_to_readable() with invalid string");
312 is
(sec_to_readable
(86400),
314 "sec_to_readable(86400)");
315 is
(sec_to_readable
(86400*1000),
317 "sec_to_readable(86400*1000)");
318 is
(sec_to_readable
(86400+7200+180+4),
320 "sec_to_readable(86400+7200+180+4)");
321 is
(sec_to_readable
("3.14"),
323 "sec_to_readable(\"3.14\")");
324 is
(sec_to_readable
("-124"),
326 "sec_to_readable() rejects negative numbers");
327 is
(sec_to_readable
("-2.34"),
329 "sec_to_readable() rejects negative decimal");
330 is
(sec_to_readable
(".87"),
332 "sec_to_readable(), missing zero before decimal point");
333 is
(sec_to_readable
(""),
335 "sec_to_readable() with empty string");
337 # sec_to_readable() }}}
339 diag
("Testing geo routines...");
343 is
(ddd_to_dms
("12.34567"),
345 "ddd_to_dms(\"12.34567\")");
349 "ddd_to_dms(\"0\")");
355 is
(ddd_to_dms
("pH()rtY tW0"),
357 "ddd_to_dms(\"pH()rtY tW0\")");
359 is
(ddd_to_dms
("-12.34567"),
361 "ddd_to_dms(\"-12.34567\")");
363 is
(ddd_to_dms
("0.34567"),
365 "ddd_to_dms(\"0.34567\")");
367 is
(ddd_to_dms
(".34567"),
369 "ddd_to_dms(\".34567\")");
371 is
(ddd_to_dms
("-.34567"),
373 "ddd_to_dms(\"-.34567\")");
375 is
(ddd_to_dms
("-0.34567"),
377 "ddd_to_dms(\"-0.34567\")");
379 is
(ddd_to_dms
("180"),
381 "ddd_to_dms(\"180\")");
383 is
(ddd_to_dms
("-180"),
385 "ddd_to_dms(\"-180\")");
389 "ddd_to_dms(\"-1\")");
391 is
(ddd_to_dms
("2-3"),
393 "ddd_to_dms(\"2-3\")");
396 diag
("Testing trackpoint()..."); # {{{
402 "trackpoint() receives empty hash");
421 # trackpoint() (gpsml) {{{
425 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
426 "trackpoint() (gpsml)"
429 # trackpoint() (gpsml) }}}
430 # trackpoint() (gpx) {{{
432 $Dat{'format'} = "gpx";
435 qq{ <trkpt lat
="59.5214" lon
="7.392133"> <ele
>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt
>\n},
439 # trackpoint() (gpx) }}}
441 # trackpoint(): Various loop tests {{{
443 for my $Elem (qw{format lat lon what
}) {
446 $Dat{"$Elem"} = '2d';
449 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
454 for my $Elem (qw{year month day hour min sec
}) {
461 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
462 "trackpoint(): {'$Elem'} with empty value skips time"
466 $Dat{"$Elem"} = '2d';
468 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
469 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") skips time"
473 $Dat{$Elem} = "00000$Dat{$Elem}";
475 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
476 "trackpoint(): Strip prefixing zeros from {'$Elem'}"
480 $Dat{"$Elem"} = 0-$Dat{$Elem};
482 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
483 "trackpoint(): {'$Elem'} is negative, skip time"
486 if ($Elem ne "sec") {
488 $Dat{"$Elem"} = "$Dat{$Elem}.00";
490 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
491 "trackpoint(): Decimals in {'$Elem'}, skip time"
499 $Dat{'sec'} = "$Dat{'sec'}.00";
501 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
502 "trackpoint(): Remove trailing zeros in {'sec'} decimals"
505 for my $Elem (qw{format what error
}) {
510 "trackpoint(): Missing {'$Elem'}, return undef"
514 # Various loop tests }}}
518 diag
("Testing output from ../gpst");
520 diag
("Read empty input (/dev/null)..."); # {{{
521 testcmd
("../gpst </dev/null", # {{{
523 <?xml version="1.0" encoding="UTF-8"?>
530 "Read from /dev/null",
535 testcmd
("../gpst -o gpx </dev/null", # {{{
545 "Output gpx from /dev/null",
551 diag
("Read empty files..."); # {{{
552 testcmd
("echo '<tp> </tp>' | ../gpst", # {{{
554 <?xml version="1.0" encoding="UTF-8"?>
561 "Don’t print empty trackpoints",
566 # Read empty files }}}
567 diag
("Testing --chronology option..."); # {{{
568 testcmd
("../gpst --chronology chronology-error.gpsml", # {{{
570 <?xml version="1.0" encoding="UTF-8"?>
573 <title>Chronology errors</title>
574 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
575 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
576 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
578 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
580 <pause>0:00:37:54</pause>
581 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
582 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
583 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
584 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
585 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
586 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
590 "gpst: chronology-error.gpsml: \"2006-05-02T09:46:46Z\": Next date is 0:00:06:39 in the past (2006-05-02T09:40:07Z)\n" .
591 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
592 "Check for chronology errors and duplicated times",
597 # --chronology option }}}
598 diag
("Testing --skip-dups option..."); # {{{
599 testcmd
("../gpst -d no_signal.mayko", # {{{
601 <?xml version="1.0" encoding="UTF-8"?>
604 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
605 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
606 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
607 <etp err="dup"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
608 <etp err="dup"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
609 <etp err="dup"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
610 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
611 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
612 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
617 "Remove duplicated positions from gpsml",
622 testcmd
("../gpst -d -o csv no_signal.mayko", # {{{
624 2002-12-22T21:42:24Z\t23.6746151\t70.6800486\t\t
625 2002-12-22T21:42:32Z\t23.6740038\t70.6799322\t\t
626 2002-12-22T21:42:54Z\t23.6723991\t70.6796266\t\t
627 2002-12-22T21:44:45Z\t23.6757566\t70.6800774\t\t
628 2002-12-22T21:44:52Z\t23.6753442\t70.6801502\t\t
629 2002-12-22T21:45:04Z\t23.6757542\t70.6801905\t\t
632 "Remove duplicated positions from csv output format",
637 testcmd
("../gpst -d -o clean no_signal.mayko", # {{{
639 23.6746151\t70.6800486\t
640 23.6740038\t70.6799322\t
641 23.6723991\t70.6796266\t
642 23.6757566\t70.6800774\t
643 23.6753442\t70.6801502\t
644 23.6757542\t70.6801905\t
647 "Remove duplicated positions from clean output format",
652 testcmd
("../gpst -d -o pgtab no_signal.mayko", # {{{
654 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
655 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
656 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
657 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
658 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
659 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
662 "Remove duplicated positions from pgtab output format",
667 # --skip-dups option }}}
668 diag
("Testing --epoch option..."); # {{{
669 testcmd
("../gpst -e pause.gpx", # {{{
671 <?xml version="1.0" encoding="UTF-8"?>
674 <title>ACTIVE LOG164705</title>
675 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
676 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
677 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
678 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
679 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
680 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
681 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
682 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
683 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
688 "--epoch is ignored in gpsml output",
693 testcmd
("../gpst -e -o gpx pause-noname.gpx", # {{{
698 <trkpt lat="60.425494" lon="5.299534"> <ele>25.26</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
699 <trkpt lat="60.425464" lon="5.29961"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
700 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
701 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
702 <trkpt lat="60.425339" lon="5.299958"> <ele>30.98</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
703 <trkpt lat="60.425238" lon="5.29964"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
704 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
705 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
706 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
712 "--epoch is ignored in gpx output",
717 testcmd
("../gpst -e -o csv multitrack.gpx", # {{{
718 # FIXME: Get rid of the empty line in the beginning
721 1045006539\t-0.1448824\t51.4968266\t\t
722 1045006549\t-0.1449938\t51.4968227\t\t
723 1045006574\t-0.1453202\t51.496904\t\t
725 1045006576\t-0.1453398\t51.4969214\t\t
726 1045006591\t-0.1455514\t51.4969816\t\t
727 1045006603\t-0.1457489\t51.4970224\t1000\t
728 1045006610\t-0.1457804\t51.4970452\t\t
730 1045006625\t-0.1458608\t51.497068\t\t
731 1045006642\t-0.1460047\t51.4971658\t\t
732 1045006656\t-0.1461614\t51.4972469\t\t
734 1045006663\t-0.1462394\t51.4972731\t\t
735 1045006684\t-0.1463232\t51.4973437\t\t
736 1045006708\t-0.1462949\t51.4973337\t\t
737 1045006714\t-0.1462825\t51.4973218\t\t
738 1045006715\t-0.1462732\t51.4973145\t\t
741 "Use --epoch with csv output",
747 diag
("Testing --fix option..."); # {{{
748 testcmd
("../gpst --fix --chronology chronology-error.gpsml", # {{{
750 <?xml version="1.0" encoding="UTF-8"?>
753 <title>Chronology errors</title>
754 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
755 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
756 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
758 <etp err="chrono"> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </etp>
760 <pause>0:00:37:54</pause>
761 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
762 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
763 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
764 <etp err="duptime"> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </etp>
765 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
766 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
770 "gpst: chronology-error.gpsml: \"2006-05-02T09:46:46Z\": Next date is 0:00:06:39 in the past (2006-05-02T09:40:07Z)\n" .
771 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
772 "Remove bad timestamps",
778 diag
("Testing --from-date option..."); # {{{
779 # --from-date option }}}
780 diag
("Testing -h (--help) option..."); # {{{
781 likecmd
("$CMD -h", # {{{
782 '/ Show this help\./',
784 "Option -h prints help screen",
789 diag
("Testing --inside option..."); # {{{
790 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx", # {{{
792 <?xml version="1.0" encoding="UTF-8"?>
795 <title>track1</title>
797 <title>track2</title>
798 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
799 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
800 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
801 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
803 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
805 <title>track3</title>
806 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
807 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
808 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
813 "Check --inside option (gpx to gpst)",
818 # --inside option }}}
819 diag
("Testing --undefined option..."); # {{{
820 # --undefined option }}}
821 diag
("Testing --output option..."); # {{{
823 testcmd
("../gpst log.mcsv", # {{{
825 <?xml version="1.0" encoding="UTF-8"?>
829 <title>ACTIVE LOG 125</title>
830 <tp> <time>2006-03-04T11:12:30Z</time> <lat>54.96883</lat> <lon>-1.62439</lon> <ele>77</ele> </tp>
831 <tp> <time>2006-03-04T11:12:47Z</time> <lat>54.96878</lat> <lon>-1.62413</lon> <ele>77</ele> </tp>
832 <tp> <time>2006-03-04T11:12:55Z</time> <lat>54.96913</lat> <lon>-1.62616</lon> <ele>77</ele> </tp>
833 <tp> <time>2006-03-04T11:13:04Z</time> <lat>54.96934</lat> <lon>-1.62624</lon> <ele>77.5</ele> </tp>
834 <tp> <time>2006-03-04T11:13:33Z</time> <lat>54.96934</lat> <lon>-1.62596</lon> <ele>78</ele> </tp>
835 <tp> <time>2006-03-04T11:13:48Z</time> <lat>54.96931</lat> <lon>-1.62645</lon> <ele>78</ele> </tp>
836 <tp> <time>2006-03-04T11:14:05Z</time> <lat>54.96918</lat> <lon>-1.62603</lon> <ele>79</ele> </tp>
837 <tp> <time>2006-03-04T11:14:33Z</time> <lat>54.96901</lat> <lon>-1.62364</lon> <ele>76.1</ele> </tp>
838 <tp> <time>2006-03-04T11:15:02Z</time> <lat>54.96922</lat> <lon>-1.6254</lon> <ele>76.1</ele> </tp>
839 <tp> <time>2006-03-04T11:15:27Z</time> <lat>54.96914</lat> <lon>-1.62526</lon> <ele>75.1</ele> </tp>
840 <tp> <time>2006-03-04T11:15:50Z</time> <lat>54.96911</lat> <lon>-1.62494</lon> <ele>75.1</ele> </tp>
841 <tp> <time>2006-03-04T11:16:03Z</time> <lat>54.9693</lat> <lon>-1.62489</lon> <ele>75.1</ele> </tp>
842 <tp> <time>2006-03-04T11:16:19Z</time> <lat>54.96901</lat> <lon>-1.62496</lon> <ele>75.1</ele> </tp>
843 <tp> <time>2006-03-04T11:16:52Z</time> <lat>54.96871</lat> <lon>-1.62466</lon> <ele>74.6</ele> </tp>
844 <tp> <time>2006-03-04T11:17:25Z</time> <lat>54.96908</lat> <lon>-1.62488</lon> <ele>72.7</ele> </tp>
846 <title>ACTIVE LOG 126</title>
847 <tp> <time>2006-03-04T11:18:32Z</time> <lat>54.96904</lat> <lon>-1.62482</lon> <ele>72.7</ele> </tp>
848 <tp> <time>2006-03-04T11:18:35Z</time> <lat>54.96913</lat> <lon>-1.62499</lon> <ele>71.3</ele> </tp>
849 <tp> <time>2006-03-04T11:18:38Z</time> <lat>54.96904</lat> <lon>-1.62497</lon> <ele>70.8</ele> </tp>
850 <tp> <time>2006-03-04T11:18:48Z</time> <lat>54.96913</lat> <lon>-1.62496</lon> <ele>71.8</ele> </tp>
851 <tp> <time>2006-03-04T11:18:55Z</time> <lat>54.96924</lat> <lon>-1.62501</lon> <ele>72.2</ele> </tp>
852 <tp> <time>2006-03-04T11:19:11Z</time> <lat>54.9694</lat> <lon>-1.62521</lon> <ele>71.8</ele> </tp>
853 <tp> <time>2006-03-04T11:19:30Z</time> <lat>54.96916</lat> <lon>-1.62515</lon> <ele>71.3</ele> </tp>
854 <tp> <time>2006-03-04T11:19:53Z</time> <lat>54.96921</lat> <lon>-1.625</lon> <ele>71.3</ele> </tp>
855 <tp> <time>2006-03-04T11:20:21Z</time> <lat>54.96801</lat> <lon>-1.62417</lon> <ele>71.8</ele> </tp>
857 <title>ACTIVE LOG 127</title>
858 <tp> <time>2006-03-04T11:21:16Z</time> <lat>54.96887</lat> <lon>-1.62504</lon> <ele>70.8</ele> </tp>
859 <tp> <time>2006-03-04T11:21:18Z</time> <lat>54.96898</lat> <lon>-1.62476</lon> <ele>69.8</ele> </tp>
860 <tp> <time>2006-03-04T11:21:29Z</time> <lat>54.9691</lat> <lon>-1.62475</lon> <ele>69.4</ele> </tp>
861 <tp> <time>2006-03-04T11:21:46Z</time> <lat>54.96918</lat> <lon>-1.62468</lon> <ele>70.3</ele> </tp>
862 <tp> <time>2006-03-04T11:22:39Z</time> <lat>54.9692</lat> <lon>-1.62465</lon> <ele>69.4</ele> </tp>
863 <tp> <time>2006-03-04T11:22:43Z</time> <lat>54.96924</lat> <lon>-1.62462</lon> <ele>71.8</ele> </tp>
864 <tp> <time>2006-03-04T11:22:45Z</time> <lat>54.96928</lat> <lon>-1.62463</lon> <ele>71.8</ele> </tp>
865 <tp> <time>2006-03-04T11:23:00Z</time> <lat>54.96945</lat> <lon>-1.62466</lon> <ele>69.4</ele> </tp>
870 "Read Mapsource TAB-separated format",
875 testcmd
("../gpst two-digit_year.mcsv", # {{{
877 <?xml version="1.0" encoding="UTF-8"?>
881 <title>ACTIVE LOG 032</title>
882 <tp> <time>2006-03-20T20:35:33Z</time> <lat>60.41324</lat> <lon>5.33352</lon> <ele>14</ele> </tp>
883 <tp> <time>2006-03-20T20:35:38Z</time> <lat>60.38802</lat> <lon>5.33845</lon> <ele>18</ele> </tp>
884 <tp> <time>2006-03-20T20:35:44Z</time> <lat>60.38709</lat> <lon>5.3379</lon> <ele>19</ele> </tp>
885 <tp> <time>2006-03-20T20:35:49Z</time> <lat>60.38641</lat> <lon>5.33732</lon> <ele>18</ele> </tp>
886 <tp> <time>2006-03-20T20:35:54Z</time> <lat>60.38581</lat> <lon>5.33647</lon> <ele>18</ele> </tp>
887 <tp> <time>2006-03-20T20:36:00Z</time> <lat>60.38516</lat> <lon>5.33528</lon> <ele>15</ele> </tp>
888 <tp> <time>2006-03-20T20:36:02Z</time> <lat>60.38495</lat> <lon>5.3349</lon> <ele>13</ele> </tp>
893 "Read Mapsource TAB-separated format with two-digit year",
898 testcmd
("../gpst log.gpstxt", # {{{
900 <?xml version="1.0" encoding="UTF-8"?>
903 <tp> <time>2003-06-13T14:36:09Z</time> <lat>59.5215166666667</lat> <lon>7.39186666666667</lon> <ele>762</ele> </tp>
904 <tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.39213333333333</lon> <ele>762</ele> </tp>
905 <tp> <time>2003-06-13T14:36:11Z</time> <lat>59.5213</lat> <lon>7.39241666666667</lon> <ele>761</ele> </tp>
906 <tp> <time>2003-06-13T14:36:12Z</time> <lat>59.5211833333333</lat> <lon>7.3927</lon> <ele>761</ele> </tp>
907 <etp err="nosignal"> <time>2003-06-13T14:36:13Z</time> </etp>
908 <tp> <time>2003-06-13T14:36:15Z</time> <lat>59.52085</lat> <lon>7.39351666666667</lon> <ele>760</ele> </tp>
909 <tp> <time>2003-06-13T14:36:16Z</time> <lat>59.5207333333333</lat> <lon>7.39378333333333</lon> <ele>760</ele> </tp>
910 <tp> <time>2003-06-13T14:36:17Z</time> <lat>59.52065</lat> <lon>7.39405</lon> <ele>760</ele> </tp>
911 <tp> <time>2003-06-13T14:36:18Z</time> <lat>59.5205833333333</lat> <lon>7.39433333333333</lon> <ele>760</ele> </tp>
912 <tp> <time>2003-06-13T14:36:19Z</time> <lat>59.5205333333333</lat> <lon>7.39463333333333</lon> <ele>759</ele> </tp>
913 <tp> <time>2003-06-13T14:36:20Z</time> <lat>59.5204833333333</lat> <lon>7.39491666666667</lon> <ele>759</ele> </tp>
914 <tp> <time>2003-06-13T14:36:21Z</time> <lat>59.5204333333333</lat> <lon>7.39523333333333</lon> <ele>759</ele> </tp>
915 <etp err="nosignal"> <time>2003-06-13T14:36:22Z</time> </etp>
916 <tp> <time>2003-06-13T14:36:24Z</time> <lat>59.5202833333333</lat> <lon>7.39623333333333</lon> <ele>758</ele> </tp>
917 <tp> <time>2003-06-13T14:36:25Z</time> <lat>59.5202333333333</lat> <lon>7.39655</lon> <ele>758</ele> </tp>
918 <tp> <time>2003-06-13T14:36:26Z</time> <lat>59.5201833333333</lat> <lon>7.39688333333333</lon> <ele>757</ele> </tp>
919 <tp> <time>2003-06-13T14:36:27Z</time> <lat>59.5201333333333</lat> <lon>7.39721666666667</lon> <ele>757</ele> </tp>
920 <tp> <time>2003-06-13T14:36:28Z</time> <lat>59.5201</lat> <lon>7.39756666666667</lon> <ele>757</ele> </tp>
925 "Read Garmin serial text format",
930 testcmd
("../gpst log.dos.mayko", # {{{
932 <?xml version="1.0" encoding="UTF-8"?>
935 <tp> <time>2003-06-15T10:27:45Z</time> <lat>58.1818158</lat> <lon>8.1225077</lon> </tp>
936 <tp> <time>2003-06-15T10:27:53Z</time> <lat>58.1818712</lat> <lon>8.12532</lon> </tp>
937 <tp> <time>2003-06-15T10:27:57Z</time> <lat>58.1816347</lat> <lon>8.1266031</lon> </tp>
938 <tp> <time>2003-06-15T10:28:03Z</time> <lat>58.1812099</lat> <lon>8.1284612</lon> </tp>
939 <tp> <time>2003-06-15T10:28:06Z</time> <lat>58.1810315</lat> <lon>8.129395</lon> </tp>
940 <tp> <time>2003-06-15T10:28:10Z</time> <lat>58.1809621</lat> <lon>8.13074</lon> </tp>
945 "Read DOS-formatted Mayko format",
950 testcmd
("../gpst log.dos.gpstxt", # {{{
952 <?xml version="1.0" encoding="UTF-8"?>
955 <tp> <time>2003-01-05T16:47:11Z</time> <lat>66.9081666666667</lat> <lon>15.0229833333333</lon> <ele>11472</ele> </tp>
956 <tp> <time>2003-01-05T16:47:12Z</time> <lat>66.90625</lat> <lon>15.0206666666667</lon> <ele>11472</ele> </tp>
957 <tp> <time>2003-01-05T16:47:13Z</time> <lat>66.9043166666667</lat> <lon>15.01835</lon> <ele>11472</ele> </tp>
958 <tp> <time>2003-01-05T16:47:14Z</time> <lat>66.9024</lat> <lon>15.0160166666667</lon> <ele>11473</ele> </tp>
959 <tp> <time>2003-01-05T16:47:15Z</time> <lat>66.9004833333333</lat> <lon>15.0137</lon> <ele>11474</ele> </tp>
960 <tp> <time>2003-01-05T16:47:16Z</time> <lat>66.8985666666667</lat> <lon>15.0113833333333</lon> <ele>11474</ele> </tp>
961 <tp> <time>2003-01-05T16:47:17Z</time> <lat>66.8966333333333</lat> <lon>15.0090666666667</lon> <ele>11475</ele> </tp>
962 <tp> <time>2003-01-05T16:47:18Z</time> <lat>66.8947166666667</lat> <lon>15.0067333333333</lon> <ele>11475</ele> </tp>
963 <tp> <time>2003-01-05T16:47:19Z</time> <lat>66.8928</lat> <lon>15.0044166666667</lon> <ele>11475</ele> </tp>
964 <tp> <time>2003-01-05T16:47:20Z</time> <lat>66.8908666666667</lat> <lon>15.0021</lon> <ele>11475</ele> </tp>
965 <tp> <time>2003-01-05T16:47:21Z</time> <lat>66.88895</lat> <lon>14.9997833333333</lon> <ele>11475</ele> </tp>
970 "Read DOS-formatted Garmin serial text format",
975 testcmd
("../gpst log.unix.mcsv", # {{{
977 <?xml version="1.0" encoding="UTF-8"?>
981 <title>ACTIVE LOG 058</title>
982 <tp> <time>2006-02-21T15:14:25Z</time> <lat>60.36662</lat> <lon>5.24885</lon> <ele>31.9</ele> </tp>
983 <tp> <time>2006-02-21T15:14:30Z</time> <lat>60.37057</lat> <lon>5.22956</lon> <ele>35.2</ele> </tp>
984 <tp> <time>2006-02-21T15:14:35Z</time> <lat>60.37019</lat> <lon>5.22817</lon> <ele>39.6</ele> </tp>
985 <tp> <time>2006-02-21T15:14:36Z</time> <lat>60.37012</lat> <lon>5.2279</lon> <ele>41</ele> </tp>
986 <tp> <time>2006-02-21T15:14:40Z</time> <lat>60.37009</lat> <lon>5.22682</lon> <ele>47.2</ele> </tp>
987 <tp> <time>2006-02-21T15:14:42Z</time> <lat>60.37011</lat> <lon>5.22641</lon> <ele>49.2</ele> </tp>
988 <tp> <time>2006-02-21T15:14:44Z</time> <lat>60.37011</lat> <lon>5.22607</lon> <ele>50.1</ele> </tp>
989 <tp> <time>2006-02-21T15:14:48Z</time> <lat>60.37002</lat> <lon>5.22568</lon> <ele>51.1</ele> </tp>
990 <tp> <time>2006-02-21T15:14:51Z</time> <lat>60.3701</lat> <lon>5.22548</lon> <ele>52.5</ele> </tp>
995 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
1000 testcmd
("../gpst multitrack.gpx", # {{{
1002 <?xml version="1.0" encoding="UTF-8"?>
1005 <title>Track 1</title>
1006 <tp> <time>2003-02-11T23:35:39Z</time> <lat>51.4968266</lat> <lon>-0.1448824</lon> </tp>
1007 <tp> <time>2003-02-11T23:35:49Z</time> <lat>51.4968227</lat> <lon>-0.1449938</lon> </tp>
1008 <tp> <time>2003-02-11T23:36:14Z</time> <lat>51.496904</lat> <lon>-0.1453202</lon> </tp>
1010 <title>Track 2</title>
1011 <tp> <time>2003-02-11T23:36:16Z</time> <lat>51.4969214</lat> <lon>-0.1453398</lon> </tp>
1012 <tp> <time>2003-02-11T23:36:31Z</time> <lat>51.4969816</lat> <lon>-0.1455514</lon> </tp>
1013 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1014 <tp> <time>2003-02-11T23:36:50Z</time> <lat>51.4970452</lat> <lon>-0.1457804</lon> </tp>
1016 <title>Track 3</title>
1017 <tp> <time>2003-02-11T23:37:05Z</time> <lat>51.497068</lat> <lon>-0.1458608</lon> </tp>
1018 <tp> <time>2003-02-11T23:37:22Z</time> <lat>51.4971658</lat> <lon>-0.1460047</lon> </tp>
1019 <tp> <time>2003-02-11T23:37:36Z</time> <lat>51.4972469</lat> <lon>-0.1461614</lon> </tp>
1021 <title>Track 4</title>
1022 <tp> <time>2003-02-11T23:37:43Z</time> <lat>51.4972731</lat> <lon>-0.1462394</lon> </tp>
1023 <tp> <time>2003-02-11T23:38:04Z</time> <lat>51.4973437</lat> <lon>-0.1463232</lon> </tp>
1024 <tp> <time>2003-02-11T23:38:28Z</time> <lat>51.4973337</lat> <lon>-0.1462949</lon> </tp>
1025 <tp> <time>2003-02-11T23:38:34Z</time> <lat>51.4973218</lat> <lon>-0.1462825</lon> </tp>
1026 <tp> <time>2003-02-11T23:38:35Z</time> <lat>51.4973145</lat> <lon>-0.1462732</lon> </tp>
1031 "Read GPX file with multiple tracks",
1036 testcmd
("../gpst compact.gpx", # {{{
1038 <?xml version="1.0" encoding="UTF-8"?>
1041 <title>All whitespace stripped</title>
1042 <tp> <time>2002-12-30T15:22:04Z</time> <lat>70.660932</lat> <lon>23.7028354</lon> </tp>
1043 <tp> <time>2002-12-30T15:22:06Z</time> <lat>70.6609392</lat> <lon>23.7028468</lon> </tp>
1044 <tp> <time>2002-12-30T15:22:08Z</time> <lat>70.6609429</lat> <lon>23.7028499</lon> </tp>
1045 <tp> <time>2002-12-30T15:22:11Z</time> <lat>70.6609381</lat> <lon>23.702862</lon> </tp>
1046 <tp> <time>2002-12-30T15:22:12Z</time> <lat>70.6609368</lat> <lon>23.7028648</lon> </tp>
1047 <tp> <time>2002-12-30T15:22:13Z</time> <lat>70.6609344</lat> <lon>23.7028652</lon> </tp>
1048 <tp> <time>2002-12-30T15:22:15Z</time> <lat>70.6609349</lat> <lon>23.7028707</lon> </tp>
1049 <tp> <time>2002-12-30T15:22:17Z</time> <lat>70.6609348</lat> <lon>23.7028654</lon> </tp>
1050 <tp> <time>2002-12-30T15:22:19Z</time> <lat>70.6609347</lat> <lon>23.7028599</lon> </tp>
1051 <tp> <time>2002-12-30T15:22:20Z</time> <lat>70.6609348</lat> <lon>23.7028609</lon> </tp>
1052 <tp> <time>2002-12-30T15:22:23Z</time> <lat>70.6609388</lat> <lon>23.7028653</lon> </tp>
1053 <tp> <time>2002-12-30T15:22:25Z</time> <lat>70.6609426</lat> <lon>23.7028732</lon> </tp>
1058 "Read GPX one-liner",
1063 testcmd
("../gpst missing.gpsml", # {{{
1065 <?xml version="1.0" encoding="UTF-8"?>
1068 <title>Missing various elements</title>
1069 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1070 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1071 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1072 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1073 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1074 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1075 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1076 <tp> <ele>486</ele> </tp>
1077 <tp> <desc>Missing everything</desc> </tp>
1078 <tp> <lat>60.42339</lat> </tp>
1079 <tp> <lon>5.34262</lon> </tp>
1080 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1081 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1086 "Read gpsml with various data missing",
1091 testcmd
("../gpst different_dateformats.gpsml", # {{{
1093 <?xml version="1.0" encoding="UTF-8"?>
1096 <title>Date format variations</title>
1097 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1</lat> <lon>1</lon> </tp>
1098 <tp> <time>2006-01-01T00:00:02Z</time> <lat>2</lat> <lon>2</lon> </tp>
1099 <tp> <time>2006-01-01T00:00:03Z</time> <lat>3</lat> <lon>3</lon> </tp>
1100 <tp> <time>2006-01-01T00:00:04Z</time> <lat>4</lat> <lon>4</lon> </tp>
1105 "Read different date formats from gpsml file",
1110 testcmd
("../gpst multitrack-pause.gpx", # {{{
1111 file_data
("multitrack-pause.gpsml"),
1113 "Should be equal to multitrack-pause.gpsml",
1119 testcmd
("../gpst -o gpx no_signal.mayko", # {{{
1124 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
1125 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
1126 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
1127 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> </trkpt>
1128 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> </trkpt>
1129 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> </trkpt>
1130 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
1131 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1132 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1138 "Output GPX from Mayko file with duplicates",
1143 testcmd
("../gpst -o gpx comments.mayko", # {{{
1148 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
1149 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
1150 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
1151 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1152 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1153 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1154 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
1157 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1158 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1164 "Output GPX from Mayko file with commented-out lines",
1169 testcmd
("../gpst -o gpx missing-noname.gpsml", # {{{
1174 <trkpt lat="60.42353" lon="5.34185"> <time>2006-04-30T17:17:09Z</time> </trkpt>
1175 <trkpt lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
1176 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
1182 "Output GPX from gpsml with missing data",
1188 testcmd
("../gpst -o xgraph multitrack.gpx", # {{{
1190 -0.1448824 51.4968266
1191 -0.1449938 51.4968227
1192 -0.1453202 51.496904
1193 move -0.1453398 51.4969214
1194 -0.1455514 51.4969816
1195 -0.1457489 51.4970224
1196 -0.1457804 51.4970452
1197 move -0.1458608 51.497068
1198 -0.1460047 51.4971658
1199 -0.1461614 51.4972469
1200 move -0.1462394 51.4972731
1201 -0.1463232 51.4973437
1202 -0.1462949 51.4973337
1203 -0.1462825 51.4973218
1204 -0.1462732 51.4973145
1207 "Output xgraph format from GPX",
1213 testcmd
("../gpst -o pgtab compact.gpx", # {{{
1215 2002-12-30T15:22:04Z\t(70.660932,23.7028354)\t\\N\t\\N\t\\N\t\\N
1216 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N
1217 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N
1218 2002-12-30T15:22:11Z\t(70.6609381,23.702862)\t\\N\t\\N\t\\N\t\\N
1219 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N
1220 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N
1221 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N
1222 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N
1223 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N
1224 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N
1225 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N
1226 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N
1229 "Output pgtab from gpx format",
1234 testcmd
("../gpst -o pgtab no_signal.mayko", # {{{
1236 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
1237 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
1238 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1239 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1240 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1241 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1242 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
1243 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
1244 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
1247 "Output pgtab from mayko format",
1252 testcmd
("../gpst -o pgtab missing.gpsml", # {{{
1254 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N
1255 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N
1256 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N
1259 "Output pgtab from missing.gpsml",
1265 testcmd
("../gpst -o csv log.dos.mayko", # {{{
1267 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1268 2003-06-15T10:27:53Z\t8.12532\t58.1818712\t\t
1269 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1270 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1271 2003-06-15T10:28:06Z\t8.129395\t58.1810315\t\t
1272 2003-06-15T10:28:10Z\t8.13074\t58.1809621\t\t
1275 "Output csv from DOS-formatted Mayko format",
1280 testcmd
("../gpst -o csv multitrack.gpx", # {{{
1281 # FIXME: Get rid of the empty line in the beginning
1284 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
1285 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
1286 2003-02-11T23:36:14Z\t-0.1453202\t51.496904\t\t
1288 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
1289 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
1290 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
1291 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
1293 2003-02-11T23:37:05Z\t-0.1458608\t51.497068\t\t
1294 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
1295 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
1297 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
1298 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
1299 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
1300 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
1301 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
1304 "Output csv from DOS-formatted Mayko format",
1310 testcmd
("../gpst -o pgwtab multitrack.gpx", # {{{
1312 (51.477880000,-0.001470000)\t0-Meridian\t\\N\t\\N\t\\N\t11-FEB-03 15:46\t11-FEB-03 15:46\t\\N\t\\N
1313 (51.532030,-0.177330)\tAbbey Road\t34.492798\t\\N\t\\N\tDet hellige gangfeltet der Beatles valsa over.\t26-FEB-06 17:29:46\t\\N\t\\N
1314 (61.636684,8.312254)\tGaldhøpiggen med ', &, < og >. ☺\t2469.012939\tmountain\t2006-05-08T18:27:59Z\tHer er det &, < og >. ☺\tSchwæra greie\thttp://www.example.org/\tWaypoint
1315 (60.397460000,5.350610000)\tHalfdan Griegs vei\t\\N\t\\N\t\\N\t04-AUG-02 19:42\t04-AUG-02 19:42\t\\N\t\\N
1316 (51.510130000,-0.130410000)\tLeicester Square\t\\N\t\\N\t\\N\t11-FEB-03 18:00\t11-FEB-03 18:00\t\\N\t\\N
1317 (60.968540000,9.285350000)\tLeira camping\t\\N\t\\N\t\\N\t03-OKT-02 21:58\t03-OKT-02 21:58\t\\N\t\\N
1320 "Test pgwtab format",
1326 testcmd
("../gpst -o pgwupd multitrack.gpx", # {{{
1329 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1330 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1333 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1334 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1337 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1338 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1341 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1342 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1345 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1346 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1349 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1350 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1354 "Test pgwupd format",
1360 testcmd
("../gpst -t -o clean pause.gpx", # {{{
1362 5.299534\t60.425494\t25.26
1363 5.29961\t60.425464\t24.931
1365 5.299694\t60.425314\t27.975
1367 5.299741\t60.425384\t31.017
1368 5.299958\t60.425339\t30.98
1369 5.29964\t60.425238\t30.538
1370 5.299686\t60.425246\t30.515
1372 5.299773\t60.425345\t31.936
1373 5.299419\t60.425457\t31.794
1376 "Output clean format with time breaks",
1385 # --output option }}}
1386 diag
("Testing --outside option..."); # {{{
1387 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx", # {{{
1389 <?xml version="1.0" encoding="UTF-8"?>
1392 <title>track1</title>
1393 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1394 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1395 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1397 <title>track2</title>
1399 <title>track3</title>
1401 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1402 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1403 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1404 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1405 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1410 "Check --outside option (gpx to gpst)",
1415 # --outside option }}}
1416 diag
("Testing --pos1 and --pos2 options..."); # {{{
1417 # --pos1 and --pos2 options }}}
1418 diag
("Testing --require option..."); # {{{
1419 testcmd
("../gpst -re multitrack.gpx", # {{{
1421 <?xml version="1.0" encoding="UTF-8"?>
1424 <title>Track 1</title>
1426 <title>Track 2</title>
1427 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1429 <title>Track 3</title>
1431 <title>Track 4</title>
1436 "Require elevation from GPX data",
1441 testcmd
("../gpst -re one_ele.dos.gpsml", # {{{
1443 <?xml version="1.0" encoding="UTF-8"?>
1446 <title>Only one point has elevation</title>
1447 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1452 "Require elevation from gpsml",
1457 testcmd
("../gpst -re missing.gpsml", # {{{
1459 <?xml version="1.0" encoding="UTF-8"?>
1462 <title>Missing various elements</title>
1463 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1464 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1465 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1466 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1467 <tp> <ele>486</ele> </tp>
1468 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1469 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1474 "Require elevation",
1479 testcmd
("../gpst -rt missing.gpsml", # {{{
1481 <?xml version="1.0" encoding="UTF-8"?>
1484 <title>Missing various elements</title>
1485 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1486 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1487 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1488 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1489 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1490 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1491 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1501 testcmd
("../gpst -rp missing.gpsml", # {{{
1503 <?xml version="1.0" encoding="UTF-8"?>
1506 <title>Missing various elements</title>
1507 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1508 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1509 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1519 testcmd
("../gpst -ret missing.gpsml", # {{{
1521 <?xml version="1.0" encoding="UTF-8"?>
1524 <title>Missing various elements</title>
1525 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1526 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1527 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1528 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1533 "Require elevation and time",
1538 testcmd
("../gpst -retp missing.gpsml", # {{{
1540 <?xml version="1.0" encoding="UTF-8"?>
1543 <title>Missing various elements</title>
1544 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1549 "Require elevation, time and position",
1554 testcmd
("../gpst -rep missing.gpsml", # {{{
1556 <?xml version="1.0" encoding="UTF-8"?>
1559 <title>Missing various elements</title>
1560 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1561 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1566 "Require elevation and position",
1571 # --require option }}}
1572 diag
("Testing --round option..."); # {{{
1573 testcmd
("../gpst -R lat=4,lon=5,ele=1 pause.gpx", # {{{
1575 <?xml version="1.0" encoding="UTF-8"?>
1578 <title>ACTIVE LOG164705</title>
1579 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1580 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1581 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1582 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1583 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1584 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1585 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1586 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1587 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1592 "--round works with lat, lon, ele from gpx",
1597 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgtab pause.gpx", # {{{
1599 2006-05-21T16:49:11Z\t(60.425,5.3)\t25.3\t\\N\t\\N\t\\N
1600 2006-05-21T16:49:46Z\t(60.425,5.3)\t24.9\t\\N\t\\N\t\\N
1601 2006-05-21T16:52:04Z\t(60.425,5.3)\t28\t\\N\t\\N\t\\N
1602 2006-05-21T16:56:36Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1603 2006-05-21T16:56:47Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1604 2006-05-21T16:56:56Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1605 2006-05-21T16:57:03Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1606 2006-05-21T16:59:08Z\t(60.425,5.3)\t31.9\t\\N\t\\N\t\\N
1607 2006-05-21T17:00:54Z\t(60.425,5.299)\t31.8\t\\N\t\\N\t\\N
1610 "pgtab output from gpx works with --round lat, lon, ele",
1615 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwtab multitrack.gpx", # {{{
1617 (51.478,-0.001)\t0-Meridian\t\\N\t\\N\t\\N\t11-FEB-03 15:46\t11-FEB-03 15:46\t\\N\t\\N
1618 (51.532,-0.177)\tAbbey Road\t34.5\t\\N\t\\N\tDet hellige gangfeltet der Beatles valsa over.\t26-FEB-06 17:29:46\t\\N\t\\N
1619 (61.637,8.312)\tGaldhøpiggen med ', &, < og >. ☺\t2469\tmountain\t2006-05-08T18:27:59Z\tHer er det &, < og >. ☺\tSchwæra greie\thttp://www.example.org/\tWaypoint
1620 (60.397,5.351)\tHalfdan Griegs vei\t\\N\t\\N\t\\N\t04-AUG-02 19:42\t04-AUG-02 19:42\t\\N\t\\N
1621 (51.51,-0.13)\tLeicester Square\t\\N\t\\N\t\\N\t11-FEB-03 18:00\t11-FEB-03 18:00\t\\N\t\\N
1622 (60.969,9.285)\tLeira camping\t\\N\t\\N\t\\N\t03-OKT-02 21:58\t03-OKT-02 21:58\t\\N\t\\N
1625 "--round works with lat, lon, ele from gpx, pgwtab output",
1630 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwupd multitrack.gpx", # {{{
1633 UPDATE logg SET name = clname(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1634 UPDATE logg SET dist = cldist(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1637 UPDATE logg SET name = clname(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1638 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1641 UPDATE logg SET name = clname(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1642 UPDATE logg SET dist = cldist(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1645 UPDATE logg SET name = clname(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1646 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1649 UPDATE logg SET name = clname(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1650 UPDATE logg SET dist = cldist(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1653 UPDATE logg SET name = clname(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1654 UPDATE logg SET dist = cldist(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1658 "pgwupd output and --round works with lat, lon, ele from gpx",
1663 testcmd
("../gpst -R lat=8,lon=8 -o gpx rounding.mayko", # {{{
1668 <trkpt lat="51.4838161" lon="0.0000533"> <time>2003-02-11T12:17:05Z</time> </trkpt>
1669 <trkpt lat="51.483777" lon="-0.0000211"> <time>2003-02-11T12:17:15Z</time> </trkpt>
1670 <trkpt lat="51.4837543" lon="-0.0000894"> <time>2003-02-11T12:17:21Z</time> </trkpt>
1671 <trkpt lat="51.4836222" lon="0.0000272"> <time>2003-02-11T12:27:41Z</time> </trkpt>
1677 "Suppress braindead scientific notation when using --round (from mayko)",
1682 testcmd
("../gpst -R lat=8,lon=8 -o gpx rounding.gpx", # {{{
1687 <trkpt lat="51.4838161" lon="0.0000533"> <time>2003-02-11T12:17:05Z</time> </trkpt>
1688 <trkpt lat="51.483777" lon="-0.0000211"> <time>2003-02-11T12:17:15Z</time> </trkpt>
1689 <trkpt lat="51.4837543" lon="-0.0000894"> <time>2003-02-11T12:17:21Z</time> </trkpt>
1690 <trkpt lat="51.4836222" lon="0.0000272"> <time>2003-02-11T12:27:41Z</time> </trkpt>
1696 "Suppress braindead scientific notation when using --round (from gpx)",
1701 testcmd
("../gpst -R lat=6,lon=6 -o gpx rounding.gpx", # {{{
1706 <trkpt lat="51.483816" lon="0.000053"> <time>2003-02-11T12:17:05Z</time> </trkpt>
1707 <trkpt lat="51.483777" lon="-0.000021"> <time>2003-02-11T12:17:15Z</time> </trkpt>
1708 <trkpt lat="51.483754" lon="-0.000089"> <time>2003-02-11T12:17:21Z</time> </trkpt>
1709 <trkpt lat="51.483622" lon="0.000027"> <time>2003-02-11T12:27:41Z</time> </trkpt>
1715 "Suppress scientific notation, six decimals (from gpx)",
1720 testcmd
("../gpst -R lat=2,lon=2 -o gpx rounding.gpx", # {{{
1725 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:05Z</time> </trkpt>
1726 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:15Z</time> </trkpt>
1727 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:21Z</time> </trkpt>
1728 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:27:41Z</time> </trkpt>
1734 "Suppress scientific notation, two decimals (from gpx)",
1739 testcmd
("../gpst -R lat=2,lon=2 -o gpx rounding.mayko", # {{{
1744 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:05Z</time> </trkpt>
1745 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:15Z</time> </trkpt>
1746 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:17:21Z</time> </trkpt>
1747 <trkpt lat="51.48" lon="0"> <time>2003-02-11T12:27:41Z</time> </trkpt>
1753 "Suppress scientific notation, two decimals (from mayko)",
1758 # --round option }}}
1759 diag
("Testing --short-date option..."); # {{{
1760 # --short-date option }}}
1761 diag
("Testing --save-to-file option..."); # {{{
1762 # --save-to-file option }}}
1763 diag
("Testing --create-breaks option..."); # {{{
1764 testcmd
("../gpst -t pause.gpx", # {{{
1766 <?xml version="1.0" encoding="UTF-8"?>
1769 <title>ACTIVE LOG164705</title>
1770 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1771 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1772 <pause>0:00:02:18</pause>
1773 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1774 <pause>0:00:04:32</pause>
1775 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1776 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1777 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1778 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1779 <pause>0:00:02:05</pause>
1780 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1781 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1786 "Output gpsml with <pause> elements from GPX files",
1791 testcmd
("../gpst -t multitrack-pause.gpx", # {{{
1793 <?xml version="1.0" encoding="UTF-8"?>
1796 <title>track1</title>
1797 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1798 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1799 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1801 <title>track2</title>
1802 <pause>0:23:59:58</pause>
1803 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1804 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1805 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1806 <pause>0:01:00:00</pause>
1807 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1809 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1811 <title>track3</title>
1812 <pause>1:01:00:03</pause>
1813 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1814 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1815 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1817 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1818 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1819 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1820 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1821 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1826 "Insert <pause> between gpx tracks",
1831 testcmd
("../gpst -t multitrack-pause.gpsml", # {{{
1833 <?xml version="1.0" encoding="UTF-8"?>
1836 <title>track1</title>
1837 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1838 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1839 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1841 <title>track2</title>
1842 <pause>0:23:59:58</pause>
1843 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1844 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1845 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1846 <pause>0:01:00:00</pause>
1847 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1849 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1851 <title>track3</title>
1852 <pause>1:01:00:03</pause>
1853 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1854 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1855 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1857 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1858 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1859 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1860 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1861 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1866 "Insert <pause> between gpsml titles",
1871 # --create-breaks option }}}
1872 diag
("Testing -T (--time-shift) option..."); # {{{
1873 testcmd
("$CMD -T 3600 multitrack-pause.gpx", # {{{
1875 <?xml version="1.0" encoding="UTF-8"?>
1878 <title>track1</title>
1879 <tp> <time>2006-01-01T01:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1880 <tp> <time>2006-01-01T01:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1881 <tp> <time>2006-01-01T01:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1883 <title>track2</title>
1884 <tp> <time>2006-01-02T01:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1885 <tp> <time>2006-01-02T01:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1886 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1887 <tp> <time>2006-01-02T02:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1889 <tp> <time>2006-01-02T02:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1891 <title>track3</title>
1892 <tp> <time>2006-01-03T03:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1893 <tp> <time>2006-01-03T03:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1894 <tp> <time>2006-01-03T03:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1896 <tp> <time>2006-01-03T03:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1897 <tp> <time>2006-01-03T03:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1898 <tp> <time>2006-01-03T03:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1899 <tp> <time>2006-01-03T03:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1900 <tp> <time>2006-01-03T03:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1905 "Add one hour to GPX input, output gpsml",
1910 testcmd
("$CMD -T -3600 multitrack-pause.gpx", # {{{
1912 <?xml version="1.0" encoding="UTF-8"?>
1915 <title>track1</title>
1916 <tp> <time>2005-12-31T23:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1917 <tp> <time>2005-12-31T23:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1918 <tp> <time>2005-12-31T23:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1920 <title>track2</title>
1921 <tp> <time>2006-01-01T23:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1922 <tp> <time>2006-01-01T23:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1923 <tp> <time>2006-01-01T23:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1924 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1926 <tp> <time>2006-01-02T00:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1928 <title>track3</title>
1929 <tp> <time>2006-01-03T01:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1930 <tp> <time>2006-01-03T01:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1931 <tp> <time>2006-01-03T01:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1933 <tp> <time>2006-01-03T01:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1934 <tp> <time>2006-01-03T01:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1935 <tp> <time>2006-01-03T01:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1936 <tp> <time>2006-01-03T01:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1937 <tp> <time>2006-01-03T01:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1942 "Subtract one hour from GPX input, output gpsml",
1947 testcmd
("$CMD -T 1 -o gpx multitrack-pause.gpx", # {{{
1952 <trkpt lat="1.11" lon="1.12"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1953 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:02Z</time> </trkpt>
1954 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:03Z</time> </trkpt>
1957 <trkpt lat="2.11" lon="2.12"> <time>2006-01-02T00:00:01Z</time> </trkpt>
1958 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:05Z</time> </trkpt>
1959 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:17Z</time> </trkpt>
1960 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:17Z</time> </trkpt>
1961 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:18Z</time> </trkpt>
1966 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1967 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1968 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1969 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1972 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1973 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1974 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:27Z</time> </trkpt>
1975 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:28Z</time> </trkpt>
1981 "Add one second to GPX input, output GPX",
1986 testcmd
("$CMD --time-shift -1 -o gpx multitrack-pause.gpsml", # {{{
1991 <trkpt lat="1.11" lon="1.12"> <time>2005-12-31T23:59:59Z</time> </trkpt>
1992 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:00Z</time> </trkpt>
1993 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1996 <trkpt lat="2.11" lon="2.12"> <time>2006-01-01T23:59:59Z</time> </trkpt>
1997 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:03Z</time> </trkpt>
1998 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:15Z</time> </trkpt>
1999 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:15Z</time> </trkpt>
2000 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:16Z</time> </trkpt>
2005 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:19Z</time> </trkpt>
2006 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:20Z</time> </trkpt>
2007 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:21Z</time> </trkpt>
2008 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:22Z</time> </trkpt>
2011 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:23Z</time> </trkpt>
2012 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:24Z</time> </trkpt>
2013 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:25Z</time> </trkpt>
2014 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:26Z</time> </trkpt>
2020 "Subtract one second from gpsml input, output GPX, use long option",
2025 testcmd
("$CMD -T 0 -o pgtab multitrack-pause.gpx", # {{{
2027 2006-01-01T00:00:00Z\t(1.11,1.12)\t\\N\t\\N\t\\N\t\\N
2028 2006-01-01T00:00:01Z\t(1.21,1.22)\t\\N\t\\N\t\\N\t\\N
2029 2006-01-01T00:00:02Z\t(1.31,1.32)\t\\N\t\\N\t\\N\t\\N
2030 2006-01-02T00:00:00Z\t(2.11,2.12)\t\\N\t\\N\t\\N\t\\N
2031 2006-01-02T00:00:04Z\t(2.21,2.22)\t\\N\t\\N\t\\N\t\\N
2032 2006-01-02T00:00:16Z\t(2.31,2.32)\t\\N\t\\N\t\\N\t\\N
2033 2006-01-02T01:00:16Z\t(2.41,2.42)\t\\N\t\\N\t\\N\t\\N
2034 2006-01-02T01:00:17Z\t(2.451,2.452)\t\\N\t\\N\t\\N\t\\N
2035 2006-01-03T02:00:20Z\t(3.11,3.12)\t\\N\t\\N\t\\N\t\\N
2036 2006-01-03T02:00:21Z\t(3.21,3.22)\t\\N\t\\N\t\\N\t\\N
2037 2006-01-03T02:00:22Z\t(3.31,3.32)\t\\N\t\\N\t\\N\t\\N
2038 2006-01-03T02:00:23Z\t(3.41,3.42)\t\\N\t\\N\t\\N\t\\N
2039 2006-01-03T02:00:24Z\t(3.51,3.52)\t\\N\t\\N\t\\N\t\\N
2040 2006-01-03T02:00:25Z\t(3.61,3.62)\t\\N\t\\N\t\\N\t\\N
2041 2006-01-03T02:00:26Z\t(3.71,3.72)\t\\N\t\\N\t\\N\t\\N
2042 2006-01-03T02:00:27Z\t(3.81,3.82)\t\\N\t\\N\t\\N\t\\N
2045 "Read GPX, time-shift 0 seconds, output pgtab",
2050 # --time-shift option }}}
2051 diag
("Testing -v (--verbose) option..."); # {{{
2052 likecmd
("$CMD -hv", # {{{
2053 '/^\n\S+ v\d\.\d\d\n/s',
2055 "Option -v (--verbose) with -h returns version number and help screen",
2059 # --verbose option }}}
2060 diag
("Testing --version option..."); # {{{
2061 likecmd
("$CMD --version", # {{{
2062 '/^\S+ v\d\.\d\d\n/',
2064 "Option --version returns version number",
2068 # --version option }}}
2069 diag
("Testing --strip-whitespace option..."); # {{{
2070 testcmd
("../gpst -w -o gpx pause-noname.gpx", # {{{
2072 $stripped_gpx_header
2075 <trkpt lat="60.425494" lon="5.299534"><ele>25.26</ele><time>2006-05-21T16:49:11Z</time></trkpt>
2076 <trkpt lat="60.425464" lon="5.29961"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
2077 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
2078 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
2079 <trkpt lat="60.425339" lon="5.299958"><ele>30.98</ele><time>2006-05-21T16:56:47Z</time></trkpt>
2080 <trkpt lat="60.425238" lon="5.29964"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
2081 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
2082 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
2083 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
2089 "Strip whitespace from GPX output",
2094 testcmd
("../gpst -o gpx -w comments.mayko", # {{{
2096 $stripped_gpx_header
2099 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
2100 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
2101 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
2102 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
2103 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
2104 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
2105 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
2108 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
2109 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
2115 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
2120 testcmd
("../gpst -w -o pgwupd multitrack.gpx", # {{{
2123 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
2124 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
2127 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
2128 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
2131 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
2132 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
2135 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
2136 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
2139 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
2140 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
2143 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
2144 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
2148 "Strip whitespace from pgwupd output",
2153 # --strip-whitespace option }}}
2154 diag
("Testing --double-y-scale option..."); # {{{
2155 testcmd
("../gpst -y -o clean pause.gpx", # {{{
2157 5.299534\t120.850988\t25.26
2158 5.29961\t120.850928\t24.931
2159 5.299694\t120.850628\t27.975
2160 5.299741\t120.850768\t31.017
2161 5.299958\t120.850678\t30.98
2162 5.29964\t120.850476\t30.538
2163 5.299686\t120.850492\t30.515
2164 5.299773\t120.85069\t31.936
2165 5.299419\t120.850914\t31.794
2168 "Double y scale, clean output from gpx format",
2173 testcmd
("../gpst -y -o clean log.dos.mayko", # {{{
2175 8.1225077\t116.3636316\t
2176 8.12532\t116.3637424\t
2177 8.1266031\t116.3632694\t
2178 8.1284612\t116.3624198\t
2179 8.129395\t116.362063\t
2180 8.13074\t116.3619242\t
2183 "Double y scale, clean output from mayko format",
2188 # --double-y-scale option }}}
2189 diag
("Testing --debug option..."); # {{{
2190 # --debug option }}}
2191 diag
("Strip error from Mayko format..."); # {{{
2193 testcmd
("../gpst -o csv date_error.mayko", # {{{
2195 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
2196 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
2197 2003-06-13T09:12:41Z\t5.5813636\t60.428332\t\t
2198 2003-06-13T09:12:42Z\t5.581743\t60.4283806\t\t
2201 "Strip error from mayko format in csv output",
2206 testcmd
("../gpst -o clean date_error.mayko", # {{{
2208 5.5794667\t60.4280897\t
2209 5.5802255\t60.4281867\t
2210 5.5813636\t60.428332\t
2211 5.581743\t60.4283806\t
2214 "Strip error from mayko format in clean output",
2219 testcmd
("../gpst -o gpsml date_error.mayko", # {{{
2221 <?xml version="1.0" encoding="UTF-8"?>
2224 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
2225 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
2226 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
2227 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
2228 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
2233 "Strip error from mayko format in gpsml output",
2238 testcmd
("../gpst -o gpx date_error.mayko", # {{{
2243 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
2244 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
2245 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
2246 <trkpt lat="60.428332" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
2247 <trkpt lat="60.4283806" lon="5.581743"> <time>2003-06-13T09:12:42Z</time> </trkpt>
2253 "Strip error from mayko format in gpx output",
2258 testcmd
("../gpst -o gpstrans date_error.mayko", # {{{
2260 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
2261 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
2262 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
2263 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
2264 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
2267 "Strip error from mayko format in gpstrans output",
2272 testcmd
("../gpst -o pgtab date_error.mayko", # {{{
2274 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N
2275 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N
2276 2003-06-13T09:12:41Z\t(60.428332,5.5813636)\t\\N\t\\N\t\\N\t\\N
2277 2003-06-13T09:12:42Z\t(60.4283806,5.581743)\t\\N\t\\N\t\\N\t\\N
2280 "Strip error from mayko format in pgtab output",
2285 testcmd
("../gpst -o poscount date_error.mayko", # {{{
2287 5.5802255\t60.4281867\t1
2288 5.581743\t60.4283806\t1
2289 5.5794667\t60.4280897\t1
2290 5.5813636\t60.428332\t1
2293 "Strip error from mayko format in poscount output",
2298 testcmd
("../gpst -o xgraph date_error.mayko", # {{{
2300 5.5794667 60.4280897
2301 5.5802255 60.4281867
2306 "Strip error from mayko format in xgraph output",
2311 testcmd
("../gpst -o ygraph date_error.mayko", # {{{
2314 5.5794667 60.4280897
2317 5.5802255 60.4281867
2327 "Strip error from mayko format in ygraph output",
2333 # Strip error from Mayko format }}}
2338 if ($Opt{'all'} || $Opt{'todo'}) {
2339 diag
("Running TODO tests..."); # {{{
2342 local $TODO = "Fix read/write of GPX name element";
2343 testcmd
("../gpst -o gpx pause.gpx", # {{{
2347 <name>ACTIVE LOG164705</name>
2349 <trkpt lat="60.425494" lon="5.299534"> <ele>25.26</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
2350 <trkpt lat="60.425464" lon="5.29961"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
2351 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
2352 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
2353 <trkpt lat="60.425339" lon="5.299958"> <ele>30.98</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
2354 <trkpt lat="60.425238" lon="5.29964"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
2355 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
2356 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
2357 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
2363 "Read and write name element from/to GPX",
2368 local $TODO = "Remove extra \\n in the beginning";
2369 testcmd
("../gpst -o csv multitrack.gpx", # {{{
2371 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
2372 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
2373 2003-02-11T23:36:14Z\t-0.1453202\t51.496904\t\t
2375 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
2376 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
2377 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
2378 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
2380 2003-02-11T23:37:05Z\t-0.1458608\t51.497068\t\t
2381 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
2382 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
2384 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
2385 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
2386 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
2387 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
2388 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
2391 "Output csv format from multitrack.gpx",
2396 testcmd
("../gpst -o csv pause.gpx", # {{{
2398 2006-05-21T16:49:11Z\t5.299534\t60.425494\t25.26\t
2399 2006-05-21T16:49:46Z\t5.29961\t60.425464\t24.931\t
2400 2006-05-21T16:52:04Z\t5.299694\t60.425314\t27.975\t
2401 2006-05-21T16:56:36Z\t5.299741\t60.425384\t31.017\t
2402 2006-05-21T16:56:47Z\t5.299958\t60.425339\t30.98\t
2403 2006-05-21T16:56:56Z\t5.29964\t60.425238\t30.538\t
2404 2006-05-21T16:57:03Z\t5.299686\t60.425246\t30.515\t
2405 2006-05-21T16:59:08Z\t5.299773\t60.425345\t31.936\t
2406 2006-05-21T17:00:54Z\t5.299419\t60.425457\t31.794\t
2409 "Output csv format from pause.gpx",
2414 testcmd
("../gpst -e -o csv pause.gpx", # {{{
2416 1148230151\t5.299534\t60.425494\t25.26\t
2417 1148230186\t5.29961\t60.425464\t24.931\t
2418 1148230324\t5.299694\t60.425314\t27.975\t
2419 1148230596\t5.299741\t60.425384\t31.017\t
2420 1148230607\t5.299958\t60.425339\t30.98\t
2421 1148230616\t5.29964\t60.425238\t30.538\t
2422 1148230623\t5.299686\t60.425246\t30.515\t
2423 1148230748\t5.299773\t60.425345\t31.936\t
2424 1148230854\t5.299419\t60.425457\t31.794\t
2427 "csv format with epoch seconds from gpx",
2432 $TODO = "Tweak output";
2433 testcmd
("../gpst -o gpx multitrack-pause.gpsml", # {{{
2434 file_data
("multitrack-pause.gpx"),
2436 "Should be equal to multitrack-pause.gpx",
2445 diag
("Testing finished.");
2449 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc, $is_gpx) = @_;
2450 my $stderr_cmd = "";
2451 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2458 my $TMP_STDERR = "gpst-stderr.tmp";
2459 my $TMP_STDOUT = "gpst-stdout.tmp";
2460 defined($is_gpx) || die("$progname: testcmd(): $Desc: \$is_gpx not defined\n");
2462 if (defined($Exp_stderr) && !length($deb_str)) {
2463 $stderr_cmd = " 2>$TMP_STDERR";
2465 system("$Cmd$deb_str$stderr_cmd >$TMP_STDOUT");
2466 is
(file_data
($TMP_STDOUT), $Exp_stdout, $Txt);
2468 validate_gpx
($TMP_STDOUT, $Desc);
2470 if (defined($Exp_stderr)) {
2471 if (!length($deb_str)) {
2472 is
(file_data
($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
2473 unlink($TMP_STDERR);
2476 diag
("Warning: stderr not defined for '$Txt'");
2478 unlink($TMP_STDOUT);
2484 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2485 my $stderr_cmd = "";
2486 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2493 my $TMP_STDERR = "gpst-stderr.tmp";
2495 if (defined($Exp_stderr) && !length($deb_str)) {
2496 $stderr_cmd = " 2>$TMP_STDERR";
2498 like
(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt);
2499 if (defined($Exp_stderr)) {
2500 if (!length($deb_str)) {
2501 like
(file_data
($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)");
2502 unlink($TMP_STDERR);
2505 diag
("Warning: stderr not defined for '$Txt'");
2511 # Return file content as a string {{{
2514 if (open(my $fp, "<", $File)) {
2515 $Txt = join("", <$fp>);
2525 # Check that a file is valid GPX {{{
2526 my ($File, $Txt) = @_;
2527 my $TMP_VALID = "validate_result.tmp";
2528 my $Result = system("xmllint --noout --schema ../Tools/xsd/gpx/gpx-1.1.xsd $File 2>$TMP_VALID");
2529 is
($Result, 0, "GPX for \"$Txt\" validates");
2531 diag
(file_data
($TMP_VALID));
2538 # Print program version {{{
2539 print("$progname v$VERSION\n");
2544 # Send the help message to stdout {{{
2547 if ($Opt{'verbose'}) {
2553 Usage: $progname [options] [file [files [...]]]
2555 Contains tests for the gpst(1) program.
2560 Run all tests, also TODOs.
2564 Run only the TODO tests.
2566 Increase level of verbosity. Can be repeated.
2568 Print version information.
2570 Print debugging messages.
2578 # Print a status message to stderr based on verbosity level {{{
2579 my ($verbose_level, $Txt) = @_;
2581 if ($Opt{'verbose'} >= $verbose_level) {
2582 print(STDERR
"$progname: $Txt\n");
2589 # Plain Old Documentation (POD) {{{
2599 run-tests.pl [options] [file [files [...]]]
2603 Contains tests for the gpst(1) program.
2609 =item B<-a>, B<--all>
2611 Run all tests, also TODOs.
2613 =item B<-h>, B<--help>
2615 Print a brief help summary.
2617 =item B<-t>, B<--todo>
2619 Run only the TODO tests.
2621 =item B<-v>, B<--verbose>
2623 Increase level of verbosity. Can be repeated.
2627 Print version information.
2631 Print debugging messages.
2637 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
2641 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
2642 This is free software; see the file F<COPYING> for legalese stuff.
2646 This program is free software: you can redistribute it and/or modify it
2647 under the terms of the GNU General Public License as published by the
2648 Free Software Foundation, either version 3 of the License, or (at your
2649 option) any later version.
2651 This program is distributed in the hope that it will be useful, but
2652 WITHOUT ANY WARRANTY; without even the implied warranty of
2653 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2654 See the GNU General Public License for more details.
2656 You should have received a copy of the GNU General Public License along
2658 If not, see L<http://www.gnu.org/licenses/>.
2668 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :