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 lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
1033 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
1039 "Output GPX from gpsml with missing data",
1045 testcmd
("../gpst -o xgraph multitrack.gpx", # {{{
1047 -0.1448824 51.4968266
1048 -0.1449938 51.4968227
1049 -0.1453202 51.4969040
1050 move -0.1453398 51.4969214
1051 -0.1455514 51.4969816
1052 -0.1457489 51.4970224
1053 -0.1457804 51.4970452
1054 move -0.1458608 51.4970680
1055 -0.1460047 51.4971658
1056 -0.1461614 51.4972469
1057 move -0.1462394 51.4972731
1058 -0.1463232 51.4973437
1059 -0.1462949 51.4973337
1060 -0.1462825 51.4973218
1061 -0.1462732 51.4973145
1064 "Output xgraph format from GPX",
1070 testcmd
("../gpst -o pgtab compact.gpx", # {{{
1072 2002-12-30T15:22:04Z\t(70.6609320,23.7028354)\t\\N\t\\N\t\\N\t\\N
1073 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N
1074 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N
1075 2002-12-30T15:22:11Z\t(70.6609381,23.7028620)\t\\N\t\\N\t\\N\t\\N
1076 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N
1077 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N
1078 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N
1079 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N
1080 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N
1081 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N
1082 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N
1083 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N
1086 "Output pgtab from gpx format",
1091 testcmd
("../gpst -o pgtab no_signal.mayko", # {{{
1093 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
1094 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
1095 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1096 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1097 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1098 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1099 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
1100 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
1101 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
1104 "Output pgtab from mayko format",
1109 testcmd
("../gpst -o pgtab missing.gpsml", # {{{
1111 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N
1112 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N
1113 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N
1116 "Output pgtab from missing.gpsml",
1122 testcmd
("../gpst -o csv log.dos.mayko", # {{{
1124 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1125 2003-06-15T10:27:53Z\t8.1253200\t58.1818712\t\t
1126 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1127 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1128 2003-06-15T10:28:06Z\t8.1293950\t58.1810315\t\t
1129 2003-06-15T10:28:10Z\t8.1307400\t58.1809621\t\t
1132 "Output csv from DOS-formatted Mayko format",
1138 testcmd
("../gpst -o pgwtab multitrack.gpx", # {{{
1140 (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
1141 (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
1142 (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
1143 (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
1144 (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
1145 (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
1148 "Test pgwtab format",
1154 testcmd
("../gpst -o pgwupd multitrack.gpx", # {{{
1157 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1158 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1161 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1162 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1165 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1166 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1169 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1170 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1173 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1174 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1177 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1178 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1182 "Test pgwupd format",
1188 testcmd
("../gpst -t -o clean pause.gpx", # {{{
1190 5.299534\t60.425494\t25.260
1191 5.299610\t60.425464\t24.931
1193 5.299694\t60.425314\t27.975
1195 5.299741\t60.425384\t31.017
1196 5.299958\t60.425339\t30.980
1197 5.299640\t60.425238\t30.538
1198 5.299686\t60.425246\t30.515
1200 5.299773\t60.425345\t31.936
1201 5.299419\t60.425457\t31.794
1204 "Output clean format with time breaks",
1213 # --output option }}}
1214 diag
("Testing --outside option..."); # {{{
1215 testcmd
("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx", # {{{
1217 <?xml version="1.0" encoding="UTF-8"?>
1220 <title>track1</title>
1221 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1222 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1223 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1225 <title>track2</title>
1227 <title>track3</title>
1229 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1230 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1231 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1232 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1233 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1238 "Check --outside option (gpx to gpst)",
1243 # --outside option }}}
1244 diag
("Testing --pos1 and --pos2 options..."); # {{{
1245 # --pos1 and --pos2 options }}}
1246 diag
("Testing --require option..."); # {{{
1247 testcmd
("../gpst -re multitrack.gpx", # {{{
1249 <?xml version="1.0" encoding="UTF-8"?>
1252 <title>Track 1</title>
1254 <title>Track 2</title>
1255 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1257 <title>Track 3</title>
1259 <title>Track 4</title>
1264 "Require elevation from GPX data",
1269 testcmd
("../gpst -re one_ele.dos.gpsml", # {{{
1271 <?xml version="1.0" encoding="UTF-8"?>
1274 <title>Only one point has elevation</title>
1275 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1280 "Require elevation from gpsml",
1285 testcmd
("../gpst -re missing.gpsml", # {{{
1287 <?xml version="1.0" encoding="UTF-8"?>
1290 <title>Missing various elements</title>
1291 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1292 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1293 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1294 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1295 <tp> <ele>486</ele> </tp>
1296 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1297 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1302 "Require elevation",
1307 testcmd
("../gpst -rt missing.gpsml", # {{{
1309 <?xml version="1.0" encoding="UTF-8"?>
1312 <title>Missing various elements</title>
1313 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1314 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1315 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1316 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1317 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1318 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1319 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1329 testcmd
("../gpst -rp missing.gpsml", # {{{
1331 <?xml version="1.0" encoding="UTF-8"?>
1334 <title>Missing various elements</title>
1335 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1336 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1337 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1347 testcmd
("../gpst -ret missing.gpsml", # {{{
1349 <?xml version="1.0" encoding="UTF-8"?>
1352 <title>Missing various elements</title>
1353 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1354 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1355 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1356 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1361 "Require elevation and time",
1366 testcmd
("../gpst -retp missing.gpsml", # {{{
1368 <?xml version="1.0" encoding="UTF-8"?>
1371 <title>Missing various elements</title>
1372 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1377 "Require elevation, time and position",
1382 testcmd
("../gpst -rep missing.gpsml", # {{{
1384 <?xml version="1.0" encoding="UTF-8"?>
1387 <title>Missing various elements</title>
1388 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1389 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1394 "Require elevation and position",
1399 # --require option }}}
1400 diag
("Testing --round option..."); # {{{
1401 testcmd
("../gpst -R lat=4,lon=5,ele=1 pause.gpx", # {{{
1403 <?xml version="1.0" encoding="UTF-8"?>
1406 <title>ACTIVE LOG164705</title>
1407 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1408 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1409 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1410 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1411 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1412 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1413 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1414 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1415 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1420 "--round works with lat, lon, ele from gpx",
1425 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgtab pause.gpx", # {{{
1427 2006-05-21T16:49:11Z\t(60.425,5.3)\t25.3\t\\N\t\\N\t\\N
1428 2006-05-21T16:49:46Z\t(60.425,5.3)\t24.9\t\\N\t\\N\t\\N
1429 2006-05-21T16:52:04Z\t(60.425,5.3)\t28\t\\N\t\\N\t\\N
1430 2006-05-21T16:56:36Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1431 2006-05-21T16:56:47Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1432 2006-05-21T16:56:56Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1433 2006-05-21T16:57:03Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1434 2006-05-21T16:59:08Z\t(60.425,5.3)\t31.9\t\\N\t\\N\t\\N
1435 2006-05-21T17:00:54Z\t(60.425,5.299)\t31.8\t\\N\t\\N\t\\N
1438 "pgtab output from gpx works with --round lat, lon, ele",
1443 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwtab multitrack.gpx", # {{{
1445 (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
1446 (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
1447 (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
1448 (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
1449 (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
1450 (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
1453 "--round works with lat, lon, ele from gpx, pgwtab output",
1458 testcmd
("../gpst -R lat=3,lon=3,ele=1 -o pgwupd multitrack.gpx", # {{{
1461 UPDATE logg SET name = clname(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1462 UPDATE logg SET dist = cldist(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1465 UPDATE logg SET name = clname(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1466 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1469 UPDATE logg SET name = clname(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1470 UPDATE logg SET dist = cldist(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1473 UPDATE logg SET name = clname(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1474 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1477 UPDATE logg SET name = clname(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1478 UPDATE logg SET dist = cldist(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1481 UPDATE logg SET name = clname(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1482 UPDATE logg SET dist = cldist(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1486 "pgwupd output and --round works with lat, lon, ele from gpx",
1491 # --round option }}}
1492 diag
("Testing --short-date option..."); # {{{
1493 # --short-date option }}}
1494 diag
("Testing --save-to-file option..."); # {{{
1495 # --save-to-file option }}}
1496 diag
("Testing --create-breaks option..."); # {{{
1497 testcmd
("../gpst -t pause.gpx", # {{{
1499 <?xml version="1.0" encoding="UTF-8"?>
1502 <title>ACTIVE LOG164705</title>
1503 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1504 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1505 <pause>0:00:02:18</pause>
1506 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1507 <pause>0:00:04:32</pause>
1508 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1509 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1510 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1511 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1512 <pause>0:00:02:05</pause>
1513 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1514 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1519 "Output gpsml with <pause> elements from GPX files",
1524 testcmd
("../gpst -t multitrack-pause.gpx", # {{{
1526 <?xml version="1.0" encoding="UTF-8"?>
1529 <title>track1</title>
1530 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1531 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1532 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1534 <title>track2</title>
1535 <pause>0:23:59:58</pause>
1536 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1537 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1538 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1539 <pause>0:01:00:00</pause>
1540 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1542 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1544 <title>track3</title>
1545 <pause>1:01:00:03</pause>
1546 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1547 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1548 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1550 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1551 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1552 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1553 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1554 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1559 "Insert <pause> between gpx tracks",
1564 testcmd
("../gpst -t multitrack-pause.gpsml", # {{{
1566 <?xml version="1.0" encoding="UTF-8"?>
1569 <title>track1</title>
1570 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1571 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1572 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1574 <title>track2</title>
1575 <pause>0:23:59:58</pause>
1576 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1577 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1578 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1579 <pause>0:01:00:00</pause>
1580 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1582 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1584 <title>track3</title>
1585 <pause>1:01:00:03</pause>
1586 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1587 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1588 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1590 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1591 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1592 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1593 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1594 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1599 "Insert <pause> between gpsml titles",
1604 # --create-breaks option }}}
1605 diag
("Testing -T (--time-shift) option...");
1606 testcmd
("$CMD -T 3600 multitrack-pause.gpx", # {{{
1608 <?xml version="1.0" encoding="UTF-8"?>
1611 <title>track1</title>
1612 <tp> <time>2006-01-01T01:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1613 <tp> <time>2006-01-01T01:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1614 <tp> <time>2006-01-01T01:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1616 <title>track2</title>
1617 <tp> <time>2006-01-02T01:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1618 <tp> <time>2006-01-02T01:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1619 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1620 <tp> <time>2006-01-02T02:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1622 <tp> <time>2006-01-02T02:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1624 <title>track3</title>
1625 <tp> <time>2006-01-03T03:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1626 <tp> <time>2006-01-03T03:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1627 <tp> <time>2006-01-03T03:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1629 <tp> <time>2006-01-03T03:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1630 <tp> <time>2006-01-03T03:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1631 <tp> <time>2006-01-03T03:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1632 <tp> <time>2006-01-03T03:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1633 <tp> <time>2006-01-03T03:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1638 "Add one hour to GPX input, output gpsml",
1643 testcmd
("$CMD -T -3600 multitrack-pause.gpx", # {{{
1645 <?xml version="1.0" encoding="UTF-8"?>
1648 <title>track1</title>
1649 <tp> <time>2005-12-31T23:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1650 <tp> <time>2005-12-31T23:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1651 <tp> <time>2005-12-31T23:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1653 <title>track2</title>
1654 <tp> <time>2006-01-01T23:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1655 <tp> <time>2006-01-01T23:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1656 <tp> <time>2006-01-01T23:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1657 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1659 <tp> <time>2006-01-02T00:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1661 <title>track3</title>
1662 <tp> <time>2006-01-03T01:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1663 <tp> <time>2006-01-03T01:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1664 <tp> <time>2006-01-03T01:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1666 <tp> <time>2006-01-03T01:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1667 <tp> <time>2006-01-03T01:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1668 <tp> <time>2006-01-03T01:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1669 <tp> <time>2006-01-03T01:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1670 <tp> <time>2006-01-03T01:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1675 "Subtract one hour from GPX input, output gpsml",
1680 testcmd
("$CMD -T 1 -o gpx multitrack-pause.gpx", # {{{
1685 <trkpt lat="1.11" lon="1.12"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1686 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:02Z</time> </trkpt>
1687 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:03Z</time> </trkpt>
1690 <trkpt lat="2.11" lon="2.12"> <time>2006-01-02T00:00:01Z</time> </trkpt>
1691 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:05Z</time> </trkpt>
1692 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:17Z</time> </trkpt>
1693 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:17Z</time> </trkpt>
1694 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:18Z</time> </trkpt>
1699 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1700 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1701 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1702 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1705 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1706 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1707 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:27Z</time> </trkpt>
1708 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:28Z</time> </trkpt>
1714 "Add one second to GPX input, output GPX",
1719 testcmd
("$CMD --time-shift -1 -o gpx multitrack-pause.gpsml", # {{{
1724 <trkpt lat="1.11" lon="1.12"> <time>2005-12-31T23:59:59Z</time> </trkpt>
1725 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:00Z</time> </trkpt>
1726 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1729 <trkpt lat="2.11" lon="2.12"> <time>2006-01-01T23:59:59Z</time> </trkpt>
1730 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:03Z</time> </trkpt>
1731 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:15Z</time> </trkpt>
1732 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:15Z</time> </trkpt>
1733 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:16Z</time> </trkpt>
1738 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:19Z</time> </trkpt>
1739 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:20Z</time> </trkpt>
1740 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1741 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1744 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1745 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1746 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1747 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1753 "Subtract one second from gpsml input, output GPX, use long option",
1758 testcmd
("$CMD -T 0 -o pgtab multitrack-pause.gpx", # {{{
1760 2006-01-01T00:00:00Z\t(1.11,1.12)\t\\N\t\\N\t\\N\t\\N
1761 2006-01-01T00:00:01Z\t(1.21,1.22)\t\\N\t\\N\t\\N\t\\N
1762 2006-01-01T00:00:02Z\t(1.31,1.32)\t\\N\t\\N\t\\N\t\\N
1763 2006-01-02T00:00:00Z\t(2.11,2.12)\t\\N\t\\N\t\\N\t\\N
1764 2006-01-02T00:00:04Z\t(2.21,2.22)\t\\N\t\\N\t\\N\t\\N
1765 2006-01-02T00:00:16Z\t(2.31,2.32)\t\\N\t\\N\t\\N\t\\N
1766 2006-01-02T01:00:16Z\t(2.41,2.42)\t\\N\t\\N\t\\N\t\\N
1767 2006-01-02T01:00:17Z\t(2.451,2.452)\t\\N\t\\N\t\\N\t\\N
1768 2006-01-03T02:00:20Z\t(3.11,3.12)\t\\N\t\\N\t\\N\t\\N
1769 2006-01-03T02:00:21Z\t(3.21,3.22)\t\\N\t\\N\t\\N\t\\N
1770 2006-01-03T02:00:22Z\t(3.31,3.32)\t\\N\t\\N\t\\N\t\\N
1771 2006-01-03T02:00:23Z\t(3.41,3.42)\t\\N\t\\N\t\\N\t\\N
1772 2006-01-03T02:00:24Z\t(3.51,3.52)\t\\N\t\\N\t\\N\t\\N
1773 2006-01-03T02:00:25Z\t(3.61,3.62)\t\\N\t\\N\t\\N\t\\N
1774 2006-01-03T02:00:26Z\t(3.71,3.72)\t\\N\t\\N\t\\N\t\\N
1775 2006-01-03T02:00:27Z\t(3.81,3.82)\t\\N\t\\N\t\\N\t\\N
1778 "Read GPX, time-shift 0 seconds, output pgtab",
1783 diag
("Testing -v (--verbose) option...");
1784 likecmd
("$CMD -hv", # {{{
1785 '/^\n\S+ v\d\.\d\d\n/s',
1787 "Option --version with -h returns version number and help screen",
1791 diag
("Testing --version option...");
1792 likecmd
("$CMD --version", # {{{
1793 '/^\S+ v\d\.\d\d\n/',
1795 "Option --version returns version number",
1799 # --version option }}}
1800 diag
("Testing --strip-whitespace option..."); # {{{
1801 testcmd
("../gpst -w -o gpx pause-noname.gpx", # {{{
1803 $stripped_gpx_header
1806 <trkpt lat="60.425494" lon="5.299534"><ele>25.260</ele><time>2006-05-21T16:49:11Z</time></trkpt>
1807 <trkpt lat="60.425464" lon="5.299610"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
1808 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
1809 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
1810 <trkpt lat="60.425339" lon="5.299958"><ele>30.980</ele><time>2006-05-21T16:56:47Z</time></trkpt>
1811 <trkpt lat="60.425238" lon="5.299640"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
1812 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
1813 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
1814 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
1820 "Strip whitespace from GPX output",
1825 testcmd
("../gpst -o gpx -w comments.mayko", # {{{
1827 $stripped_gpx_header
1830 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
1831 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
1832 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
1833 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
1834 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
1835 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
1836 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
1839 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
1840 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
1846 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1851 testcmd
("../gpst -w -o pgwupd multitrack.gpx", # {{{
1854 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1855 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1858 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1859 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1862 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1863 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1866 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1867 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1870 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1871 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1874 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1875 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1879 "Strip whitespace from pgwupd output",
1884 # --strip-whitespace option }}}
1885 diag
("Testing --double-y-scale option..."); # {{{
1886 testcmd
("../gpst -y -o clean pause.gpx", # {{{
1888 5.299534\t120.850988\t25.260
1889 5.299610\t120.850928\t24.931
1890 5.299694\t120.850628\t27.975
1891 5.299741\t120.850768\t31.017
1892 5.299958\t120.850678\t30.980
1893 5.299640\t120.850476\t30.538
1894 5.299686\t120.850492\t30.515
1895 5.299773\t120.85069\t31.936
1896 5.299419\t120.850914\t31.794
1899 "Double y scale, clean output from gpx format",
1904 testcmd
("../gpst -y -o clean log.dos.mayko", # {{{
1906 8.1225077\t116.3636316\t
1907 8.1253200\t116.3637424\t
1908 8.1266031\t116.3632694\t
1909 8.1284612\t116.3624198\t
1910 8.1293950\t116.362063\t
1911 8.1307400\t116.3619242\t
1914 "Double y scale, clean output from mayko format",
1919 # --double-y-scale option }}}
1920 diag
("Testing --debug option..."); # {{{
1921 # --debug option }}}
1922 diag
("Strip error from Mayko format..."); # {{{
1924 testcmd
("../gpst -o csv date_error.mayko", # {{{
1926 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
1927 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
1928 2003-06-13T09:12:41Z\t5.5813636\t60.4283320\t\t
1929 2003-06-13T09:12:42Z\t5.5817430\t60.4283806\t\t
1932 "Strip error from mayko format in csv output",
1937 testcmd
("../gpst -o clean date_error.mayko", # {{{
1939 5.5794667\t60.4280897\t
1940 5.5802255\t60.4281867\t
1941 5.5813636\t60.4283320\t
1942 5.5817430\t60.4283806\t
1945 "Strip error from mayko format in clean output",
1950 testcmd
("../gpst -o gpsml date_error.mayko", # {{{
1952 <?xml version="1.0" encoding="UTF-8"?>
1955 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
1956 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
1957 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
1958 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
1959 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
1964 "Strip error from mayko format in gpsml output",
1969 testcmd
("../gpst -o gpx date_error.mayko", # {{{
1971 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1974 creator="gpst - http://sunny256.github.com/gpstools/"
1975 xmlns="http://www.topografix.com/GPX/1/1"
1976 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1977 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
1981 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
1982 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
1983 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
1984 <trkpt lat="60.4283320" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
1985 <trkpt lat="60.4283806" lon="5.5817430"> <time>2003-06-13T09:12:42Z</time> </trkpt>
1991 "Strip error from mayko format in gpx output",
1996 testcmd
("../gpst -o gpstrans date_error.mayko", # {{{
1998 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
1999 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
2000 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
2001 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
2002 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
2005 "Strip error from mayko format in gpstrans output",
2010 testcmd
("../gpst -o pgtab date_error.mayko", # {{{
2012 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N
2013 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N
2014 2003-06-13T09:12:41Z\t(60.4283320,5.5813636)\t\\N\t\\N\t\\N\t\\N
2015 2003-06-13T09:12:42Z\t(60.4283806,5.5817430)\t\\N\t\\N\t\\N\t\\N
2018 "Strip error from mayko format in pgtab output",
2023 testcmd
("../gpst -o poscount date_error.mayko", # {{{
2025 5.5802255\t60.4281867\t1
2026 5.5817430\t60.4283806\t1
2027 5.5813636\t60.4283320\t1
2028 5.5794667\t60.4280897\t1
2031 "Strip error from mayko format in poscount output",
2036 testcmd
("../gpst -o xgraph date_error.mayko", # {{{
2038 5.5794667 60.4280897
2039 5.5802255 60.4281867
2040 5.5813636 60.4283320
2041 5.5817430 60.4283806
2044 "Strip error from mayko format in xgraph output",
2049 testcmd
("../gpst -o ygraph date_error.mayko", # {{{
2052 5.5794667 60.4280897
2055 5.5802255 60.4281867
2058 5.5813636 60.4283320
2061 5.5817430 60.4283806
2065 "Strip error from mayko format in ygraph output",
2071 # Strip error from Mayko format }}}
2076 if ($Opt{'all'} || $Opt{'todo'}) {
2077 diag
("Running TODO tests..."); # {{{
2080 local $TODO = "Fix read/write of GPX name element";
2081 testcmd
("../gpst -o gpx pause.gpx", # {{{
2085 <name>ACTIVE LOG164705</name>
2087 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
2088 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
2089 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
2090 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
2091 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
2092 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
2093 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
2094 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
2095 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
2101 "Read and write name element from/to GPX",
2106 local $TODO = "Remove extra \\n in the beginning";
2107 testcmd
("../gpst -o csv multitrack.gpx", # {{{
2109 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
2110 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
2111 2003-02-11T23:36:14Z\t-0.1453202\t51.4969040\t\t
2113 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
2114 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
2115 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
2116 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
2118 2003-02-11T23:37:05Z\t-0.1458608\t51.4970680\t\t
2119 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
2120 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
2122 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
2123 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
2124 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
2125 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
2126 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
2129 "Output csv format from multitrack.gpx",
2134 testcmd
("../gpst -o csv pause.gpx", # {{{
2136 2006-05-21T16:49:11Z\t5.299534\t60.425494\t25.260\t
2137 2006-05-21T16:49:46Z\t5.299610\t60.425464\t24.931\t
2138 2006-05-21T16:52:04Z\t5.299694\t60.425314\t27.975\t
2139 2006-05-21T16:56:36Z\t5.299741\t60.425384\t31.017\t
2140 2006-05-21T16:56:47Z\t5.299958\t60.425339\t30.980\t
2141 2006-05-21T16:56:56Z\t5.299640\t60.425238\t30.538\t
2142 2006-05-21T16:57:03Z\t5.299686\t60.425246\t30.515\t
2143 2006-05-21T16:59:08Z\t5.299773\t60.425345\t31.936\t
2144 2006-05-21T17:00:54Z\t5.299419\t60.425457\t31.794\t
2147 "Output csv format from pause.gpx",
2152 testcmd
("../gpst -e -o csv pause.gpx", # {{{
2154 1148230151\t5.299534\t60.425494\t25.260\t
2155 1148230186\t5.299610\t60.425464\t24.931\t
2156 1148230324\t5.299694\t60.425314\t27.975\t
2157 1148230596\t5.299741\t60.425384\t31.017\t
2158 1148230607\t5.299958\t60.425339\t30.980\t
2159 1148230616\t5.299640\t60.425238\t30.538\t
2160 1148230623\t5.299686\t60.425246\t30.515\t
2161 1148230748\t5.299773\t60.425345\t31.936\t
2162 1148230854\t5.299419\t60.425457\t31.794\t
2165 "csv format with epoch seconds from gpx",
2170 $TODO = "Tweak output";
2171 testcmd
("../gpst -o gpx multitrack-pause.gpsml", # {{{
2172 file_data
("multitrack-pause.gpx"),
2174 "Should be equal to multitrack-pause.gpx",
2180 # list_nearest_waypoints() {{{
2182 like
(list_nearest_waypoints
(60.42541, 5.29959, 3),
2184 "list_nearest_waypoints()"
2192 diag
("Testing finished.");
2196 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc, $is_gpx) = @_;
2197 my $stderr_cmd = "";
2198 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2205 my $TMP_STDERR = "gpst-stderr.tmp";
2206 my $TMP_STDOUT = "gpst-stdout.tmp";
2208 if (defined($Exp_stderr) && !length($deb_str)) {
2209 $stderr_cmd = " 2>$TMP_STDERR";
2211 system("$Cmd$deb_str$stderr_cmd >$TMP_STDOUT");
2212 is
(file_data
($TMP_STDOUT), $Exp_stdout, $Txt);
2214 validate_gpx
($TMP_STDOUT, $Desc);
2216 if (defined($Exp_stderr)) {
2217 if (!length($deb_str)) {
2218 is
(file_data
($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
2219 unlink($TMP_STDERR);
2222 diag
("Warning: stderr not defined for '$Txt'");
2224 unlink($TMP_STDOUT);
2230 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2231 my $stderr_cmd = "";
2232 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
2239 my $TMP_STDERR = "gpst-stderr.tmp";
2241 if (defined($Exp_stderr) && !length($deb_str)) {
2242 $stderr_cmd = " 2>$TMP_STDERR";
2244 like
(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt);
2245 if (defined($Exp_stderr)) {
2246 if (!length($deb_str)) {
2247 like
(file_data
($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)");
2248 unlink($TMP_STDERR);
2251 diag
("Warning: stderr not defined for '$Txt'");
2257 # Return file content as a string {{{
2260 if (open(FP
, "<", $File)) {
2261 $Txt = join("", <FP
>);
2271 # Check that a file is valid GPX {{{
2272 my ($File, $Txt) = @_;
2273 my $TMP_VALID = "validate_result.tmp";
2274 my $Result = system("xmllint --noout --schema ../Tools/xsd/gpx/gpx-1.1.xsd $File 2>$TMP_VALID");
2275 is
($Result, 0, "GPX for \"$Txt\" validates");
2277 diag
(file_data
($TMP_VALID));
2284 # Print program version {{{
2285 print("$progname v$VERSION\n");
2290 # Send the help message to stdout {{{
2293 if ($Opt{'verbose'}) {
2299 Usage: $progname [options] [file [files [...]]]
2301 Contains tests for the gpst(1) program.
2306 Run all tests, also TODOs.
2310 Run only the TODO tests.
2312 Increase level of verbosity. Can be repeated.
2314 Print version information.
2316 Print debugging messages.
2324 # Print a status message to stderr based on verbosity level {{{
2325 my ($verbose_level, $Txt) = @_;
2327 if ($Opt{'verbose'} >= $verbose_level) {
2328 print(STDERR
"$progname: $Txt\n");
2335 # Plain Old Documentation (POD) {{{
2345 run-tests.pl [options] [file [files [...]]]
2349 Contains tests for the gpst(1) program.
2355 =item B<-a>, B<--all>
2357 Run all tests, also TODOs.
2359 =item B<-h>, B<--help>
2361 Print a brief help summary.
2363 =item B<-t>, B<--todo>
2365 Run only the TODO tests.
2367 =item B<-v>, B<--verbose>
2369 Increase level of verbosity. Can be repeated.
2373 Print version information.
2377 Print debugging messages.
2383 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
2387 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
2388 This is free software; see the file F<COPYING> for legalese stuff.
2392 This program is free software: you can redistribute it and/or modify it
2393 under the terms of the GNU General Public License as published by the
2394 Free Software Foundation, either version 3 of the License, or (at your
2395 option) any later version.
2397 This program is distributed in the hope that it will be useful, but
2398 WITHOUT ANY WARRANTY; without even the implied warranty of
2399 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2400 See the GNU General Public License for more details.
2402 You should have received a copy of the GNU General Public License along
2404 If not, see L<http://www.gnu.org/licenses/>.
2414 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :