3 #=======================================================================
5 # Test suite for gpst(1).
8 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
9 # License: GNU General Public License version 2 or later, see end of
10 # file for legal stuff.
11 #=======================================================================
14 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
16 use Test
::More
qw{no_plan
};
44 $progname =~ s/^.*\/(.*?)$/$1/;
47 my $id_date = $rcs_id;
48 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
50 push(@main::version_array
, $rcs_id);
52 my @cmdline_array = @ARGV;
54 Getopt
::Long
::Configure
("bundling");
57 "all|a" => \
$Opt{'all'},
58 "debug" => \
$Opt{'debug'},
59 "help|h" => \
$Opt{'help'},
60 "todo|t" => \
$Opt{'todo'},
61 "verbose|v+" => \
$Opt{'verbose'},
62 "version" => \
$Opt{'version'},
64 ) || die("$progname: Option error. Use -h for help.\n");
67 'gpsbabel' => 'gpsbabel',
70 $Opt{'debug'} && ($Debug = 1);
71 $Opt{'help'} && usage
(0);
72 if ($Opt{'version'}) {
77 diag
(sprintf("========== Executing \"%s%s%s\" ==========",
79 scalar(@cmdline_array) ?
" " : "",
80 join(" ", @cmdline_array)));
82 chomp(my $gpx_header = <<END);
83 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
86 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
87 xmlns="http://www.topografix.com/GPX/1/1"
88 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
89 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
92 my $stripped_gpx_header = $gpx_header;
93 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
95 if ($Opt{'todo'} && !$Opt{'all'}) {
101 testcmd("$CMD command", # {{{
113 diag
("Testing conversion routines...");
115 # txt_to_xml() and xml_to_txt() {{{
117 is
(txt_to_xml
("abc"),
119 "txt_to_xml(\"abc\")");
120 is
(txt_to_xml
("<&>"),
122 "txt_to_xml(\"<&>\")");
123 is
(txt_to_xml
("first line\nsecond <\rthird\r\n<&>"),
124 "first line\nsecond <\rthird\r\n<&>",
125 "txt_to_xml() with multiline string");
127 is
(xml_to_txt
("abc"),
129 "xml_to_txt(\"abc\")");
130 is
(xml_to_txt
("<&>"),
132 "xml_to_txt(\"<&>\")");
133 is
(xml_to_txt
("first line\nsecond <\rthird\r\n<&>"),
134 "first line\nsecond <\rthird\r\n<&>",
135 "xml_to_txt() with multiline string");
137 # txt_to_xml() and xml_to_txt() }}}
138 # postgresql_copy_safe() {{{
140 is
(postgresql_copy_safe
(""),
142 "postgresql_copy_safe() with empty string");
144 is
(postgresql_copy_safe
("abcæøåÆØÅ"),
146 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
148 is
(postgresql_copy_safe
("abc\t'\r\n"),
150 "postgresql_copy_safe(\"abc\\t'\\r\\n\")");
152 is
(postgresql_copy_safe
("¤%/&gurgle\t325\\wer\ndfv'\r!\"#\n%\twe\r\x00sdf\xFFsadc\n\t\x00sdc\n"),
153 "¤%/&gurgle\\t325\\\\wer\\ndfv'\\r!\"#\\n%\\twe\\r\x00sdf\xFFsadc\\n\\t\x00sdc\\n",
154 "postgresql_copy_safe() with multiline, nulls and stuff");
156 # postgresql_copy_safe() }}}
158 diag
("Testing date routines...");
160 # sec_to_string() {{{
162 is
(sec_to_string
(1148220825),
163 "2006-05-21 14:13:45",
164 "sec_to_string() without separator");
165 is
(sec_to_string
(1148220825, "T"),
166 "2006-05-21T14:13:45",
167 "sec_to_string() with separator");
168 is
(sec_to_string
(-5000),
170 "sec_to_string(-5000) — negative numbers unsupported atm");
171 is
(sec_to_string
(""),
173 "sec_to_string(\"\")");
174 is
(sec_to_string
("pH()rtY tW0"),
176 "sec_to_string() with invalid string");
177 is
(sec_to_string
("00000000000000000000001148220825"),
178 "2006-05-21 14:13:45",
179 "sec_to_string() with a bunch of leading zeros");
180 is
(sec_to_string
("1148220825.93"),
181 "2006-05-21 14:13:45.93",
182 "sec_to_string() with decimals");
183 is
(sec_to_string
("000000000000000000000000000001148220825.7312"),
184 "2006-05-21 14:13:45.7312",
185 "sec_to_string() with decimals and prefixing zeros");
186 is
(sec_to_string
("1148220825.93000"),
187 "2006-05-21 14:13:45.93",
188 "sec_to_string() with decimals and extra trailing zeros");
189 is
(sec_to_string
(".863"),
190 "1970-01-01 00:00:00.863",
191 "sec_to_string() with missing zero before decimal point");
193 # sec_to_string() }}}
194 # sec_to_readable() {{{
196 is
(sec_to_readable
(0),
198 "sec_to_readable(0)");
199 is
(sec_to_readable
("pH()rtY tW0"),
201 "sec_to_readable() with invalid string");
202 is
(sec_to_readable
(86400),
204 "sec_to_readable(86400)");
205 is
(sec_to_readable
(86400*1000),
207 "sec_to_readable(86400*1000)");
208 is
(sec_to_readable
(86400+7200+180+4),
210 "sec_to_readable(86400+7200+180+4)");
211 is
(sec_to_readable
("3.14"),
213 "sec_to_readable(\"3.14\")");
214 is
(sec_to_readable
("-124"),
216 "sec_to_readable() rejects negative numbers");
217 is
(sec_to_readable
("-2.34"),
219 "sec_to_readable() rejects negative decimal");
220 is
(sec_to_readable
(".87"),
222 "sec_to_readable(), missing zero before decimal point");
223 is
(sec_to_readable
(""),
225 "sec_to_readable() with empty string");
227 # sec_to_readable() }}}
229 diag
("Testing geo routines...");
233 is
(ddd_to_dms
("12.34567"),
235 "ddd_to_dms(\"12.34567\")");
239 "ddd_to_dms(\"0\")");
245 is
(ddd_to_dms
("pH()rtY tW0"),
247 "ddd_to_dms(\"pH()rtY tW0\")");
249 is
(ddd_to_dms
("-12.34567"),
251 "ddd_to_dms(\"-12.34567\")");
253 is
(ddd_to_dms
("0.34567"),
255 "ddd_to_dms(\"0.34567\")");
257 is
(ddd_to_dms
(".34567"),
259 "ddd_to_dms(\".34567\")");
261 is
(ddd_to_dms
("-.34567"),
263 "ddd_to_dms(\"-.34567\")");
265 is
(ddd_to_dms
("-0.34567"),
267 "ddd_to_dms(\"-0.34567\")");
269 is
(ddd_to_dms
("180"),
271 "ddd_to_dms(\"180\")");
273 is
(ddd_to_dms
("-180"),
275 "ddd_to_dms(\"-180\")");
279 "ddd_to_dms(\"-1\")");
281 is
(ddd_to_dms
("2-3"),
283 "ddd_to_dms(\"2-3\")");
287 diag
("Testing trackpoint()..."); # {{{
293 "trackpoint() receives empty hash");
312 # trackpoint() (gpsml) {{{
316 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
317 "trackpoint() (gpsml)"
320 # trackpoint() (gpsml) }}}
321 # trackpoint() (gpx) {{{
323 $Dat{'format'} = "gpx";
326 qq{ <trkpt lat
="59.5214" lon
="7.392133"> <ele
>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt
>\n},
330 # trackpoint() (gpx) }}}
332 # trackpoint(): Various loop tests {{{
334 for my $Elem (qw{format lat lon what
}) {
337 $Dat{"$Elem"} = '2d';
340 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
345 for my $Elem (qw{year month day hour min sec
}) {
352 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
353 "trackpoint(): {'$Elem'} with empty value skips time"
357 $Dat{"$Elem"} = '2d';
359 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
360 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") skips time"
364 $Dat{$Elem} = "00000$Dat{$Elem}";
366 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
367 "trackpoint(): Strip prefixing zeros from {'$Elem'}"
371 $Dat{"$Elem"} = 0-$Dat{$Elem};
373 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
374 "trackpoint(): {'$Elem'} is negative, skip time"
377 if ($Elem ne "sec") {
379 $Dat{"$Elem"} = "$Dat{$Elem}.00";
381 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
382 "trackpoint(): Decimals in {'$Elem'}, skip time"
390 $Dat{'sec'} = "$Dat{'sec'}.00";
392 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
393 "trackpoint(): Remove trailing zeros in {'sec'} decimals"
396 for my $Elem (qw{format what error
}) {
401 "trackpoint(): Missing {'$Elem'}, return undef"
405 # Various loop tests }}}
409 diag
("Testing output from ../gpst");
411 diag
("Read empty input (/dev/null)..."); # {{{
412 testcmd
("../gpst </dev/null", # {{{
414 <?xml version="1.0" encoding="UTF-8"?>
421 "Read from /dev/null",
425 testcmd
("../gpst -o gpx </dev/null", # {{{
435 "Output gpx from /dev/null",
440 diag
("Read empty files..."); # {{{
441 testcmd
("echo '<tp> </tp>' | ../gpst", # {{{
443 <?xml version="1.0" encoding="UTF-8"?>
450 "Don’t print empty trackpoints",
454 # Read empty files }}}
455 diag
("Testing --chronology option..."); # {{{
456 testcmd
("../gpst --chronology chronology-error.gpsml", # {{{
458 <?xml version="1.0" encoding="UTF-8"?>
461 <title>Chronology errors</title>
462 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
463 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
464 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
466 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
468 <pause>0:00:37:54</pause>
469 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
470 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
471 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
472 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
473 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
474 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
478 "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" .
479 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
480 "Check for chronology errors and duplicated times",
484 # --chronology option }}}
485 diag
("Testing --skip-dups option..."); # {{{
486 testcmd
("../gpst -d no_signal.mayko", # {{{
488 <?xml version="1.0" encoding="UTF-8"?>
491 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
492 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
493 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
494 <etp err="dup"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
495 <etp err="dup"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
496 <etp err="dup"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
497 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
498 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
499 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
504 "Remove duplicated positions from gpsml",
508 testcmd
("../gpst -d -o csv no_signal.mayko", # {{{
510 2002-12-22T21:42:24Z\t23.6746151\t70.6800486\t\t
511 2002-12-22T21:42:32Z\t23.6740038\t70.6799322\t\t
512 2002-12-22T21:42:54Z\t23.6723991\t70.6796266\t\t
513 2002-12-22T21:44:45Z\t23.6757566\t70.6800774\t\t
514 2002-12-22T21:44:52Z\t23.6753442\t70.6801502\t\t
515 2002-12-22T21:45:04Z\t23.6757542\t70.6801905\t\t
518 "Remove duplicated positions from csv output format",
522 testcmd
("../gpst -d -o clean no_signal.mayko", # {{{
524 23.6746151\t70.6800486\t
525 23.6740038\t70.6799322\t
526 23.6723991\t70.6796266\t
527 23.6757566\t70.6800774\t
528 23.6753442\t70.6801502\t
529 23.6757542\t70.6801905\t
532 "Remove duplicated positions from clean output format",
536 testcmd
("../gpst -d -o pgtab no_signal.mayko", # {{{
538 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N\t\\N
539 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N\t\\N
540 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
541 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N\t\\N
542 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N\t\\N
543 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N\t\\N
546 "Remove duplicated positions from pgtab output format",
550 # --skip-dups option }}}
551 diag
("Testing --epoch option..."); # {{{
552 testcmd
("../gpst -e pause.gpx", # {{{
554 <?xml version="1.0" encoding="UTF-8"?>
557 <title>ACTIVE LOG164705</title>
558 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
559 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
560 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
561 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
562 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
563 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
564 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
565 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
566 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
571 "--epoch is ignored in gpsml output",
575 testcmd
("../gpst -e -o gpx pause.gpx", # {{{
579 <name>ACTIVE LOG164705</name>
581 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
582 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
583 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
584 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
585 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
586 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
587 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
588 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
589 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
595 "--epoch is ignored in gpx output",
600 diag
("Testing --fix option..."); # {{{
601 testcmd
("../gpst --fix --chronology chronology-error.gpsml", # {{{
603 <?xml version="1.0" encoding="UTF-8"?>
606 <title>Chronology errors</title>
607 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
608 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
609 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
611 <etp err="chrono"> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </etp>
613 <pause>0:00:37:54</pause>
614 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
615 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
616 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
617 <etp err="duptime"> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </etp>
618 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
619 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
623 "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" .
624 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
625 "Remove bad timestamps",
630 diag
("Testing --from-date option..."); # {{{
631 # --from-date option }}}
632 diag
("Testing -h (--help) option...");
633 likecmd
("$CMD -h", # {{{
634 '/ Show this help\./',
636 "Option -h prints help screen",
640 ok
(`$CMD -h` !~ /\$Id: /s, "\"$CMD -h\" - No Id with only -h");
642 diag
("Testing --inside option..."); # {{{
643 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx", # {{{
645 <?xml version="1.0" encoding="UTF-8"?>
648 <title>track1</title>
650 <title>track2</title>
651 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
652 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
653 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
654 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
656 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
658 <title>track3</title>
659 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
660 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
661 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
666 "Check --inside option (gpx to gpst)",
670 # --inside option }}}
671 diag
("Testing --undefined option..."); # {{{
672 # --undefined option }}}
673 diag
("Testing --near option..."); # {{{
675 diag
("Testing --output option..."); # {{{
677 testcmd
("../gpst log.mcsv", # {{{
679 <?xml version="1.0" encoding="UTF-8"?>
683 <title>ACTIVE LOG 125</title>
684 <tp> <time>2006-03-04T11:12:30Z</time> <lat>54.96883</lat> <lon>-1.62439</lon> <ele>77</ele> </tp>
685 <tp> <time>2006-03-04T11:12:47Z</time> <lat>54.96878</lat> <lon>-1.62413</lon> <ele>77</ele> </tp>
686 <tp> <time>2006-03-04T11:12:55Z</time> <lat>54.96913</lat> <lon>-1.62616</lon> <ele>77</ele> </tp>
687 <tp> <time>2006-03-04T11:13:04Z</time> <lat>54.96934</lat> <lon>-1.62624</lon> <ele>77.5</ele> </tp>
688 <tp> <time>2006-03-04T11:13:33Z</time> <lat>54.96934</lat> <lon>-1.62596</lon> <ele>78</ele> </tp>
689 <tp> <time>2006-03-04T11:13:48Z</time> <lat>54.96931</lat> <lon>-1.62645</lon> <ele>78</ele> </tp>
690 <tp> <time>2006-03-04T11:14:05Z</time> <lat>54.96918</lat> <lon>-1.62603</lon> <ele>79</ele> </tp>
691 <tp> <time>2006-03-04T11:14:33Z</time> <lat>54.96901</lat> <lon>-1.62364</lon> <ele>76.1</ele> </tp>
692 <tp> <time>2006-03-04T11:15:02Z</time> <lat>54.96922</lat> <lon>-1.6254</lon> <ele>76.1</ele> </tp>
693 <tp> <time>2006-03-04T11:15:27Z</time> <lat>54.96914</lat> <lon>-1.62526</lon> <ele>75.1</ele> </tp>
694 <tp> <time>2006-03-04T11:15:50Z</time> <lat>54.96911</lat> <lon>-1.62494</lon> <ele>75.1</ele> </tp>
695 <tp> <time>2006-03-04T11:16:03Z</time> <lat>54.9693</lat> <lon>-1.62489</lon> <ele>75.1</ele> </tp>
696 <tp> <time>2006-03-04T11:16:19Z</time> <lat>54.96901</lat> <lon>-1.62496</lon> <ele>75.1</ele> </tp>
697 <tp> <time>2006-03-04T11:16:52Z</time> <lat>54.96871</lat> <lon>-1.62466</lon> <ele>74.6</ele> </tp>
698 <tp> <time>2006-03-04T11:17:25Z</time> <lat>54.96908</lat> <lon>-1.62488</lon> <ele>72.7</ele> </tp>
700 <title>ACTIVE LOG 126</title>
701 <tp> <time>2006-03-04T11:18:32Z</time> <lat>54.96904</lat> <lon>-1.62482</lon> <ele>72.7</ele> </tp>
702 <tp> <time>2006-03-04T11:18:35Z</time> <lat>54.96913</lat> <lon>-1.62499</lon> <ele>71.3</ele> </tp>
703 <tp> <time>2006-03-04T11:18:38Z</time> <lat>54.96904</lat> <lon>-1.62497</lon> <ele>70.8</ele> </tp>
704 <tp> <time>2006-03-04T11:18:48Z</time> <lat>54.96913</lat> <lon>-1.62496</lon> <ele>71.8</ele> </tp>
705 <tp> <time>2006-03-04T11:18:55Z</time> <lat>54.96924</lat> <lon>-1.62501</lon> <ele>72.2</ele> </tp>
706 <tp> <time>2006-03-04T11:19:11Z</time> <lat>54.9694</lat> <lon>-1.62521</lon> <ele>71.8</ele> </tp>
707 <tp> <time>2006-03-04T11:19:30Z</time> <lat>54.96916</lat> <lon>-1.62515</lon> <ele>71.3</ele> </tp>
708 <tp> <time>2006-03-04T11:19:53Z</time> <lat>54.96921</lat> <lon>-1.625</lon> <ele>71.3</ele> </tp>
709 <tp> <time>2006-03-04T11:20:21Z</time> <lat>54.96801</lat> <lon>-1.62417</lon> <ele>71.8</ele> </tp>
711 <title>ACTIVE LOG 127</title>
712 <tp> <time>2006-03-04T11:21:16Z</time> <lat>54.96887</lat> <lon>-1.62504</lon> <ele>70.8</ele> </tp>
713 <tp> <time>2006-03-04T11:21:18Z</time> <lat>54.96898</lat> <lon>-1.62476</lon> <ele>69.8</ele> </tp>
714 <tp> <time>2006-03-04T11:21:29Z</time> <lat>54.9691</lat> <lon>-1.62475</lon> <ele>69.4</ele> </tp>
715 <tp> <time>2006-03-04T11:21:46Z</time> <lat>54.96918</lat> <lon>-1.62468</lon> <ele>70.3</ele> </tp>
716 <tp> <time>2006-03-04T11:22:39Z</time> <lat>54.9692</lat> <lon>-1.62465</lon> <ele>69.4</ele> </tp>
717 <tp> <time>2006-03-04T11:22:43Z</time> <lat>54.96924</lat> <lon>-1.62462</lon> <ele>71.8</ele> </tp>
718 <tp> <time>2006-03-04T11:22:45Z</time> <lat>54.96928</lat> <lon>-1.62463</lon> <ele>71.8</ele> </tp>
719 <tp> <time>2006-03-04T11:23:00Z</time> <lat>54.96945</lat> <lon>-1.62466</lon> <ele>69.4</ele> </tp>
724 "Read Mapsource TAB-separated format",
728 testcmd
("../gpst two-digit_year.mcsv", # {{{
730 <?xml version="1.0" encoding="UTF-8"?>
734 <title>ACTIVE LOG 032</title>
735 <tp> <time>2006-03-20T20:35:33Z</time> <lat>60.41324</lat> <lon>5.33352</lon> <ele>14</ele> </tp>
736 <tp> <time>2006-03-20T20:35:38Z</time> <lat>60.38802</lat> <lon>5.33845</lon> <ele>18</ele> </tp>
737 <tp> <time>2006-03-20T20:35:44Z</time> <lat>60.38709</lat> <lon>5.3379</lon> <ele>19</ele> </tp>
738 <tp> <time>2006-03-20T20:35:49Z</time> <lat>60.38641</lat> <lon>5.33732</lon> <ele>18</ele> </tp>
739 <tp> <time>2006-03-20T20:35:54Z</time> <lat>60.38581</lat> <lon>5.33647</lon> <ele>18</ele> </tp>
740 <tp> <time>2006-03-20T20:36:00Z</time> <lat>60.38516</lat> <lon>5.33528</lon> <ele>15</ele> </tp>
741 <tp> <time>2006-03-20T20:36:02Z</time> <lat>60.38495</lat> <lon>5.3349</lon> <ele>13</ele> </tp>
746 "Read Mapsource TAB-separated format with two-digit year",
750 testcmd
("../gpst log.gpstxt", # {{{
752 <?xml version="1.0" encoding="UTF-8"?>
755 <tp> <time>2003-06-13T14:36:09Z</time> <lat>59.521517</lat> <lon>7.391867</lon> <ele>762</ele> </tp>
756 <tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>
757 <tp> <time>2003-06-13T14:36:11Z</time> <lat>59.5213</lat> <lon>7.392417</lon> <ele>761</ele> </tp>
758 <tp> <time>2003-06-13T14:36:12Z</time> <lat>59.521183</lat> <lon>7.3927</lon> <ele>761</ele> </tp>
759 <etp err="nosignal"> <time>2003-06-13T14:36:13Z</time> </etp>
760 <tp> <time>2003-06-13T14:36:15Z</time> <lat>59.52085</lat> <lon>7.393517</lon> <ele>760</ele> </tp>
761 <tp> <time>2003-06-13T14:36:16Z</time> <lat>59.520733</lat> <lon>7.393783</lon> <ele>760</ele> </tp>
762 <tp> <time>2003-06-13T14:36:17Z</time> <lat>59.52065</lat> <lon>7.39405</lon> <ele>760</ele> </tp>
763 <tp> <time>2003-06-13T14:36:18Z</time> <lat>59.520583</lat> <lon>7.394333</lon> <ele>760</ele> </tp>
764 <tp> <time>2003-06-13T14:36:19Z</time> <lat>59.520533</lat> <lon>7.394633</lon> <ele>759</ele> </tp>
765 <tp> <time>2003-06-13T14:36:20Z</time> <lat>59.520483</lat> <lon>7.394917</lon> <ele>759</ele> </tp>
766 <tp> <time>2003-06-13T14:36:21Z</time> <lat>59.520433</lat> <lon>7.395233</lon> <ele>759</ele> </tp>
767 <etp err="nosignal"> <time>2003-06-13T14:36:22Z</time> </etp>
768 <tp> <time>2003-06-13T14:36:24Z</time> <lat>59.520283</lat> <lon>7.396233</lon> <ele>758</ele> </tp>
769 <tp> <time>2003-06-13T14:36:25Z</time> <lat>59.520233</lat> <lon>7.39655</lon> <ele>758</ele> </tp>
770 <tp> <time>2003-06-13T14:36:26Z</time> <lat>59.520183</lat> <lon>7.396883</lon> <ele>757</ele> </tp>
771 <tp> <time>2003-06-13T14:36:27Z</time> <lat>59.520133</lat> <lon>7.397217</lon> <ele>757</ele> </tp>
772 <tp> <time>2003-06-13T14:36:28Z</time> <lat>59.5201</lat> <lon>7.397567</lon> <ele>757</ele> </tp>
777 "Read Garmin serial text format",
781 testcmd
("../gpst log.dos.mayko", # {{{
783 <?xml version="1.0" encoding="UTF-8"?>
786 <tp> <time>2003-06-15T10:27:45Z</time> <lat>58.1818158</lat> <lon>8.1225077</lon> </tp>
787 <tp> <time>2003-06-15T10:27:53Z</time> <lat>58.1818712</lat> <lon>8.12532</lon> </tp>
788 <tp> <time>2003-06-15T10:27:57Z</time> <lat>58.1816347</lat> <lon>8.1266031</lon> </tp>
789 <tp> <time>2003-06-15T10:28:03Z</time> <lat>58.1812099</lat> <lon>8.1284612</lon> </tp>
790 <tp> <time>2003-06-15T10:28:06Z</time> <lat>58.1810315</lat> <lon>8.129395</lon> </tp>
791 <tp> <time>2003-06-15T10:28:10Z</time> <lat>58.1809621</lat> <lon>8.13074</lon> </tp>
796 "Read DOS-formatted Mayko format",
800 testcmd
("../gpst log.dos.gpstxt", # {{{
802 <?xml version="1.0" encoding="UTF-8"?>
805 <tp> <time>2003-01-05T16:47:11Z</time> <lat>66.908167</lat> <lon>15.022983</lon> <ele>11472</ele> </tp>
806 <tp> <time>2003-01-05T16:47:12Z</time> <lat>66.90625</lat> <lon>15.020667</lon> <ele>11472</ele> </tp>
807 <tp> <time>2003-01-05T16:47:13Z</time> <lat>66.904317</lat> <lon>15.01835</lon> <ele>11472</ele> </tp>
808 <tp> <time>2003-01-05T16:47:14Z</time> <lat>66.9024</lat> <lon>15.016017</lon> <ele>11473</ele> </tp>
809 <tp> <time>2003-01-05T16:47:15Z</time> <lat>66.900483</lat> <lon>15.0137</lon> <ele>11474</ele> </tp>
810 <tp> <time>2003-01-05T16:47:16Z</time> <lat>66.898567</lat> <lon>15.011383</lon> <ele>11474</ele> </tp>
811 <tp> <time>2003-01-05T16:47:17Z</time> <lat>66.896633</lat> <lon>15.009067</lon> <ele>11475</ele> </tp>
812 <tp> <time>2003-01-05T16:47:18Z</time> <lat>66.894717</lat> <lon>15.006733</lon> <ele>11475</ele> </tp>
813 <tp> <time>2003-01-05T16:47:19Z</time> <lat>66.8928</lat> <lon>15.004417</lon> <ele>11475</ele> </tp>
814 <tp> <time>2003-01-05T16:47:20Z</time> <lat>66.890867</lat> <lon>15.0021</lon> <ele>11475</ele> </tp>
815 <tp> <time>2003-01-05T16:47:21Z</time> <lat>66.88895</lat> <lon>14.999783</lon> <ele>11475</ele> </tp>
820 "Read DOS-formatted Garmin serial text format",
824 testcmd
("../gpst log.unix.mcsv", # {{{
826 <?xml version="1.0" encoding="UTF-8"?>
830 <title>ACTIVE LOG 058</title>
831 <tp> <time>2006-02-21T15:14:25Z</time> <lat>60.36662</lat> <lon>5.24885</lon> <ele>31.9</ele> </tp>
832 <tp> <time>2006-02-21T15:14:30Z</time> <lat>60.37057</lat> <lon>5.22956</lon> <ele>35.2</ele> </tp>
833 <tp> <time>2006-02-21T15:14:35Z</time> <lat>60.37019</lat> <lon>5.22817</lon> <ele>39.6</ele> </tp>
834 <tp> <time>2006-02-21T15:14:36Z</time> <lat>60.37012</lat> <lon>5.2279</lon> <ele>41</ele> </tp>
835 <tp> <time>2006-02-21T15:14:40Z</time> <lat>60.37009</lat> <lon>5.22682</lon> <ele>47.2</ele> </tp>
836 <tp> <time>2006-02-21T15:14:42Z</time> <lat>60.37011</lat> <lon>5.22641</lon> <ele>49.2</ele> </tp>
837 <tp> <time>2006-02-21T15:14:44Z</time> <lat>60.37011</lat> <lon>5.22607</lon> <ele>50.1</ele> </tp>
838 <tp> <time>2006-02-21T15:14:48Z</time> <lat>60.37002</lat> <lon>5.22568</lon> <ele>51.1</ele> </tp>
839 <tp> <time>2006-02-21T15:14:51Z</time> <lat>60.3701</lat> <lon>5.22548</lon> <ele>52.5</ele> </tp>
844 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
848 testcmd
("../gpst multitrack.gpx", # {{{
850 <?xml version="1.0" encoding="UTF-8"?>
853 <title>Track 1</title>
854 <tp> <time>2003-02-11T23:35:39Z</time> <lat>51.4968266</lat> <lon>-0.1448824</lon> </tp>
855 <tp> <time>2003-02-11T23:35:49Z</time> <lat>51.4968227</lat> <lon>-0.1449938</lon> </tp>
856 <tp> <time>2003-02-11T23:36:14Z</time> <lat>51.496904</lat> <lon>-0.1453202</lon> </tp>
858 <title>Track 2</title>
859 <tp> <time>2003-02-11T23:36:16Z</time> <lat>51.4969214</lat> <lon>-0.1453398</lon> </tp>
860 <tp> <time>2003-02-11T23:36:31Z</time> <lat>51.4969816</lat> <lon>-0.1455514</lon> </tp>
861 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
862 <tp> <time>2003-02-11T23:36:50Z</time> <lat>51.4970452</lat> <lon>-0.1457804</lon> </tp>
864 <title>Track 3</title>
865 <tp> <time>2003-02-11T23:37:05Z</time> <lat>51.497068</lat> <lon>-0.1458608</lon> </tp>
866 <tp> <time>2003-02-11T23:37:22Z</time> <lat>51.4971658</lat> <lon>-0.1460047</lon> </tp>
867 <tp> <time>2003-02-11T23:37:36Z</time> <lat>51.4972469</lat> <lon>-0.1461614</lon> </tp>
869 <title>Track 4</title>
870 <tp> <time>2003-02-11T23:37:43Z</time> <lat>51.4972731</lat> <lon>-0.1462394</lon> </tp>
871 <tp> <time>2003-02-11T23:38:04Z</time> <lat>51.4973437</lat> <lon>-0.1463232</lon> </tp>
872 <tp> <time>2003-02-11T23:38:28Z</time> <lat>51.4973337</lat> <lon>-0.1462949</lon> </tp>
873 <tp> <time>2003-02-11T23:38:34Z</time> <lat>51.4973218</lat> <lon>-0.1462825</lon> </tp>
874 <tp> <time>2003-02-11T23:38:35Z</time> <lat>51.4973145</lat> <lon>-0.1462732</lon> </tp>
879 "Read GPX file with multiple tracks",
883 testcmd
("../gpst compact.gpx", # {{{
885 <?xml version="1.0" encoding="UTF-8"?>
888 <title>All whitespace stripped</title>
889 <tp> <time>2002-12-30T15:22:04Z</time> <lat>70.660932</lat> <lon>23.7028354</lon> </tp>
890 <tp> <time>2002-12-30T15:22:06Z</time> <lat>70.6609392</lat> <lon>23.7028468</lon> </tp>
891 <tp> <time>2002-12-30T15:22:08Z</time> <lat>70.6609429</lat> <lon>23.7028499</lon> </tp>
892 <tp> <time>2002-12-30T15:22:11Z</time> <lat>70.6609381</lat> <lon>23.702862</lon> </tp>
893 <tp> <time>2002-12-30T15:22:12Z</time> <lat>70.6609368</lat> <lon>23.7028648</lon> </tp>
894 <tp> <time>2002-12-30T15:22:13Z</time> <lat>70.6609344</lat> <lon>23.7028652</lon> </tp>
895 <tp> <time>2002-12-30T15:22:15Z</time> <lat>70.6609349</lat> <lon>23.7028707</lon> </tp>
896 <tp> <time>2002-12-30T15:22:17Z</time> <lat>70.6609348</lat> <lon>23.7028654</lon> </tp>
897 <tp> <time>2002-12-30T15:22:19Z</time> <lat>70.6609347</lat> <lon>23.7028599</lon> </tp>
898 <tp> <time>2002-12-30T15:22:20Z</time> <lat>70.6609348</lat> <lon>23.7028609</lon> </tp>
899 <tp> <time>2002-12-30T15:22:23Z</time> <lat>70.6609388</lat> <lon>23.7028653</lon> </tp>
900 <tp> <time>2002-12-30T15:22:25Z</time> <lat>70.6609426</lat> <lon>23.7028732</lon> </tp>
905 "Read GPX one-liner",
909 testcmd
("../gpst missing.gpsml", # {{{
911 <?xml version="1.0" encoding="UTF-8"?>
914 <title>Missing various elements</title>
915 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
916 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
917 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
918 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
919 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
920 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
921 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
922 <tp> <ele>486</ele> </tp>
923 <tp> <desc>Missing everything</desc> </tp>
924 <tp> <lat>60.42339</lat> </tp>
925 <tp> <lon>5.34262</lon> </tp>
926 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
927 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
932 "Read gpsml with various data missing",
936 testcmd
("../gpst different_dateformats.gpsml", # {{{
938 <?xml version="1.0" encoding="UTF-8"?>
941 <title>Date format variations</title>
942 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1</lat> <lon>1</lon> </tp>
943 <tp> <time>2006-01-01T00:00:02Z</time> <lat>2</lat> <lon>2</lon> </tp>
944 <tp> <time>2006-01-01T00:00:03Z</time> <lat>3</lat> <lon>3</lon> </tp>
945 <tp> <time>2006-01-01T00:00:04Z</time> <lat>4</lat> <lon>4</lon> </tp>
950 "Read different date formats from gpsml file",
954 testcmd
("../gpst multitrack-pause.gpx", # {{{
955 file_data
("multitrack-pause.gpsml"),
957 "Should be equal to multitrack-pause.gpsml",
962 testcmd
("../gpst -o gpx no_signal.mayko", # {{{
967 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
968 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
969 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
970 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> </trkpt>
971 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> </trkpt>
972 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> </trkpt>
973 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
974 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
975 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
981 "Output GPX from Mayko file with duplicates",
985 testcmd
("../gpst -o gpx comments.mayko", # {{{
990 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
991 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
992 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
993 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
994 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
995 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
996 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
999 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1000 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1006 "Output GPX from Mayko file with commented-out lines",
1010 testcmd
("../gpst -o gpx missing.gpsml", # {{{
1014 <name>Missing various elements</name>
1016 <trkpt lat="60.42353" lon="5.34185"> <time>2006-04-30T17:17:09Z</time> </trkpt>
1017 <trkpt> <ele>483</ele> <time>2006-04-30T17:17:11Z</time> </trkpt>
1018 <trkpt> <ele>485</ele> <time>2006-04-30T17:17:22Z</time> </trkpt>
1019 <trkpt lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
1020 <trkpt> <ele>484</ele> </trkpt>
1021 <trkpt> <ele>486</ele> </trkpt>
1022 <trkpt> <ele>490</ele> <time>2006-04-30T17:18:03Z</time> </trkpt>
1023 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
1029 "Output GPX from gpsml with missing data",
1034 testcmd
("../gpst -o xgraph multitrack.gpx", # {{{
1036 -0.1448824 51.4968266
1037 -0.1449938 51.4968227
1038 -0.1453202 51.4969040
1039 move -0.1453398 51.4969214
1040 -0.1455514 51.4969816
1041 -0.1457489 51.4970224
1042 -0.1457804 51.4970452
1043 move -0.1458608 51.4970680
1044 -0.1460047 51.4971658
1045 -0.1461614 51.4972469
1046 move -0.1462394 51.4972731
1047 -0.1463232 51.4973437
1048 -0.1462949 51.4973337
1049 -0.1462825 51.4973218
1050 -0.1462732 51.4973145
1053 "Output xgraph format from GPX",
1058 testcmd
("../gpst -o pgtab compact.gpx", # {{{
1060 2002-12-30T15:22:04Z\t(70.6609320,23.7028354)\t\\N\t\\N\t\\N\t\\N\t\\N
1061 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N\t\\N
1062 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N\t\\N
1063 2002-12-30T15:22:11Z\t(70.6609381,23.7028620)\t\\N\t\\N\t\\N\t\\N\t\\N
1064 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N\t\\N
1065 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N\t\\N
1066 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N\t\\N
1067 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N\t\\N
1068 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N\t\\N
1069 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N\t\\N
1070 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N\t\\N
1071 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N\t\\N
1074 "Output pgtab from gpx format",
1078 testcmd
("../gpst -o pgtab no_signal.mayko", # {{{
1080 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N\t\\N
1081 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N\t\\N
1082 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1083 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1084 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1085 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1086 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N\t\\N
1087 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N\t\\N
1088 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N\t\\N
1091 "Output pgtab from mayko format",
1095 testcmd
("../gpst -o pgtab missing.gpsml", # {{{
1097 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N\t\\N
1098 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N\t\\N
1099 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N\t\\N
1102 "Output pgtab from missing.gpsml",
1107 testcmd
("../gpst -o csv log.dos.mayko", # {{{
1109 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1110 2003-06-15T10:27:53Z\t8.1253200\t58.1818712\t\t
1111 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1112 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1113 2003-06-15T10:28:06Z\t8.1293950\t58.1810315\t\t
1114 2003-06-15T10:28:10Z\t8.1307400\t58.1809621\t\t
1117 "Output csv from DOS-formatted Mayko format",
1122 testcmd
("../gpst -o pgwtab multitrack.gpx", # {{{
1124 (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
1125 (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
1126 (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
1127 (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
1128 (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
1129 (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
1132 "Test pgwtab format",
1137 testcmd
("../gpst -o pgwupd multitrack.gpx", # {{{
1140 UPDATE logg SET sted = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1141 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1144 UPDATE logg SET sted = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1145 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1148 UPDATE logg SET sted = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1149 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1152 UPDATE logg SET sted = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1153 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1156 UPDATE logg SET sted = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1157 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1160 UPDATE logg SET sted = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1161 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1165 "Test pgwupd format",
1170 testcmd
("../gpst -t -o clean pause.gpx", # {{{
1172 5.299534\t60.425494\t25.260
1173 5.299610\t60.425464\t24.931
1175 5.299694\t60.425314\t27.975
1177 5.299741\t60.425384\t31.017
1178 5.299958\t60.425339\t30.980
1179 5.299640\t60.425238\t30.538
1180 5.299686\t60.425246\t30.515
1182 5.299773\t60.425345\t31.936
1183 5.299419\t60.425457\t31.794
1186 "Output clean format with time breaks",
1194 # --output option }}}
1195 diag
("Testing --outside option..."); # {{{
1196 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx", # {{{
1198 <?xml version="1.0" encoding="UTF-8"?>
1201 <title>track1</title>
1202 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1203 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1204 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1206 <title>track2</title>
1208 <title>track3</title>
1210 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1211 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1212 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1213 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1214 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1219 "Check --outside option (gpx to gpst)",
1223 # --outside option }}}
1224 diag
("Testing --pos1 and --pos2 options..."); # {{{
1225 # --pos1 and --pos2 options }}}
1226 diag
("Testing --require option..."); # {{{
1227 testcmd
("../gpst -re multitrack.gpx", # {{{
1229 <?xml version="1.0" encoding="UTF-8"?>
1232 <title>Track 1</title>
1234 <title>Track 2</title>
1235 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1237 <title>Track 3</title>
1239 <title>Track 4</title>
1244 "Require elevation from GPX data",
1248 testcmd
("../gpst -re one_ele.dos.gpsml", # {{{
1250 <?xml version="1.0" encoding="UTF-8"?>
1253 <title>Only one point has elevation</title>
1254 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1259 "Require elevation from gpsml",
1263 testcmd
("../gpst -re missing.gpsml", # {{{
1265 <?xml version="1.0" encoding="UTF-8"?>
1268 <title>Missing various elements</title>
1269 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1270 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1271 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1272 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1273 <tp> <ele>486</ele> </tp>
1274 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1275 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1280 "Require elevation",
1284 testcmd
("../gpst -rt missing.gpsml", # {{{
1286 <?xml version="1.0" encoding="UTF-8"?>
1289 <title>Missing various elements</title>
1290 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1291 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1292 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1293 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1294 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1295 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1296 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1305 testcmd
("../gpst -rp missing.gpsml", # {{{
1307 <?xml version="1.0" encoding="UTF-8"?>
1310 <title>Missing various elements</title>
1311 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1312 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1313 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1322 testcmd
("../gpst -ret missing.gpsml", # {{{
1324 <?xml version="1.0" encoding="UTF-8"?>
1327 <title>Missing various elements</title>
1328 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1329 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1330 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1331 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1336 "Require elevation and time",
1340 testcmd
("../gpst -retp missing.gpsml", # {{{
1342 <?xml version="1.0" encoding="UTF-8"?>
1345 <title>Missing various elements</title>
1346 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1351 "Require elevation, time and position",
1355 testcmd
("../gpst -rep missing.gpsml", # {{{
1357 <?xml version="1.0" encoding="UTF-8"?>
1360 <title>Missing various elements</title>
1361 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1362 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1367 "Require elevation and position",
1371 # --require option }}}
1372 diag
("Testing --round option..."); # {{{
1373 testcmd
("../gpst -R lat=4,lon=5,ele=1 pause.gpx", # {{{
1375 <?xml version="1.0" encoding="UTF-8"?>
1378 <title>ACTIVE LOG164705</title>
1379 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1380 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1381 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1382 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1383 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1384 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1385 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1386 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1387 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1392 "--round works with lat, lon, ele from gpx",
1396 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgtab pause.gpx", # {{{
1398 2006-05-21T16:49:11Z\t(60.425,5.3)\t25.3\t\\N\t\\N\t\\N\t\\N
1399 2006-05-21T16:49:46Z\t(60.425,5.3)\t24.9\t\\N\t\\N\t\\N\t\\N
1400 2006-05-21T16:52:04Z\t(60.425,5.3)\t28\t\\N\t\\N\t\\N\t\\N
1401 2006-05-21T16:56:36Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N\t\\N
1402 2006-05-21T16:56:47Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N\t\\N
1403 2006-05-21T16:56:56Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N\t\\N
1404 2006-05-21T16:57:03Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N\t\\N
1405 2006-05-21T16:59:08Z\t(60.425,5.3)\t31.9\t\\N\t\\N\t\\N\t\\N
1406 2006-05-21T17:00:54Z\t(60.425,5.299)\t31.8\t\\N\t\\N\t\\N\t\\N
1409 "pgtab output from gpx works with --round lat, lon, ele",
1413 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwtab multitrack.gpx", # {{{
1415 (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
1416 (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
1417 (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
1418 (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
1419 (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
1420 (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
1423 "--round works with lat, lon, ele from gpx, pgwtab output",
1427 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwupd multitrack.gpx", # {{{
1430 UPDATE logg SET sted = clname(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1431 UPDATE logg SET dist = cldist(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1434 UPDATE logg SET sted = clname(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1435 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1438 UPDATE logg SET sted = clname(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1439 UPDATE logg SET dist = cldist(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1442 UPDATE logg SET sted = clname(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1443 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1446 UPDATE logg SET sted = clname(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1447 UPDATE logg SET dist = cldist(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1450 UPDATE logg SET sted = clname(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1451 UPDATE logg SET dist = cldist(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1455 "pgwupd output and --round works with lat, lon, ele from gpx",
1459 # --round option }}}
1460 diag
("Testing --short-date option..."); # {{{
1461 # --short-date option }}}
1462 diag
("Testing --save-to-file option..."); # {{{
1463 # --save-to-file option }}}
1464 diag
("Testing --create-breaks option..."); # {{{
1465 testcmd
("../gpst -t pause.gpx", # {{{
1467 <?xml version="1.0" encoding="UTF-8"?>
1470 <title>ACTIVE LOG164705</title>
1471 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1472 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1473 <pause>0:00:02:18</pause>
1474 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1475 <pause>0:00:04:32</pause>
1476 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1477 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1478 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1479 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1480 <pause>0:00:02:05</pause>
1481 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1482 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1487 "Output gpsml with <pause> elements from GPX files",
1491 testcmd
("../gpst -t multitrack-pause.gpx", # {{{
1493 <?xml version="1.0" encoding="UTF-8"?>
1496 <title>track1</title>
1497 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1498 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1499 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1501 <title>track2</title>
1502 <pause>0:23:59:58</pause>
1503 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1504 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1505 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1506 <pause>0:01:00:00</pause>
1507 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1509 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1511 <title>track3</title>
1512 <pause>1:01:00:03</pause>
1513 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1514 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1515 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1517 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1518 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1519 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1520 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1521 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1526 "Insert <pause> between gpx tracks",
1530 testcmd
("../gpst -t multitrack-pause.gpsml", # {{{
1532 <?xml version="1.0" encoding="UTF-8"?>
1535 <title>track1</title>
1536 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1537 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1538 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1540 <title>track2</title>
1541 <pause>0:23:59:58</pause>
1542 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1543 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1544 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1545 <pause>0:01:00:00</pause>
1546 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1548 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1550 <title>track3</title>
1551 <pause>1:01:00:03</pause>
1552 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1553 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1554 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1556 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1557 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1558 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1559 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1560 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1565 "Insert <pause> between gpsml titles",
1569 # --create-breaks option }}}
1570 diag
("Testing -T (--time-shift) option...");
1571 testcmd
("$CMD -T 3600 multitrack-pause.gpx", # {{{
1573 <?xml version="1.0" encoding="UTF-8"?>
1576 <title>track1</title>
1577 <tp> <time>2006-01-01T01:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1578 <tp> <time>2006-01-01T01:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1579 <tp> <time>2006-01-01T01:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1581 <title>track2</title>
1582 <tp> <time>2006-01-02T01:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1583 <tp> <time>2006-01-02T01:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1584 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1585 <tp> <time>2006-01-02T02:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1587 <tp> <time>2006-01-02T02:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1589 <title>track3</title>
1590 <tp> <time>2006-01-03T03:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1591 <tp> <time>2006-01-03T03:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1592 <tp> <time>2006-01-03T03:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1594 <tp> <time>2006-01-03T03:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1595 <tp> <time>2006-01-03T03:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1596 <tp> <time>2006-01-03T03:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1597 <tp> <time>2006-01-03T03:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1598 <tp> <time>2006-01-03T03:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1603 "Add one hour to GPX input, output gpsml",
1607 testcmd
("$CMD -T -3600 multitrack-pause.gpx", # {{{
1609 <?xml version="1.0" encoding="UTF-8"?>
1612 <title>track1</title>
1613 <tp> <time>2005-12-31T23:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1614 <tp> <time>2005-12-31T23:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1615 <tp> <time>2005-12-31T23:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1617 <title>track2</title>
1618 <tp> <time>2006-01-01T23:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1619 <tp> <time>2006-01-01T23:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1620 <tp> <time>2006-01-01T23:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1621 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1623 <tp> <time>2006-01-02T00:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1625 <title>track3</title>
1626 <tp> <time>2006-01-03T01:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1627 <tp> <time>2006-01-03T01:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1628 <tp> <time>2006-01-03T01:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1630 <tp> <time>2006-01-03T01:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1631 <tp> <time>2006-01-03T01:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1632 <tp> <time>2006-01-03T01:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1633 <tp> <time>2006-01-03T01:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1634 <tp> <time>2006-01-03T01:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1639 "Subtract one hour from GPX input, output gpsml",
1643 testcmd
("$CMD -T 1 -o gpx multitrack-pause.gpx", # {{{
1648 <trkpt lat="1.11" lon="1.12"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1649 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:02Z</time> </trkpt>
1650 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:03Z</time> </trkpt>
1653 <trkpt lat="2.11" lon="2.12"> <time>2006-01-02T00:00:01Z</time> </trkpt>
1654 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:05Z</time> </trkpt>
1655 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:17Z</time> </trkpt>
1656 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:17Z</time> </trkpt>
1657 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:18Z</time> </trkpt>
1662 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1663 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1664 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1665 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1668 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1669 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1670 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:27Z</time> </trkpt>
1671 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:28Z</time> </trkpt>
1677 "Add one second to GPX input, output GPX",
1681 testcmd
("$CMD --time-shift -1 -o gpx multitrack-pause.gpsml", # {{{
1686 <trkpt lat="1.11" lon="1.12"> <time>2005-12-31T23:59:59Z</time> </trkpt>
1687 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:00Z</time> </trkpt>
1688 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1691 <trkpt lat="2.11" lon="2.12"> <time>2006-01-01T23:59:59Z</time> </trkpt>
1692 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:03Z</time> </trkpt>
1693 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:15Z</time> </trkpt>
1694 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:15Z</time> </trkpt>
1695 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:16Z</time> </trkpt>
1700 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:19Z</time> </trkpt>
1701 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:20Z</time> </trkpt>
1702 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1703 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1706 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1707 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1708 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1709 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1715 "Subtract one second from gpsml input, output GPX, use long option",
1719 testcmd
("$CMD -T 0 -o pgtab multitrack-pause.gpx", # {{{
1721 2006-01-01T00:00:00Z\t(1.11,1.12)\t\\N\t\\N\t\\N\t\\N\t\\N
1722 2006-01-01T00:00:01Z\t(1.21,1.22)\t\\N\t\\N\t\\N\t\\N\t\\N
1723 2006-01-01T00:00:02Z\t(1.31,1.32)\t\\N\t\\N\t\\N\t\\N\t\\N
1724 2006-01-02T00:00:00Z\t(2.11,2.12)\t\\N\t\\N\t\\N\t\\N\t\\N
1725 2006-01-02T00:00:04Z\t(2.21,2.22)\t\\N\t\\N\t\\N\t\\N\t\\N
1726 2006-01-02T00:00:16Z\t(2.31,2.32)\t\\N\t\\N\t\\N\t\\N\t\\N
1727 2006-01-02T01:00:16Z\t(2.41,2.42)\t\\N\t\\N\t\\N\t\\N\t\\N
1728 2006-01-02T01:00:17Z\t(2.451,2.452)\t\\N\t\\N\t\\N\t\\N\t\\N
1729 2006-01-03T02:00:20Z\t(3.11,3.12)\t\\N\t\\N\t\\N\t\\N\t\\N
1730 2006-01-03T02:00:21Z\t(3.21,3.22)\t\\N\t\\N\t\\N\t\\N\t\\N
1731 2006-01-03T02:00:22Z\t(3.31,3.32)\t\\N\t\\N\t\\N\t\\N\t\\N
1732 2006-01-03T02:00:23Z\t(3.41,3.42)\t\\N\t\\N\t\\N\t\\N\t\\N
1733 2006-01-03T02:00:24Z\t(3.51,3.52)\t\\N\t\\N\t\\N\t\\N\t\\N
1734 2006-01-03T02:00:25Z\t(3.61,3.62)\t\\N\t\\N\t\\N\t\\N\t\\N
1735 2006-01-03T02:00:26Z\t(3.71,3.72)\t\\N\t\\N\t\\N\t\\N\t\\N
1736 2006-01-03T02:00:27Z\t(3.81,3.82)\t\\N\t\\N\t\\N\t\\N\t\\N
1739 "Read GPX, time-shift 0 seconds, output pgtab",
1743 diag
("Testing -v (--verbose) option...");
1744 likecmd
("$CMD -hv", # {{{
1745 '/\$Id: .*? \$.* Show this help\./s',
1747 "Option --version with -h returns Id string and help screen",
1751 diag
("Testing --version option...");
1752 likecmd
("$CMD --version", # {{{
1755 "Option --version returns Id string",
1759 # --version option }}}
1760 diag
("Testing --strip-whitespace option..."); # {{{
1761 testcmd
("../gpst -w -o gpx pause.gpx", # {{{
1763 $stripped_gpx_header
1765 <name>ACTIVE LOG164705</name>
1767 <trkpt lat="60.425494" lon="5.299534"><ele>25.260</ele><time>2006-05-21T16:49:11Z</time></trkpt>
1768 <trkpt lat="60.425464" lon="5.299610"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
1769 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
1770 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
1771 <trkpt lat="60.425339" lon="5.299958"><ele>30.980</ele><time>2006-05-21T16:56:47Z</time></trkpt>
1772 <trkpt lat="60.425238" lon="5.299640"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
1773 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
1774 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
1775 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
1781 "Strip whitespace from GPX output",
1785 testcmd
("../gpst -o gpx -w comments.mayko", # {{{
1787 $stripped_gpx_header
1790 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
1791 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
1792 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
1793 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
1794 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
1795 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
1796 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
1799 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
1800 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
1806 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1810 testcmd
("../gpst -w -o pgwupd multitrack.gpx", # {{{
1813 UPDATE logg SET sted = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1814 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1817 UPDATE logg SET sted = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1818 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1821 UPDATE logg SET sted = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1822 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1825 UPDATE logg SET sted = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1826 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1829 UPDATE logg SET sted = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1830 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1833 UPDATE logg SET sted = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1834 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1838 "Strip whitespace from pgwupd output",
1842 # --strip-whitespace option }}}
1843 diag
("Testing --double-y-scale option..."); # {{{
1844 testcmd
("../gpst -y -o clean pause.gpx", # {{{
1846 5.299534\t120.850988\t25.260
1847 5.299610\t120.850928\t24.931
1848 5.299694\t120.850628\t27.975
1849 5.299741\t120.850768\t31.017
1850 5.299958\t120.850678\t30.980
1851 5.299640\t120.850476\t30.538
1852 5.299686\t120.850492\t30.515
1853 5.299773\t120.85069\t31.936
1854 5.299419\t120.850914\t31.794
1857 "Double y scale, clean output from gpx format",
1861 testcmd
("../gpst -y -o clean log.dos.mayko", # {{{
1863 8.1225077\t116.3636316\t
1864 8.1253200\t116.3637424\t
1865 8.1266031\t116.3632694\t
1866 8.1284612\t116.3624198\t
1867 8.1293950\t116.362063\t
1868 8.1307400\t116.3619242\t
1871 "Double y scale, clean output from mayko format",
1875 # --double-y-scale option }}}
1876 diag
("Testing --debug option..."); # {{{
1877 # --debug option }}}
1878 diag
("Strip error from Mayko format..."); # {{{
1880 testcmd
("../gpst -o csv date_error.mayko", # {{{
1882 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
1883 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
1884 2003-06-13T09:12:41Z\t5.5813636\t60.4283320\t\t
1885 2003-06-13T09:12:42Z\t5.5817430\t60.4283806\t\t
1888 "Strip error from mayko format in csv output",
1892 testcmd
("../gpst -o clean date_error.mayko", # {{{
1894 5.5794667\t60.4280897\t
1895 5.5802255\t60.4281867\t
1896 5.5813636\t60.4283320\t
1897 5.5817430\t60.4283806\t
1900 "Strip error from mayko format in clean output",
1904 testcmd
("../gpst -o gpsml date_error.mayko", # {{{
1906 <?xml version="1.0" encoding="UTF-8"?>
1909 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
1910 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
1911 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
1912 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
1913 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
1918 "Strip error from mayko format in gpsml output",
1922 testcmd
("../gpst -o gpx date_error.mayko", # {{{
1924 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1927 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
1928 xmlns="http://www.topografix.com/GPX/1/1"
1929 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1930 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
1934 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
1935 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
1936 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
1937 <trkpt lat="60.4283320" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
1938 <trkpt lat="60.4283806" lon="5.5817430"> <time>2003-06-13T09:12:42Z</time> </trkpt>
1944 "Strip error from mayko format in gpx output",
1948 testcmd
("../gpst -o gpstrans date_error.mayko", # {{{
1950 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
1951 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
1952 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
1953 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
1954 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
1957 "Strip error from mayko format in gpstrans output",
1961 testcmd
("../gpst -o pgtab date_error.mayko", # {{{
1963 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N\t\\N
1964 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N\t\\N
1965 2003-06-13T09:12:41Z\t(60.4283320,5.5813636)\t\\N\t\\N\t\\N\t\\N\t\\N
1966 2003-06-13T09:12:42Z\t(60.4283806,5.5817430)\t\\N\t\\N\t\\N\t\\N\t\\N
1969 "Strip error from mayko format in pgtab output",
1973 testcmd
("../gpst -o poscount date_error.mayko", # {{{
1975 5.5802255\t60.4281867\t1
1976 5.5817430\t60.4283806\t1
1977 5.5813636\t60.4283320\t1
1978 5.5794667\t60.4280897\t1
1981 "Strip error from mayko format in poscount output",
1985 testcmd
("../gpst -o xgraph date_error.mayko", # {{{
1987 5.5794667 60.4280897
1988 5.5802255 60.4281867
1989 5.5813636 60.4283320
1990 5.5817430 60.4283806
1993 "Strip error from mayko format in xgraph output",
1997 testcmd
("../gpst -o ygraph date_error.mayko", # {{{
2000 5.5794667 60.4280897
2003 5.5802255 60.4281867
2006 5.5813636 60.4283320
2009 5.5817430 60.4283806
2013 "Strip error from mayko format in ygraph output",
2018 # Strip error from Mayko format }}}
2023 if ($Opt{'all'} || $Opt{'todo'}) {
2024 diag
("Running TODO tests..."); # {{{
2027 local $TODO = "Remove extra \\n in the beginning";
2028 testcmd
("../gpst -o csv multitrack.gpx", # {{{
2030 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
2031 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
2032 2003-02-11T23:36:14Z\t-0.1453202\t51.4969040\t\t
2034 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
2035 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
2036 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
2037 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
2039 2003-02-11T23:37:05Z\t-0.1458608\t51.4970680\t\t
2040 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
2041 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
2043 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
2044 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
2045 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
2046 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
2047 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
2050 "Output csv format from multitrack.gpx",
2054 testcmd
("../gpst -o csv pause.gpx", # {{{
2056 2006-05-21T16:49:11Z\t5.299534\t60.425494\t25.260\t
2057 2006-05-21T16:49:46Z\t5.299610\t60.425464\t24.931\t
2058 2006-05-21T16:52:04Z\t5.299694\t60.425314\t27.975\t
2059 2006-05-21T16:56:36Z\t5.299741\t60.425384\t31.017\t
2060 2006-05-21T16:56:47Z\t5.299958\t60.425339\t30.980\t
2061 2006-05-21T16:56:56Z\t5.299640\t60.425238\t30.538\t
2062 2006-05-21T16:57:03Z\t5.299686\t60.425246\t30.515\t
2063 2006-05-21T16:59:08Z\t5.299773\t60.425345\t31.936\t
2064 2006-05-21T17:00:54Z\t5.299419\t60.425457\t31.794\t
2067 "Output csv format from pause.gpx",
2071 testcmd
("../gpst -e -o csv pause.gpx", # {{{
2073 1148230151\t5.299534\t60.425494\t25.260\t
2074 1148230186\t5.299610\t60.425464\t24.931\t
2075 1148230324\t5.299694\t60.425314\t27.975\t
2076 1148230596\t5.299741\t60.425384\t31.017\t
2077 1148230607\t5.299958\t60.425339\t30.980\t
2078 1148230616\t5.299640\t60.425238\t30.538\t
2079 1148230623\t5.299686\t60.425246\t30.515\t
2080 1148230748\t5.299773\t60.425345\t31.936\t
2081 1148230854\t5.299419\t60.425457\t31.794\t
2084 "csv format with epoch seconds from gpx",
2088 $TODO = "Tweak output";
2089 testcmd
("../gpst -o gpx multitrack-pause.gpsml", # {{{
2090 file_data
("multitrack-pause.gpx"),
2092 "Should be equal to multitrack-pause.gpx",
2097 # list_nearest_waypoints() {{{
2099 like
(list_nearest_waypoints
(60.42541, 5.29959, 3),
2101 "list_nearest_waypoints()"
2109 diag
("Testing finished.");
2113 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2114 my $stderr_cmd = "";
2115 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2122 my $TMP_STDERR = "gpst-stderr.tmp";
2124 if (defined($Exp_stderr) && !length($deb_str)) {
2125 $stderr_cmd = " 2>$TMP_STDERR";
2127 is
(`$Cmd$deb_str$stderr_cmd`, $Exp_stdout, $Txt);
2128 if (defined($Exp_stderr)) {
2129 if (!length($deb_str)) {
2130 is
(file_data
($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
2131 unlink($TMP_STDERR);
2134 diag
("Warning: stderr not defined for '$Txt'");
2141 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2142 my $stderr_cmd = "";
2143 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2150 my $TMP_STDERR = "gpst-stderr.tmp";
2152 if (defined($Exp_stderr) && !length($deb_str)) {
2153 $stderr_cmd = " 2>$TMP_STDERR";
2155 like
(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt);
2156 if (defined($Exp_stderr)) {
2157 if (!length($deb_str)) {
2158 like
(file_data
($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)");
2159 unlink($TMP_STDERR);
2162 diag
("Warning: stderr not defined for '$Txt'");
2168 # Return file content as a string {{{
2171 if (open(FP
, "<", $File)) {
2172 $Txt = join("", <FP
>);
2182 # Print program version {{{
2183 for (@main::version_array
) {
2190 # Send the help message to stdout {{{
2193 if ($Opt{'verbose'}) {
2199 Usage: $progname [options] [file [files [...]]]
2201 Contains tests for the gpst(1) program.
2206 Run all tests, also TODOs.
2210 Run only the TODO tests.
2212 Increase level of verbosity. Can be repeated.
2214 Print version information.
2216 Print debugging messages.
2224 # Print a status message to stderr based on verbosity level {{{
2225 my ($verbose_level, $Txt) = @_;
2227 if ($Opt{'verbose'} >= $verbose_level) {
2228 print(STDERR
"$progname: $Txt\n");
2235 # Plain Old Documentation (POD) {{{
2249 run-tests.pl [options] [file [files [...]]]
2253 Contains tests for the gpst(1) program.
2259 =item B<-a>, B<--all>
2261 Run all tests, also TODOs.
2263 =item B<-h>, B<--help>
2265 Print a brief help summary.
2267 =item B<-t>, B<--todo>
2269 Run only the TODO tests.
2271 =item B<-v>, B<--verbose>
2273 Increase level of verbosity. Can be repeated.
2277 Print version information.
2281 Print debugging messages.
2287 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
2291 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
2292 This is free software; see the file F<COPYING> for legalese stuff.
2296 This program is free software; you can redistribute it and/or modify it
2297 under the terms of the GNU General Public License as published by the
2298 Free Software Foundation; either version 2 of the License, or (at your
2299 option) any later version.
2301 This program is distributed in the hope that it will be useful, but
2302 WITHOUT ANY WARRANTY; without even the implied warranty of
2303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2304 See the GNU General Public License for more details.
2306 You should have received a copy of the GNU General Public License along
2307 with this program; if not, write to the Free Software Foundation, Inc.,
2308 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2318 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :