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 #=======================================================================
15 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
16 use Test
::More
qw{no_plan
};
44 $progname =~ s/^.*\/(.*?)$/$1/;
45 our $VERSION = "0.00";
47 Getopt
::Long
::Configure
("bundling");
50 "all|a" => \
$Opt{'all'},
51 "debug" => \
$Opt{'debug'},
52 "help|h" => \
$Opt{'help'},
53 "todo|t" => \
$Opt{'todo'},
54 "verbose|v+" => \
$Opt{'verbose'},
55 "version" => \
$Opt{'version'},
57 ) || die("$progname: Option error. Use -h for help.\n");
60 'gpsbabel' => 'gpsbabel',
63 $Opt{'debug'} && ($Debug = 1);
64 $Opt{'help'} && usage
(0);
65 if ($Opt{'version'}) {
70 diag
(sprintf("========== Executing %s v%s ==========",
74 chomp(my $gpx_header = <<END);
75 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
78 creator="gpst - http://sunny256.github.com/gpstools/"
79 xmlns="http://www.topografix.com/GPX/1/1"
80 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
81 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
84 my $stripped_gpx_header = $gpx_header;
85 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
87 if ($Opt{'todo'} && !$Opt{'all'}) {
93 testcmd("$CMD command", # {{{
106 diag
("Testing conversion routines...");
108 # txt_to_xml() and xml_to_txt() {{{
110 is
(txt_to_xml
("abc"),
112 "txt_to_xml(\"abc\")");
113 is
(txt_to_xml
("<&>"),
115 "txt_to_xml(\"<&>\")");
116 is
(txt_to_xml
("first line\nsecond <\rthird\r\n<&>"),
117 "first line\nsecond <\rthird\r\n<&>",
118 "txt_to_xml() with multiline string");
120 is
(xml_to_txt
("abc"),
122 "xml_to_txt(\"abc\")");
123 is
(xml_to_txt
("<&>"),
125 "xml_to_txt(\"<&>\")");
126 is
(xml_to_txt
("first line\nsecond <\rthird\r\n<&>"),
127 "first line\nsecond <\rthird\r\n<&>",
128 "xml_to_txt() with multiline string");
130 # txt_to_xml() and xml_to_txt() }}}
131 # postgresql_copy_safe() {{{
133 is
(postgresql_copy_safe
(""),
135 "postgresql_copy_safe() with empty string");
137 is
(postgresql_copy_safe
("abcæøåÆØÅ"),
139 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
141 is
(postgresql_copy_safe
("abc\t'\r\n"),
143 "postgresql_copy_safe(\"abc\\t'\\r\\n\")");
145 is
(postgresql_copy_safe
("¤%/&gurgle\t325\\wer\ndfv'\r!\"#\n%\twe\r\x00sdf\xFFsadc\n\t\x00sdc\n"),
146 "¤%/&gurgle\\t325\\\\wer\\ndfv'\\r!\"#\\n%\\twe\\r\x00sdf\xFFsadc\\n\\t\x00sdc\\n",
147 "postgresql_copy_safe() with multiline, nulls and stuff");
149 # postgresql_copy_safe() }}}
151 diag
("Testing date routines...");
153 # sec_to_string() {{{
155 is
(sec_to_string
(1148220825),
156 "2006-05-21 14:13:45",
157 "sec_to_string() without separator");
158 is
(sec_to_string
(1148220825, "T"),
159 "2006-05-21T14:13:45",
160 "sec_to_string() with separator");
161 is
(sec_to_string
(-5000),
163 "sec_to_string(-5000) — negative numbers unsupported atm");
164 is
(sec_to_string
(""),
166 "sec_to_string(\"\")");
167 is
(sec_to_string
("pH()rtY tW0"),
169 "sec_to_string() with invalid string");
170 is
(sec_to_string
("00000000000000000000001148220825"),
171 "2006-05-21 14:13:45",
172 "sec_to_string() with a bunch of leading zeros");
173 is
(sec_to_string
("1148220825.93"),
174 "2006-05-21 14:13:45.93",
175 "sec_to_string() with decimals");
176 is
(sec_to_string
("000000000000000000000000000001148220825.7312"),
177 "2006-05-21 14:13:45.7312",
178 "sec_to_string() with decimals and prefixing zeros");
179 is
(sec_to_string
("1148220825.93000"),
180 "2006-05-21 14:13:45.93",
181 "sec_to_string() with decimals and extra trailing zeros");
182 is
(sec_to_string
(".863"),
183 "1970-01-01 00:00:00.863",
184 "sec_to_string() with missing zero before decimal point");
186 # sec_to_string() }}}
187 # sec_to_readable() {{{
189 is
(sec_to_readable
(0),
191 "sec_to_readable(0)");
192 is
(sec_to_readable
("pH()rtY tW0"),
194 "sec_to_readable() with invalid string");
195 is
(sec_to_readable
(86400),
197 "sec_to_readable(86400)");
198 is
(sec_to_readable
(86400*1000),
200 "sec_to_readable(86400*1000)");
201 is
(sec_to_readable
(86400+7200+180+4),
203 "sec_to_readable(86400+7200+180+4)");
204 is
(sec_to_readable
("3.14"),
206 "sec_to_readable(\"3.14\")");
207 is
(sec_to_readable
("-124"),
209 "sec_to_readable() rejects negative numbers");
210 is
(sec_to_readable
("-2.34"),
212 "sec_to_readable() rejects negative decimal");
213 is
(sec_to_readable
(".87"),
215 "sec_to_readable(), missing zero before decimal point");
216 is
(sec_to_readable
(""),
218 "sec_to_readable() with empty string");
220 # sec_to_readable() }}}
222 diag
("Testing geo routines...");
226 is
(ddd_to_dms
("12.34567"),
228 "ddd_to_dms(\"12.34567\")");
232 "ddd_to_dms(\"0\")");
238 is
(ddd_to_dms
("pH()rtY tW0"),
240 "ddd_to_dms(\"pH()rtY tW0\")");
242 is
(ddd_to_dms
("-12.34567"),
244 "ddd_to_dms(\"-12.34567\")");
246 is
(ddd_to_dms
("0.34567"),
248 "ddd_to_dms(\"0.34567\")");
250 is
(ddd_to_dms
(".34567"),
252 "ddd_to_dms(\".34567\")");
254 is
(ddd_to_dms
("-.34567"),
256 "ddd_to_dms(\"-.34567\")");
258 is
(ddd_to_dms
("-0.34567"),
260 "ddd_to_dms(\"-0.34567\")");
262 is
(ddd_to_dms
("180"),
264 "ddd_to_dms(\"180\")");
266 is
(ddd_to_dms
("-180"),
268 "ddd_to_dms(\"-180\")");
272 "ddd_to_dms(\"-1\")");
274 is
(ddd_to_dms
("2-3"),
276 "ddd_to_dms(\"2-3\")");
280 diag
("Testing trackpoint()..."); # {{{
286 "trackpoint() receives empty hash");
305 # trackpoint() (gpsml) {{{
309 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
310 "trackpoint() (gpsml)"
313 # trackpoint() (gpsml) }}}
314 # trackpoint() (gpx) {{{
316 $Dat{'format'} = "gpx";
319 qq{ <trkpt lat
="59.5214" lon
="7.392133"> <ele
>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt
>\n},
323 # trackpoint() (gpx) }}}
325 # trackpoint(): Various loop tests {{{
327 for my $Elem (qw{format lat lon what
}) {
330 $Dat{"$Elem"} = '2d';
333 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
338 for my $Elem (qw{year month day hour min sec
}) {
345 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
346 "trackpoint(): {'$Elem'} with empty value skips time"
350 $Dat{"$Elem"} = '2d';
352 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
353 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") skips time"
357 $Dat{$Elem} = "00000$Dat{$Elem}";
359 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
360 "trackpoint(): Strip prefixing zeros from {'$Elem'}"
364 $Dat{"$Elem"} = 0-$Dat{$Elem};
366 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
367 "trackpoint(): {'$Elem'} is negative, skip time"
370 if ($Elem ne "sec") {
372 $Dat{"$Elem"} = "$Dat{$Elem}.00";
374 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
375 "trackpoint(): Decimals in {'$Elem'}, skip time"
383 $Dat{'sec'} = "$Dat{'sec'}.00";
385 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
386 "trackpoint(): Remove trailing zeros in {'sec'} decimals"
389 for my $Elem (qw{format what error
}) {
394 "trackpoint(): Missing {'$Elem'}, return undef"
398 # Various loop tests }}}
402 diag
("Testing output from ../gpst");
404 diag
("Read empty input (/dev/null)..."); # {{{
405 testcmd
("../gpst </dev/null", # {{{
407 <?xml version="1.0" encoding="UTF-8"?>
414 "Read from /dev/null",
419 testcmd
("../gpst -o gpx </dev/null", # {{{
429 "Output gpx from /dev/null",
435 diag
("Read empty files..."); # {{{
436 testcmd
("echo '<tp> </tp>' | ../gpst", # {{{
438 <?xml version="1.0" encoding="UTF-8"?>
445 "Don’t print empty trackpoints",
450 # Read empty files }}}
451 diag
("Testing --chronology option..."); # {{{
452 testcmd
("../gpst --chronology chronology-error.gpsml", # {{{
454 <?xml version="1.0" encoding="UTF-8"?>
457 <title>Chronology errors</title>
458 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
459 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
460 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
462 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
464 <pause>0:00:37:54</pause>
465 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
466 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
467 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
468 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
469 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
470 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
474 "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" .
475 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
476 "Check for chronology errors and duplicated times",
481 # --chronology option }}}
482 diag
("Testing --skip-dups option..."); # {{{
483 testcmd
("../gpst -d no_signal.mayko", # {{{
485 <?xml version="1.0" encoding="UTF-8"?>
488 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
489 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
490 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
491 <etp err="dup"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
492 <etp err="dup"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
493 <etp err="dup"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
494 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
495 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
496 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
501 "Remove duplicated positions from gpsml",
506 testcmd
("../gpst -d -o csv no_signal.mayko", # {{{
508 2002-12-22T21:42:24Z\t23.6746151\t70.6800486\t\t
509 2002-12-22T21:42:32Z\t23.6740038\t70.6799322\t\t
510 2002-12-22T21:42:54Z\t23.6723991\t70.6796266\t\t
511 2002-12-22T21:44:45Z\t23.6757566\t70.6800774\t\t
512 2002-12-22T21:44:52Z\t23.6753442\t70.6801502\t\t
513 2002-12-22T21:45:04Z\t23.6757542\t70.6801905\t\t
516 "Remove duplicated positions from csv output format",
521 testcmd
("../gpst -d -o clean no_signal.mayko", # {{{
523 23.6746151\t70.6800486\t
524 23.6740038\t70.6799322\t
525 23.6723991\t70.6796266\t
526 23.6757566\t70.6800774\t
527 23.6753442\t70.6801502\t
528 23.6757542\t70.6801905\t
531 "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
539 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\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
541 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\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
543 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
546 "Remove duplicated positions from pgtab output format",
551 # --skip-dups option }}}
552 diag
("Testing --epoch option..."); # {{{
553 testcmd
("../gpst -e pause.gpx", # {{{
555 <?xml version="1.0" encoding="UTF-8"?>
558 <title>ACTIVE LOG164705</title>
559 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
560 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
561 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
562 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
563 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
564 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
565 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
566 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
567 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
572 "--epoch is ignored in gpsml output",
577 testcmd
("../gpst -e -o gpx pause-noname.gpx", # {{{
582 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
583 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
584 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
585 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
586 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
587 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
588 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
589 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
590 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
596 "--epoch is ignored in gpx output",
602 diag
("Testing --fix option..."); # {{{
603 testcmd
("../gpst --fix --chronology chronology-error.gpsml", # {{{
605 <?xml version="1.0" encoding="UTF-8"?>
608 <title>Chronology errors</title>
609 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
610 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
611 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
613 <etp err="chrono"> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </etp>
615 <pause>0:00:37:54</pause>
616 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
617 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
618 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
619 <etp err="duptime"> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </etp>
620 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
621 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
625 "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" .
626 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
627 "Remove bad timestamps",
633 diag
("Testing --from-date option..."); # {{{
634 # --from-date option }}}
635 diag
("Testing -h (--help) option...");
636 likecmd
("$CMD -h", # {{{
637 '/ Show this help\./',
639 "Option -h prints help screen",
644 diag
("Testing --inside option..."); # {{{
645 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx", # {{{
647 <?xml version="1.0" encoding="UTF-8"?>
650 <title>track1</title>
652 <title>track2</title>
653 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
654 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
655 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
656 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
658 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
660 <title>track3</title>
661 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
662 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
663 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
668 "Check --inside option (gpx to gpst)",
673 # --inside option }}}
674 diag
("Testing --undefined option..."); # {{{
675 # --undefined option }}}
676 diag
("Testing --near option..."); # {{{
678 diag
("Testing --output option..."); # {{{
680 testcmd
("../gpst log.mcsv", # {{{
682 <?xml version="1.0" encoding="UTF-8"?>
686 <title>ACTIVE LOG 125</title>
687 <tp> <time>2006-03-04T11:12:30Z</time> <lat>54.96883</lat> <lon>-1.62439</lon> <ele>77</ele> </tp>
688 <tp> <time>2006-03-04T11:12:47Z</time> <lat>54.96878</lat> <lon>-1.62413</lon> <ele>77</ele> </tp>
689 <tp> <time>2006-03-04T11:12:55Z</time> <lat>54.96913</lat> <lon>-1.62616</lon> <ele>77</ele> </tp>
690 <tp> <time>2006-03-04T11:13:04Z</time> <lat>54.96934</lat> <lon>-1.62624</lon> <ele>77.5</ele> </tp>
691 <tp> <time>2006-03-04T11:13:33Z</time> <lat>54.96934</lat> <lon>-1.62596</lon> <ele>78</ele> </tp>
692 <tp> <time>2006-03-04T11:13:48Z</time> <lat>54.96931</lat> <lon>-1.62645</lon> <ele>78</ele> </tp>
693 <tp> <time>2006-03-04T11:14:05Z</time> <lat>54.96918</lat> <lon>-1.62603</lon> <ele>79</ele> </tp>
694 <tp> <time>2006-03-04T11:14:33Z</time> <lat>54.96901</lat> <lon>-1.62364</lon> <ele>76.1</ele> </tp>
695 <tp> <time>2006-03-04T11:15:02Z</time> <lat>54.96922</lat> <lon>-1.6254</lon> <ele>76.1</ele> </tp>
696 <tp> <time>2006-03-04T11:15:27Z</time> <lat>54.96914</lat> <lon>-1.62526</lon> <ele>75.1</ele> </tp>
697 <tp> <time>2006-03-04T11:15:50Z</time> <lat>54.96911</lat> <lon>-1.62494</lon> <ele>75.1</ele> </tp>
698 <tp> <time>2006-03-04T11:16:03Z</time> <lat>54.9693</lat> <lon>-1.62489</lon> <ele>75.1</ele> </tp>
699 <tp> <time>2006-03-04T11:16:19Z</time> <lat>54.96901</lat> <lon>-1.62496</lon> <ele>75.1</ele> </tp>
700 <tp> <time>2006-03-04T11:16:52Z</time> <lat>54.96871</lat> <lon>-1.62466</lon> <ele>74.6</ele> </tp>
701 <tp> <time>2006-03-04T11:17:25Z</time> <lat>54.96908</lat> <lon>-1.62488</lon> <ele>72.7</ele> </tp>
703 <title>ACTIVE LOG 126</title>
704 <tp> <time>2006-03-04T11:18:32Z</time> <lat>54.96904</lat> <lon>-1.62482</lon> <ele>72.7</ele> </tp>
705 <tp> <time>2006-03-04T11:18:35Z</time> <lat>54.96913</lat> <lon>-1.62499</lon> <ele>71.3</ele> </tp>
706 <tp> <time>2006-03-04T11:18:38Z</time> <lat>54.96904</lat> <lon>-1.62497</lon> <ele>70.8</ele> </tp>
707 <tp> <time>2006-03-04T11:18:48Z</time> <lat>54.96913</lat> <lon>-1.62496</lon> <ele>71.8</ele> </tp>
708 <tp> <time>2006-03-04T11:18:55Z</time> <lat>54.96924</lat> <lon>-1.62501</lon> <ele>72.2</ele> </tp>
709 <tp> <time>2006-03-04T11:19:11Z</time> <lat>54.9694</lat> <lon>-1.62521</lon> <ele>71.8</ele> </tp>
710 <tp> <time>2006-03-04T11:19:30Z</time> <lat>54.96916</lat> <lon>-1.62515</lon> <ele>71.3</ele> </tp>
711 <tp> <time>2006-03-04T11:19:53Z</time> <lat>54.96921</lat> <lon>-1.625</lon> <ele>71.3</ele> </tp>
712 <tp> <time>2006-03-04T11:20:21Z</time> <lat>54.96801</lat> <lon>-1.62417</lon> <ele>71.8</ele> </tp>
714 <title>ACTIVE LOG 127</title>
715 <tp> <time>2006-03-04T11:21:16Z</time> <lat>54.96887</lat> <lon>-1.62504</lon> <ele>70.8</ele> </tp>
716 <tp> <time>2006-03-04T11:21:18Z</time> <lat>54.96898</lat> <lon>-1.62476</lon> <ele>69.8</ele> </tp>
717 <tp> <time>2006-03-04T11:21:29Z</time> <lat>54.9691</lat> <lon>-1.62475</lon> <ele>69.4</ele> </tp>
718 <tp> <time>2006-03-04T11:21:46Z</time> <lat>54.96918</lat> <lon>-1.62468</lon> <ele>70.3</ele> </tp>
719 <tp> <time>2006-03-04T11:22:39Z</time> <lat>54.9692</lat> <lon>-1.62465</lon> <ele>69.4</ele> </tp>
720 <tp> <time>2006-03-04T11:22:43Z</time> <lat>54.96924</lat> <lon>-1.62462</lon> <ele>71.8</ele> </tp>
721 <tp> <time>2006-03-04T11:22:45Z</time> <lat>54.96928</lat> <lon>-1.62463</lon> <ele>71.8</ele> </tp>
722 <tp> <time>2006-03-04T11:23:00Z</time> <lat>54.96945</lat> <lon>-1.62466</lon> <ele>69.4</ele> </tp>
727 "Read Mapsource TAB-separated format",
732 testcmd
("../gpst two-digit_year.mcsv", # {{{
734 <?xml version="1.0" encoding="UTF-8"?>
738 <title>ACTIVE LOG 032</title>
739 <tp> <time>2006-03-20T20:35:33Z</time> <lat>60.41324</lat> <lon>5.33352</lon> <ele>14</ele> </tp>
740 <tp> <time>2006-03-20T20:35:38Z</time> <lat>60.38802</lat> <lon>5.33845</lon> <ele>18</ele> </tp>
741 <tp> <time>2006-03-20T20:35:44Z</time> <lat>60.38709</lat> <lon>5.3379</lon> <ele>19</ele> </tp>
742 <tp> <time>2006-03-20T20:35:49Z</time> <lat>60.38641</lat> <lon>5.33732</lon> <ele>18</ele> </tp>
743 <tp> <time>2006-03-20T20:35:54Z</time> <lat>60.38581</lat> <lon>5.33647</lon> <ele>18</ele> </tp>
744 <tp> <time>2006-03-20T20:36:00Z</time> <lat>60.38516</lat> <lon>5.33528</lon> <ele>15</ele> </tp>
745 <tp> <time>2006-03-20T20:36:02Z</time> <lat>60.38495</lat> <lon>5.3349</lon> <ele>13</ele> </tp>
750 "Read Mapsource TAB-separated format with two-digit year",
755 testcmd
("../gpst log.gpstxt", # {{{
757 <?xml version="1.0" encoding="UTF-8"?>
760 <tp> <time>2003-06-13T14:36:09Z</time> <lat>59.521517</lat> <lon>7.391867</lon> <ele>762</ele> </tp>
761 <tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>
762 <tp> <time>2003-06-13T14:36:11Z</time> <lat>59.5213</lat> <lon>7.392417</lon> <ele>761</ele> </tp>
763 <tp> <time>2003-06-13T14:36:12Z</time> <lat>59.521183</lat> <lon>7.3927</lon> <ele>761</ele> </tp>
764 <etp err="nosignal"> <time>2003-06-13T14:36:13Z</time> </etp>
765 <tp> <time>2003-06-13T14:36:15Z</time> <lat>59.52085</lat> <lon>7.393517</lon> <ele>760</ele> </tp>
766 <tp> <time>2003-06-13T14:36:16Z</time> <lat>59.520733</lat> <lon>7.393783</lon> <ele>760</ele> </tp>
767 <tp> <time>2003-06-13T14:36:17Z</time> <lat>59.52065</lat> <lon>7.39405</lon> <ele>760</ele> </tp>
768 <tp> <time>2003-06-13T14:36:18Z</time> <lat>59.520583</lat> <lon>7.394333</lon> <ele>760</ele> </tp>
769 <tp> <time>2003-06-13T14:36:19Z</time> <lat>59.520533</lat> <lon>7.394633</lon> <ele>759</ele> </tp>
770 <tp> <time>2003-06-13T14:36:20Z</time> <lat>59.520483</lat> <lon>7.394917</lon> <ele>759</ele> </tp>
771 <tp> <time>2003-06-13T14:36:21Z</time> <lat>59.520433</lat> <lon>7.395233</lon> <ele>759</ele> </tp>
772 <etp err="nosignal"> <time>2003-06-13T14:36:22Z</time> </etp>
773 <tp> <time>2003-06-13T14:36:24Z</time> <lat>59.520283</lat> <lon>7.396233</lon> <ele>758</ele> </tp>
774 <tp> <time>2003-06-13T14:36:25Z</time> <lat>59.520233</lat> <lon>7.39655</lon> <ele>758</ele> </tp>
775 <tp> <time>2003-06-13T14:36:26Z</time> <lat>59.520183</lat> <lon>7.396883</lon> <ele>757</ele> </tp>
776 <tp> <time>2003-06-13T14:36:27Z</time> <lat>59.520133</lat> <lon>7.397217</lon> <ele>757</ele> </tp>
777 <tp> <time>2003-06-13T14:36:28Z</time> <lat>59.5201</lat> <lon>7.397567</lon> <ele>757</ele> </tp>
782 "Read Garmin serial text format",
787 testcmd
("../gpst log.dos.mayko", # {{{
789 <?xml version="1.0" encoding="UTF-8"?>
792 <tp> <time>2003-06-15T10:27:45Z</time> <lat>58.1818158</lat> <lon>8.1225077</lon> </tp>
793 <tp> <time>2003-06-15T10:27:53Z</time> <lat>58.1818712</lat> <lon>8.12532</lon> </tp>
794 <tp> <time>2003-06-15T10:27:57Z</time> <lat>58.1816347</lat> <lon>8.1266031</lon> </tp>
795 <tp> <time>2003-06-15T10:28:03Z</time> <lat>58.1812099</lat> <lon>8.1284612</lon> </tp>
796 <tp> <time>2003-06-15T10:28:06Z</time> <lat>58.1810315</lat> <lon>8.129395</lon> </tp>
797 <tp> <time>2003-06-15T10:28:10Z</time> <lat>58.1809621</lat> <lon>8.13074</lon> </tp>
802 "Read DOS-formatted Mayko format",
807 testcmd
("../gpst log.dos.gpstxt", # {{{
809 <?xml version="1.0" encoding="UTF-8"?>
812 <tp> <time>2003-01-05T16:47:11Z</time> <lat>66.908167</lat> <lon>15.022983</lon> <ele>11472</ele> </tp>
813 <tp> <time>2003-01-05T16:47:12Z</time> <lat>66.90625</lat> <lon>15.020667</lon> <ele>11472</ele> </tp>
814 <tp> <time>2003-01-05T16:47:13Z</time> <lat>66.904317</lat> <lon>15.01835</lon> <ele>11472</ele> </tp>
815 <tp> <time>2003-01-05T16:47:14Z</time> <lat>66.9024</lat> <lon>15.016017</lon> <ele>11473</ele> </tp>
816 <tp> <time>2003-01-05T16:47:15Z</time> <lat>66.900483</lat> <lon>15.0137</lon> <ele>11474</ele> </tp>
817 <tp> <time>2003-01-05T16:47:16Z</time> <lat>66.898567</lat> <lon>15.011383</lon> <ele>11474</ele> </tp>
818 <tp> <time>2003-01-05T16:47:17Z</time> <lat>66.896633</lat> <lon>15.009067</lon> <ele>11475</ele> </tp>
819 <tp> <time>2003-01-05T16:47:18Z</time> <lat>66.894717</lat> <lon>15.006733</lon> <ele>11475</ele> </tp>
820 <tp> <time>2003-01-05T16:47:19Z</time> <lat>66.8928</lat> <lon>15.004417</lon> <ele>11475</ele> </tp>
821 <tp> <time>2003-01-05T16:47:20Z</time> <lat>66.890867</lat> <lon>15.0021</lon> <ele>11475</ele> </tp>
822 <tp> <time>2003-01-05T16:47:21Z</time> <lat>66.88895</lat> <lon>14.999783</lon> <ele>11475</ele> </tp>
827 "Read DOS-formatted Garmin serial text format",
832 testcmd
("../gpst log.unix.mcsv", # {{{
834 <?xml version="1.0" encoding="UTF-8"?>
838 <title>ACTIVE LOG 058</title>
839 <tp> <time>2006-02-21T15:14:25Z</time> <lat>60.36662</lat> <lon>5.24885</lon> <ele>31.9</ele> </tp>
840 <tp> <time>2006-02-21T15:14:30Z</time> <lat>60.37057</lat> <lon>5.22956</lon> <ele>35.2</ele> </tp>
841 <tp> <time>2006-02-21T15:14:35Z</time> <lat>60.37019</lat> <lon>5.22817</lon> <ele>39.6</ele> </tp>
842 <tp> <time>2006-02-21T15:14:36Z</time> <lat>60.37012</lat> <lon>5.2279</lon> <ele>41</ele> </tp>
843 <tp> <time>2006-02-21T15:14:40Z</time> <lat>60.37009</lat> <lon>5.22682</lon> <ele>47.2</ele> </tp>
844 <tp> <time>2006-02-21T15:14:42Z</time> <lat>60.37011</lat> <lon>5.22641</lon> <ele>49.2</ele> </tp>
845 <tp> <time>2006-02-21T15:14:44Z</time> <lat>60.37011</lat> <lon>5.22607</lon> <ele>50.1</ele> </tp>
846 <tp> <time>2006-02-21T15:14:48Z</time> <lat>60.37002</lat> <lon>5.22568</lon> <ele>51.1</ele> </tp>
847 <tp> <time>2006-02-21T15:14:51Z</time> <lat>60.3701</lat> <lon>5.22548</lon> <ele>52.5</ele> </tp>
852 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
857 testcmd
("../gpst multitrack.gpx", # {{{
859 <?xml version="1.0" encoding="UTF-8"?>
862 <title>Track 1</title>
863 <tp> <time>2003-02-11T23:35:39Z</time> <lat>51.4968266</lat> <lon>-0.1448824</lon> </tp>
864 <tp> <time>2003-02-11T23:35:49Z</time> <lat>51.4968227</lat> <lon>-0.1449938</lon> </tp>
865 <tp> <time>2003-02-11T23:36:14Z</time> <lat>51.496904</lat> <lon>-0.1453202</lon> </tp>
867 <title>Track 2</title>
868 <tp> <time>2003-02-11T23:36:16Z</time> <lat>51.4969214</lat> <lon>-0.1453398</lon> </tp>
869 <tp> <time>2003-02-11T23:36:31Z</time> <lat>51.4969816</lat> <lon>-0.1455514</lon> </tp>
870 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
871 <tp> <time>2003-02-11T23:36:50Z</time> <lat>51.4970452</lat> <lon>-0.1457804</lon> </tp>
873 <title>Track 3</title>
874 <tp> <time>2003-02-11T23:37:05Z</time> <lat>51.497068</lat> <lon>-0.1458608</lon> </tp>
875 <tp> <time>2003-02-11T23:37:22Z</time> <lat>51.4971658</lat> <lon>-0.1460047</lon> </tp>
876 <tp> <time>2003-02-11T23:37:36Z</time> <lat>51.4972469</lat> <lon>-0.1461614</lon> </tp>
878 <title>Track 4</title>
879 <tp> <time>2003-02-11T23:37:43Z</time> <lat>51.4972731</lat> <lon>-0.1462394</lon> </tp>
880 <tp> <time>2003-02-11T23:38:04Z</time> <lat>51.4973437</lat> <lon>-0.1463232</lon> </tp>
881 <tp> <time>2003-02-11T23:38:28Z</time> <lat>51.4973337</lat> <lon>-0.1462949</lon> </tp>
882 <tp> <time>2003-02-11T23:38:34Z</time> <lat>51.4973218</lat> <lon>-0.1462825</lon> </tp>
883 <tp> <time>2003-02-11T23:38:35Z</time> <lat>51.4973145</lat> <lon>-0.1462732</lon> </tp>
888 "Read GPX file with multiple tracks",
893 testcmd
("../gpst compact.gpx", # {{{
895 <?xml version="1.0" encoding="UTF-8"?>
898 <title>All whitespace stripped</title>
899 <tp> <time>2002-12-30T15:22:04Z</time> <lat>70.660932</lat> <lon>23.7028354</lon> </tp>
900 <tp> <time>2002-12-30T15:22:06Z</time> <lat>70.6609392</lat> <lon>23.7028468</lon> </tp>
901 <tp> <time>2002-12-30T15:22:08Z</time> <lat>70.6609429</lat> <lon>23.7028499</lon> </tp>
902 <tp> <time>2002-12-30T15:22:11Z</time> <lat>70.6609381</lat> <lon>23.702862</lon> </tp>
903 <tp> <time>2002-12-30T15:22:12Z</time> <lat>70.6609368</lat> <lon>23.7028648</lon> </tp>
904 <tp> <time>2002-12-30T15:22:13Z</time> <lat>70.6609344</lat> <lon>23.7028652</lon> </tp>
905 <tp> <time>2002-12-30T15:22:15Z</time> <lat>70.6609349</lat> <lon>23.7028707</lon> </tp>
906 <tp> <time>2002-12-30T15:22:17Z</time> <lat>70.6609348</lat> <lon>23.7028654</lon> </tp>
907 <tp> <time>2002-12-30T15:22:19Z</time> <lat>70.6609347</lat> <lon>23.7028599</lon> </tp>
908 <tp> <time>2002-12-30T15:22:20Z</time> <lat>70.6609348</lat> <lon>23.7028609</lon> </tp>
909 <tp> <time>2002-12-30T15:22:23Z</time> <lat>70.6609388</lat> <lon>23.7028653</lon> </tp>
910 <tp> <time>2002-12-30T15:22:25Z</time> <lat>70.6609426</lat> <lon>23.7028732</lon> </tp>
915 "Read GPX one-liner",
920 testcmd
("../gpst missing.gpsml", # {{{
922 <?xml version="1.0" encoding="UTF-8"?>
925 <title>Missing various elements</title>
926 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
927 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
928 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
929 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
930 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
931 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
932 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
933 <tp> <ele>486</ele> </tp>
934 <tp> <desc>Missing everything</desc> </tp>
935 <tp> <lat>60.42339</lat> </tp>
936 <tp> <lon>5.34262</lon> </tp>
937 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
938 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
943 "Read gpsml with various data missing",
948 testcmd
("../gpst different_dateformats.gpsml", # {{{
950 <?xml version="1.0" encoding="UTF-8"?>
953 <title>Date format variations</title>
954 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1</lat> <lon>1</lon> </tp>
955 <tp> <time>2006-01-01T00:00:02Z</time> <lat>2</lat> <lon>2</lon> </tp>
956 <tp> <time>2006-01-01T00:00:03Z</time> <lat>3</lat> <lon>3</lon> </tp>
957 <tp> <time>2006-01-01T00:00:04Z</time> <lat>4</lat> <lon>4</lon> </tp>
962 "Read different date formats from gpsml file",
967 testcmd
("../gpst multitrack-pause.gpx", # {{{
968 file_data
("multitrack-pause.gpsml"),
970 "Should be equal to multitrack-pause.gpsml",
976 testcmd
("../gpst -o gpx no_signal.mayko", # {{{
981 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
982 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
983 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
984 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> </trkpt>
985 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> </trkpt>
986 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> </trkpt>
987 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
988 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
989 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
995 "Output GPX from Mayko file with duplicates",
1000 testcmd
("../gpst -o gpx comments.mayko", # {{{
1005 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
1006 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
1007 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
1008 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1009 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1010 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1011 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
1014 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1015 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1021 "Output GPX from Mayko file with commented-out lines",
1026 testcmd
("../gpst -o gpx missing-noname.gpsml", # {{{
1031 <trkpt lat="60.42353" lon="5.34185"> <time>2006-04-30T17:17:09Z</time> </trkpt>
1032 <trkpt> <ele>483</ele> <time>2006-04-30T17:17:11Z</time> </trkpt>
1033 <trkpt> <ele>485</ele> <time>2006-04-30T17:17:22Z</time> </trkpt>
1034 <trkpt lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
1035 <trkpt> <ele>484</ele> </trkpt>
1036 <trkpt> <ele>486</ele> </trkpt>
1037 <trkpt> <ele>490</ele> <time>2006-04-30T17:18:03Z</time> </trkpt>
1038 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
1044 "Output GPX from gpsml with missing data",
1050 testcmd
("../gpst -o xgraph multitrack.gpx", # {{{
1052 -0.1448824 51.4968266
1053 -0.1449938 51.4968227
1054 -0.1453202 51.4969040
1055 move -0.1453398 51.4969214
1056 -0.1455514 51.4969816
1057 -0.1457489 51.4970224
1058 -0.1457804 51.4970452
1059 move -0.1458608 51.4970680
1060 -0.1460047 51.4971658
1061 -0.1461614 51.4972469
1062 move -0.1462394 51.4972731
1063 -0.1463232 51.4973437
1064 -0.1462949 51.4973337
1065 -0.1462825 51.4973218
1066 -0.1462732 51.4973145
1069 "Output xgraph format from GPX",
1075 testcmd
("../gpst -o pgtab compact.gpx", # {{{
1077 2002-12-30T15:22:04Z\t(70.6609320,23.7028354)\t\\N\t\\N\t\\N\t\\N
1078 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N
1079 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N
1080 2002-12-30T15:22:11Z\t(70.6609381,23.7028620)\t\\N\t\\N\t\\N\t\\N
1081 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N
1082 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N
1083 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N
1084 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N
1085 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N
1086 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N
1087 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N
1088 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N
1091 "Output pgtab from gpx format",
1096 testcmd
("../gpst -o pgtab no_signal.mayko", # {{{
1098 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
1099 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
1100 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1101 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1102 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1103 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1104 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
1105 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
1106 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
1109 "Output pgtab from mayko format",
1114 testcmd
("../gpst -o pgtab missing.gpsml", # {{{
1116 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N
1117 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N
1118 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N
1121 "Output pgtab from missing.gpsml",
1127 testcmd
("../gpst -o csv log.dos.mayko", # {{{
1129 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1130 2003-06-15T10:27:53Z\t8.1253200\t58.1818712\t\t
1131 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1132 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1133 2003-06-15T10:28:06Z\t8.1293950\t58.1810315\t\t
1134 2003-06-15T10:28:10Z\t8.1307400\t58.1809621\t\t
1137 "Output csv from DOS-formatted Mayko format",
1143 testcmd
("../gpst -o pgwtab multitrack.gpx", # {{{
1145 (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
1146 (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
1147 (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
1148 (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
1149 (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
1150 (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
1153 "Test pgwtab format",
1159 testcmd
("../gpst -o pgwupd multitrack.gpx", # {{{
1162 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1163 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1166 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1167 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1170 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1171 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1174 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1175 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1178 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1179 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1182 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1183 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1187 "Test pgwupd format",
1193 testcmd
("../gpst -t -o clean pause.gpx", # {{{
1195 5.299534\t60.425494\t25.260
1196 5.299610\t60.425464\t24.931
1198 5.299694\t60.425314\t27.975
1200 5.299741\t60.425384\t31.017
1201 5.299958\t60.425339\t30.980
1202 5.299640\t60.425238\t30.538
1203 5.299686\t60.425246\t30.515
1205 5.299773\t60.425345\t31.936
1206 5.299419\t60.425457\t31.794
1209 "Output clean format with time breaks",
1218 # --output option }}}
1219 diag
("Testing --outside option..."); # {{{
1220 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx", # {{{
1222 <?xml version="1.0" encoding="UTF-8"?>
1225 <title>track1</title>
1226 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1227 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1228 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1230 <title>track2</title>
1232 <title>track3</title>
1234 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1235 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1236 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1237 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1238 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1243 "Check --outside option (gpx to gpst)",
1248 # --outside option }}}
1249 diag
("Testing --pos1 and --pos2 options..."); # {{{
1250 # --pos1 and --pos2 options }}}
1251 diag
("Testing --require option..."); # {{{
1252 testcmd
("../gpst -re multitrack.gpx", # {{{
1254 <?xml version="1.0" encoding="UTF-8"?>
1257 <title>Track 1</title>
1259 <title>Track 2</title>
1260 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1262 <title>Track 3</title>
1264 <title>Track 4</title>
1269 "Require elevation from GPX data",
1274 testcmd
("../gpst -re one_ele.dos.gpsml", # {{{
1276 <?xml version="1.0" encoding="UTF-8"?>
1279 <title>Only one point has elevation</title>
1280 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1285 "Require elevation from gpsml",
1290 testcmd
("../gpst -re missing.gpsml", # {{{
1292 <?xml version="1.0" encoding="UTF-8"?>
1295 <title>Missing various elements</title>
1296 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1297 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1298 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1299 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1300 <tp> <ele>486</ele> </tp>
1301 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1302 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1307 "Require elevation",
1312 testcmd
("../gpst -rt missing.gpsml", # {{{
1314 <?xml version="1.0" encoding="UTF-8"?>
1317 <title>Missing various elements</title>
1318 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1319 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1320 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1321 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1322 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1323 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1324 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1334 testcmd
("../gpst -rp missing.gpsml", # {{{
1336 <?xml version="1.0" encoding="UTF-8"?>
1339 <title>Missing various elements</title>
1340 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1341 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1342 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1352 testcmd
("../gpst -ret missing.gpsml", # {{{
1354 <?xml version="1.0" encoding="UTF-8"?>
1357 <title>Missing various elements</title>
1358 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1359 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1360 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1361 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1366 "Require elevation and time",
1371 testcmd
("../gpst -retp missing.gpsml", # {{{
1373 <?xml version="1.0" encoding="UTF-8"?>
1376 <title>Missing various elements</title>
1377 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1382 "Require elevation, time and position",
1387 testcmd
("../gpst -rep missing.gpsml", # {{{
1389 <?xml version="1.0" encoding="UTF-8"?>
1392 <title>Missing various elements</title>
1393 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1394 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1399 "Require elevation and position",
1404 # --require option }}}
1405 diag
("Testing --round option..."); # {{{
1406 testcmd
("../gpst -R lat=4,lon=5,ele=1 pause.gpx", # {{{
1408 <?xml version="1.0" encoding="UTF-8"?>
1411 <title>ACTIVE LOG164705</title>
1412 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1413 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1414 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1415 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1416 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1417 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1418 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1419 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1420 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1425 "--round works with lat, lon, ele from gpx",
1430 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgtab pause.gpx", # {{{
1432 2006-05-21T16:49:11Z\t(60.425,5.3)\t25.3\t\\N\t\\N\t\\N
1433 2006-05-21T16:49:46Z\t(60.425,5.3)\t24.9\t\\N\t\\N\t\\N
1434 2006-05-21T16:52:04Z\t(60.425,5.3)\t28\t\\N\t\\N\t\\N
1435 2006-05-21T16:56:36Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1436 2006-05-21T16:56:47Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1437 2006-05-21T16:56:56Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1438 2006-05-21T16:57:03Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1439 2006-05-21T16:59:08Z\t(60.425,5.3)\t31.9\t\\N\t\\N\t\\N
1440 2006-05-21T17:00:54Z\t(60.425,5.299)\t31.8\t\\N\t\\N\t\\N
1443 "pgtab output from gpx works with --round lat, lon, ele",
1448 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwtab multitrack.gpx", # {{{
1450 (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
1451 (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
1452 (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
1453 (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
1454 (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
1455 (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
1458 "--round works with lat, lon, ele from gpx, pgwtab output",
1463 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwupd multitrack.gpx", # {{{
1466 UPDATE logg SET name = clname(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1467 UPDATE logg SET dist = cldist(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1470 UPDATE logg SET name = clname(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1471 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1474 UPDATE logg SET name = clname(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1475 UPDATE logg SET dist = cldist(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1478 UPDATE logg SET name = clname(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1479 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1482 UPDATE logg SET name = clname(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1483 UPDATE logg SET dist = cldist(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1486 UPDATE logg SET name = clname(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1487 UPDATE logg SET dist = cldist(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1491 "pgwupd output and --round works with lat, lon, ele from gpx",
1496 # --round option }}}
1497 diag
("Testing --short-date option..."); # {{{
1498 # --short-date option }}}
1499 diag
("Testing --save-to-file option..."); # {{{
1500 # --save-to-file option }}}
1501 diag
("Testing --create-breaks option..."); # {{{
1502 testcmd
("../gpst -t pause.gpx", # {{{
1504 <?xml version="1.0" encoding="UTF-8"?>
1507 <title>ACTIVE LOG164705</title>
1508 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1509 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1510 <pause>0:00:02:18</pause>
1511 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1512 <pause>0:00:04:32</pause>
1513 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1514 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1515 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1516 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1517 <pause>0:00:02:05</pause>
1518 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1519 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1524 "Output gpsml with <pause> elements from GPX files",
1529 testcmd
("../gpst -t multitrack-pause.gpx", # {{{
1531 <?xml version="1.0" encoding="UTF-8"?>
1534 <title>track1</title>
1535 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1536 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1537 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1539 <title>track2</title>
1540 <pause>0:23:59:58</pause>
1541 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1542 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1543 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1544 <pause>0:01:00:00</pause>
1545 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1547 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1549 <title>track3</title>
1550 <pause>1:01:00:03</pause>
1551 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1552 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1553 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1555 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1556 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1557 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1558 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1559 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1564 "Insert <pause> between gpx tracks",
1569 testcmd
("../gpst -t multitrack-pause.gpsml", # {{{
1571 <?xml version="1.0" encoding="UTF-8"?>
1574 <title>track1</title>
1575 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1576 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1577 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1579 <title>track2</title>
1580 <pause>0:23:59:58</pause>
1581 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1582 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1583 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1584 <pause>0:01:00:00</pause>
1585 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1587 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1589 <title>track3</title>
1590 <pause>1:01:00:03</pause>
1591 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1592 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1593 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1595 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1596 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1597 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1598 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1599 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1604 "Insert <pause> between gpsml titles",
1609 # --create-breaks option }}}
1610 diag
("Testing -T (--time-shift) option...");
1611 testcmd
("$CMD -T 3600 multitrack-pause.gpx", # {{{
1613 <?xml version="1.0" encoding="UTF-8"?>
1616 <title>track1</title>
1617 <tp> <time>2006-01-01T01:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1618 <tp> <time>2006-01-01T01:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1619 <tp> <time>2006-01-01T01:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1621 <title>track2</title>
1622 <tp> <time>2006-01-02T01:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1623 <tp> <time>2006-01-02T01:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1624 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1625 <tp> <time>2006-01-02T02:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1627 <tp> <time>2006-01-02T02:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1629 <title>track3</title>
1630 <tp> <time>2006-01-03T03:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1631 <tp> <time>2006-01-03T03:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1632 <tp> <time>2006-01-03T03:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1634 <tp> <time>2006-01-03T03:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1635 <tp> <time>2006-01-03T03:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1636 <tp> <time>2006-01-03T03:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1637 <tp> <time>2006-01-03T03:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1638 <tp> <time>2006-01-03T03:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1643 "Add one hour to GPX input, output gpsml",
1648 testcmd
("$CMD -T -3600 multitrack-pause.gpx", # {{{
1650 <?xml version="1.0" encoding="UTF-8"?>
1653 <title>track1</title>
1654 <tp> <time>2005-12-31T23:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1655 <tp> <time>2005-12-31T23:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1656 <tp> <time>2005-12-31T23:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1658 <title>track2</title>
1659 <tp> <time>2006-01-01T23:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1660 <tp> <time>2006-01-01T23:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1661 <tp> <time>2006-01-01T23:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1662 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1664 <tp> <time>2006-01-02T00:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1666 <title>track3</title>
1667 <tp> <time>2006-01-03T01:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1668 <tp> <time>2006-01-03T01:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1669 <tp> <time>2006-01-03T01:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1671 <tp> <time>2006-01-03T01:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1672 <tp> <time>2006-01-03T01:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1673 <tp> <time>2006-01-03T01:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1674 <tp> <time>2006-01-03T01:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1675 <tp> <time>2006-01-03T01:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1680 "Subtract one hour from GPX input, output gpsml",
1685 testcmd
("$CMD -T 1 -o gpx multitrack-pause.gpx", # {{{
1690 <trkpt lat="1.11" lon="1.12"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1691 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:02Z</time> </trkpt>
1692 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:03Z</time> </trkpt>
1695 <trkpt lat="2.11" lon="2.12"> <time>2006-01-02T00:00:01Z</time> </trkpt>
1696 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:05Z</time> </trkpt>
1697 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:17Z</time> </trkpt>
1698 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:17Z</time> </trkpt>
1699 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:18Z</time> </trkpt>
1704 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1705 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1706 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1707 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1710 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1711 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1712 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:27Z</time> </trkpt>
1713 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:28Z</time> </trkpt>
1719 "Add one second to GPX input, output GPX",
1724 testcmd
("$CMD --time-shift -1 -o gpx multitrack-pause.gpsml", # {{{
1729 <trkpt lat="1.11" lon="1.12"> <time>2005-12-31T23:59:59Z</time> </trkpt>
1730 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:00Z</time> </trkpt>
1731 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1734 <trkpt lat="2.11" lon="2.12"> <time>2006-01-01T23:59:59Z</time> </trkpt>
1735 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:03Z</time> </trkpt>
1736 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:15Z</time> </trkpt>
1737 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:15Z</time> </trkpt>
1738 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:16Z</time> </trkpt>
1743 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:19Z</time> </trkpt>
1744 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:20Z</time> </trkpt>
1745 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1746 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1749 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1750 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1751 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1752 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1758 "Subtract one second from gpsml input, output GPX, use long option",
1763 testcmd
("$CMD -T 0 -o pgtab multitrack-pause.gpx", # {{{
1765 2006-01-01T00:00:00Z\t(1.11,1.12)\t\\N\t\\N\t\\N\t\\N
1766 2006-01-01T00:00:01Z\t(1.21,1.22)\t\\N\t\\N\t\\N\t\\N
1767 2006-01-01T00:00:02Z\t(1.31,1.32)\t\\N\t\\N\t\\N\t\\N
1768 2006-01-02T00:00:00Z\t(2.11,2.12)\t\\N\t\\N\t\\N\t\\N
1769 2006-01-02T00:00:04Z\t(2.21,2.22)\t\\N\t\\N\t\\N\t\\N
1770 2006-01-02T00:00:16Z\t(2.31,2.32)\t\\N\t\\N\t\\N\t\\N
1771 2006-01-02T01:00:16Z\t(2.41,2.42)\t\\N\t\\N\t\\N\t\\N
1772 2006-01-02T01:00:17Z\t(2.451,2.452)\t\\N\t\\N\t\\N\t\\N
1773 2006-01-03T02:00:20Z\t(3.11,3.12)\t\\N\t\\N\t\\N\t\\N
1774 2006-01-03T02:00:21Z\t(3.21,3.22)\t\\N\t\\N\t\\N\t\\N
1775 2006-01-03T02:00:22Z\t(3.31,3.32)\t\\N\t\\N\t\\N\t\\N
1776 2006-01-03T02:00:23Z\t(3.41,3.42)\t\\N\t\\N\t\\N\t\\N
1777 2006-01-03T02:00:24Z\t(3.51,3.52)\t\\N\t\\N\t\\N\t\\N
1778 2006-01-03T02:00:25Z\t(3.61,3.62)\t\\N\t\\N\t\\N\t\\N
1779 2006-01-03T02:00:26Z\t(3.71,3.72)\t\\N\t\\N\t\\N\t\\N
1780 2006-01-03T02:00:27Z\t(3.81,3.82)\t\\N\t\\N\t\\N\t\\N
1783 "Read GPX, time-shift 0 seconds, output pgtab",
1788 diag
("Testing -v (--verbose) option...");
1789 likecmd
("$CMD -hv", # {{{
1790 '/^\n\S+ v\d\.\d\d\n/s',
1792 "Option --version with -h returns version number and help screen",
1796 diag
("Testing --version option...");
1797 likecmd
("$CMD --version", # {{{
1798 '/^\S+ v\d\.\d\d\n/',
1800 "Option --version returns version number",
1804 # --version option }}}
1805 diag
("Testing --strip-whitespace option..."); # {{{
1806 testcmd
("../gpst -w -o gpx pause-noname.gpx", # {{{
1808 $stripped_gpx_header
1811 <trkpt lat="60.425494" lon="5.299534"><ele>25.260</ele><time>2006-05-21T16:49:11Z</time></trkpt>
1812 <trkpt lat="60.425464" lon="5.299610"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
1813 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
1814 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
1815 <trkpt lat="60.425339" lon="5.299958"><ele>30.980</ele><time>2006-05-21T16:56:47Z</time></trkpt>
1816 <trkpt lat="60.425238" lon="5.299640"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
1817 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
1818 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
1819 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
1825 "Strip whitespace from GPX output",
1830 testcmd
("../gpst -o gpx -w comments.mayko", # {{{
1832 $stripped_gpx_header
1835 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
1836 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
1837 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
1838 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
1839 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
1840 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
1841 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
1844 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
1845 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
1851 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1856 testcmd
("../gpst -w -o pgwupd multitrack.gpx", # {{{
1859 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1860 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1863 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1864 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1867 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1868 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1871 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1872 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1875 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1876 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1879 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1880 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1884 "Strip whitespace from pgwupd output",
1889 # --strip-whitespace option }}}
1890 diag
("Testing --double-y-scale option..."); # {{{
1891 testcmd
("../gpst -y -o clean pause.gpx", # {{{
1893 5.299534\t120.850988\t25.260
1894 5.299610\t120.850928\t24.931
1895 5.299694\t120.850628\t27.975
1896 5.299741\t120.850768\t31.017
1897 5.299958\t120.850678\t30.980
1898 5.299640\t120.850476\t30.538
1899 5.299686\t120.850492\t30.515
1900 5.299773\t120.85069\t31.936
1901 5.299419\t120.850914\t31.794
1904 "Double y scale, clean output from gpx format",
1909 testcmd
("../gpst -y -o clean log.dos.mayko", # {{{
1911 8.1225077\t116.3636316\t
1912 8.1253200\t116.3637424\t
1913 8.1266031\t116.3632694\t
1914 8.1284612\t116.3624198\t
1915 8.1293950\t116.362063\t
1916 8.1307400\t116.3619242\t
1919 "Double y scale, clean output from mayko format",
1924 # --double-y-scale option }}}
1925 diag
("Testing --debug option..."); # {{{
1926 # --debug option }}}
1927 diag
("Strip error from Mayko format..."); # {{{
1929 testcmd
("../gpst -o csv date_error.mayko", # {{{
1931 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
1932 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
1933 2003-06-13T09:12:41Z\t5.5813636\t60.4283320\t\t
1934 2003-06-13T09:12:42Z\t5.5817430\t60.4283806\t\t
1937 "Strip error from mayko format in csv output",
1942 testcmd
("../gpst -o clean date_error.mayko", # {{{
1944 5.5794667\t60.4280897\t
1945 5.5802255\t60.4281867\t
1946 5.5813636\t60.4283320\t
1947 5.5817430\t60.4283806\t
1950 "Strip error from mayko format in clean output",
1955 testcmd
("../gpst -o gpsml date_error.mayko", # {{{
1957 <?xml version="1.0" encoding="UTF-8"?>
1960 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
1961 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
1962 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
1963 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
1964 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
1969 "Strip error from mayko format in gpsml output",
1974 testcmd
("../gpst -o gpx date_error.mayko", # {{{
1976 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1979 creator="gpst - http://sunny256.github.com/gpstools/"
1980 xmlns="http://www.topografix.com/GPX/1/1"
1981 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1982 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
1986 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
1987 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
1988 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
1989 <trkpt lat="60.4283320" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
1990 <trkpt lat="60.4283806" lon="5.5817430"> <time>2003-06-13T09:12:42Z</time> </trkpt>
1996 "Strip error from mayko format in gpx output",
2001 testcmd
("../gpst -o gpstrans date_error.mayko", # {{{
2003 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
2004 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
2005 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
2006 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
2007 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
2010 "Strip error from mayko format in gpstrans output",
2015 testcmd
("../gpst -o pgtab date_error.mayko", # {{{
2017 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N
2018 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N
2019 2003-06-13T09:12:41Z\t(60.4283320,5.5813636)\t\\N\t\\N\t\\N\t\\N
2020 2003-06-13T09:12:42Z\t(60.4283806,5.5817430)\t\\N\t\\N\t\\N\t\\N
2023 "Strip error from mayko format in pgtab output",
2028 testcmd
("../gpst -o poscount date_error.mayko", # {{{
2030 5.5802255\t60.4281867\t1
2031 5.5817430\t60.4283806\t1
2032 5.5813636\t60.4283320\t1
2033 5.5794667\t60.4280897\t1
2036 "Strip error from mayko format in poscount output",
2041 testcmd
("../gpst -o xgraph date_error.mayko", # {{{
2043 5.5794667 60.4280897
2044 5.5802255 60.4281867
2045 5.5813636 60.4283320
2046 5.5817430 60.4283806
2049 "Strip error from mayko format in xgraph output",
2054 testcmd
("../gpst -o ygraph date_error.mayko", # {{{
2057 5.5794667 60.4280897
2060 5.5802255 60.4281867
2063 5.5813636 60.4283320
2066 5.5817430 60.4283806
2070 "Strip error from mayko format in ygraph output",
2076 # Strip error from Mayko format }}}
2081 if ($Opt{'all'} || $Opt{'todo'}) {
2082 diag
("Running TODO tests..."); # {{{
2085 local $TODO = "Fix read/write of GPX name element";
2086 testcmd
("../gpst -o gpx pause.gpx", # {{{
2090 <name>ACTIVE LOG164705</name>
2092 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
2093 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
2094 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
2095 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
2096 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
2097 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
2098 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
2099 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
2100 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
2106 "Read and write name element from/to GPX",
2111 local $TODO = "Remove extra \\n in the beginning";
2112 testcmd
("../gpst -o csv multitrack.gpx", # {{{
2114 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
2115 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
2116 2003-02-11T23:36:14Z\t-0.1453202\t51.4969040\t\t
2118 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
2119 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
2120 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
2121 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
2123 2003-02-11T23:37:05Z\t-0.1458608\t51.4970680\t\t
2124 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
2125 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
2127 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
2128 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
2129 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
2130 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
2131 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
2134 "Output csv format from multitrack.gpx",
2139 testcmd
("../gpst -o csv pause.gpx", # {{{
2141 2006-05-21T16:49:11Z\t5.299534\t60.425494\t25.260\t
2142 2006-05-21T16:49:46Z\t5.299610\t60.425464\t24.931\t
2143 2006-05-21T16:52:04Z\t5.299694\t60.425314\t27.975\t
2144 2006-05-21T16:56:36Z\t5.299741\t60.425384\t31.017\t
2145 2006-05-21T16:56:47Z\t5.299958\t60.425339\t30.980\t
2146 2006-05-21T16:56:56Z\t5.299640\t60.425238\t30.538\t
2147 2006-05-21T16:57:03Z\t5.299686\t60.425246\t30.515\t
2148 2006-05-21T16:59:08Z\t5.299773\t60.425345\t31.936\t
2149 2006-05-21T17:00:54Z\t5.299419\t60.425457\t31.794\t
2152 "Output csv format from pause.gpx",
2157 testcmd
("../gpst -e -o csv pause.gpx", # {{{
2159 1148230151\t5.299534\t60.425494\t25.260\t
2160 1148230186\t5.299610\t60.425464\t24.931\t
2161 1148230324\t5.299694\t60.425314\t27.975\t
2162 1148230596\t5.299741\t60.425384\t31.017\t
2163 1148230607\t5.299958\t60.425339\t30.980\t
2164 1148230616\t5.299640\t60.425238\t30.538\t
2165 1148230623\t5.299686\t60.425246\t30.515\t
2166 1148230748\t5.299773\t60.425345\t31.936\t
2167 1148230854\t5.299419\t60.425457\t31.794\t
2170 "csv format with epoch seconds from gpx",
2175 $TODO = "Tweak output";
2176 testcmd
("../gpst -o gpx multitrack-pause.gpsml", # {{{
2177 file_data
("multitrack-pause.gpx"),
2179 "Should be equal to multitrack-pause.gpx",
2185 # list_nearest_waypoints() {{{
2187 like
(list_nearest_waypoints
(60.42541, 5.29959, 3),
2189 "list_nearest_waypoints()"
2197 diag
("Testing finished.");
2201 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc, $is_gpx) = @_;
2202 my $stderr_cmd = "";
2203 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2210 my $TMP_STDERR = "gpst-stderr.tmp";
2211 my $TMP_STDOUT = "gpst-stdout.tmp";
2213 if (defined($Exp_stderr) && !length($deb_str)) {
2214 $stderr_cmd = " 2>$TMP_STDERR";
2216 system("$Cmd$deb_str$stderr_cmd >$TMP_STDOUT");
2217 is
(file_data
($TMP_STDOUT), $Exp_stdout, $Txt);
2219 validate_gpx
($TMP_STDOUT, $Desc);
2221 if (defined($Exp_stderr)) {
2222 if (!length($deb_str)) {
2223 is
(file_data
($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
2224 unlink($TMP_STDERR);
2227 diag
("Warning: stderr not defined for '$Txt'");
2229 unlink($TMP_STDOUT);
2235 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2236 my $stderr_cmd = "";
2237 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2244 my $TMP_STDERR = "gpst-stderr.tmp";
2246 if (defined($Exp_stderr) && !length($deb_str)) {
2247 $stderr_cmd = " 2>$TMP_STDERR";
2249 like
(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt);
2250 if (defined($Exp_stderr)) {
2251 if (!length($deb_str)) {
2252 like
(file_data
($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)");
2253 unlink($TMP_STDERR);
2256 diag
("Warning: stderr not defined for '$Txt'");
2262 # Return file content as a string {{{
2265 if (open(FP
, "<", $File)) {
2266 $Txt = join("", <FP
>);
2276 # Check that a file is valid GPX {{{
2277 my ($File, $Txt) = @_;
2278 my $TMP_VALID = "validate_result.tmp";
2279 my $Result = system("xmllint --noout --schema ../Tools/xsd/gpx/gpx-1.1.xsd $File 2>$TMP_VALID");
2280 is
($Result, 0, "GPX for \"$Txt\" validates");
2282 diag
(file_data
($TMP_VALID));
2289 # Print program version {{{
2290 print("$progname v$VERSION\n");
2295 # Send the help message to stdout {{{
2298 if ($Opt{'verbose'}) {
2304 Usage: $progname [options] [file [files [...]]]
2306 Contains tests for the gpst(1) program.
2311 Run all tests, also TODOs.
2315 Run only the TODO tests.
2317 Increase level of verbosity. Can be repeated.
2319 Print version information.
2321 Print debugging messages.
2329 # Print a status message to stderr based on verbosity level {{{
2330 my ($verbose_level, $Txt) = @_;
2332 if ($Opt{'verbose'} >= $verbose_level) {
2333 print(STDERR
"$progname: $Txt\n");
2340 # Plain Old Documentation (POD) {{{
2350 run-tests.pl [options] [file [files [...]]]
2354 Contains tests for the gpst(1) program.
2360 =item B<-a>, B<--all>
2362 Run all tests, also TODOs.
2364 =item B<-h>, B<--help>
2366 Print a brief help summary.
2368 =item B<-t>, B<--todo>
2370 Run only the TODO tests.
2372 =item B<-v>, B<--verbose>
2374 Increase level of verbosity. Can be repeated.
2378 Print version information.
2382 Print debugging messages.
2388 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
2392 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
2393 This is free software; see the file F<COPYING> for legalese stuff.
2397 This program is free software: you can redistribute it and/or modify it
2398 under the terms of the GNU General Public License as published by the
2399 Free Software Foundation, either version 3 of the License, or (at your
2400 option) any later version.
2402 This program is distributed in the hope that it will be useful, but
2403 WITHOUT ANY WARRANTY; without even the implied warranty of
2404 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2405 See the GNU General Public License for more details.
2407 You should have received a copy of the GNU General Public License along
2409 If not, see L<http://www.gnu.org/licenses/>.
2419 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :