3 #=======================================================================
8 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
9 # License: GNU General Public License, see end of file for legal stuff.
10 #=======================================================================
13 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
19 use Test
::More
qw{no_plan
};
40 $progname =~ s
#^.*/(.*?)$#$1#;
43 my $id_date = $rcs_id;
44 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
46 Getopt
::Long
::Configure
("bundling");
48 "all|a" => \
$Opt{'all'},
49 "debug" => \
$Opt{'debug'},
50 "help|h" => \
$Opt{'help'},
51 "todo|t" => \
$Opt{'todo'},
52 "version" => \
$Opt{'version'},
53 ) || die("$progname: Option error. Use -h for help.\n");
56 'gpsbabel' => '/usr/local/bin/gpsbabel',
59 $Opt{'debug'} && ($Debug = 1);
60 $Opt{'help'} && usage
(0);
61 $Opt{'version'} && print_version
();
63 chomp(my $gpx_header = <<END);
64 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
67 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
68 xmlns="http://www.topografix.com/GPX/1/1"
69 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
70 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
73 my $stripped_gpx_header = $gpx_header;
74 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
76 if ($Opt{'todo'} && !$Opt{'all'}) {
82 diag
("Testing --chronology option with --xml..."); # {{{
83 testcmd
("../gpst --chronology --xml chronology-error.gpsml", # {{{
85 <?xml version="1.0" encoding="UTF-8"?>
88 <file>chronology-error.gpsml</file>
90 <corrtime>2006-05-02T09:46:46Z</corrtime>
91 <errtime>2006-05-02T09:40:07Z</errtime>
95 <file>chronology-error.gpsml</file>
97 <duptime>2006-05-02T10:18:09Z</duptime>
105 # --chronology option }}}
107 diag
("Testing conversion routines...");
109 # txt_to_xml() and xml_to_txt() {{{
111 is
(txt_to_xml
("abc"),
113 "txt_to_xml(\"abc\")");
114 is
(txt_to_xml
("<&>"),
116 "txt_to_xml(\"<&>\")");
117 is
(txt_to_xml
("first line\nsecond <\rthird\r\n<&>"),
118 "first line\nsecond <\rthird\r\n<&>",
119 "txt_to_xml() with multiline string");
121 is
(xml_to_txt
("abc"),
123 "xml_to_txt(\"abc\")");
124 is
(xml_to_txt
("<&>"),
126 "xml_to_txt(\"<&>\")");
127 is
(xml_to_txt
("first line\nsecond <\rthird\r\n<&>"),
128 "first line\nsecond <\rthird\r\n<&>",
129 "xml_to_txt() with multiline string");
131 # txt_to_xml() and xml_to_txt() }}}
132 # postgresql_copy_safe() {{{
134 is
(postgresql_copy_safe
(""),
136 "postgresql_copy_safe() with empty string");
138 is
(postgresql_copy_safe
("abcæøåÆØÅ"),
140 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
142 is
(postgresql_copy_safe
("abc\t'\r\n"),
144 "postgresql_copy_safe(\"abc\\t'\\r\\n\")");
146 is
(postgresql_copy_safe
("¤%/&gurgle\t325\\wer\ndfv'\r!\"#\n%\twe\r\x00sdf\xFFsadc\n\t\x00sdc\n"),
147 "¤%/&gurgle\\t325\\\\wer\\ndfv'\\r!\"#\\n%\\twe\\r\x00sdf\xFFsadc\\n\\t\x00sdc\\n",
148 "postgresql_copy_safe() with multiline, nulls and stuff");
150 # postgresql_copy_safe() }}}
152 diag
("Testing date routines...");
154 # sec_to_string() {{{
156 is
(sec_to_string
(1148220825),
157 "2006-05-21 14:13:45",
158 "sec_to_string() without separator");
159 is
(sec_to_string
(1148220825, "T"),
160 "2006-05-21T14:13:45",
161 "sec_to_string() with separator");
162 is
(sec_to_string
(-5000),
164 "sec_to_string(-5000) — negative numbers unsupported atm");
165 is
(sec_to_string
(""),
167 "sec_to_string(\"\")");
168 is
(sec_to_string
("pH()rtY tW0"),
170 "sec_to_string() with invalid string");
171 is
(sec_to_string
("00000000000000000000001148220825"),
172 "2006-05-21 14:13:45",
173 "sec_to_string() with a bunch of leading zeros");
174 is
(sec_to_string
("1148220825.93"),
175 "2006-05-21 14:13:45.93",
176 "sec_to_string() with decimals");
177 is
(sec_to_string
("000000000000000000000000000001148220825.7312"),
178 "2006-05-21 14:13:45.7312",
179 "sec_to_string() with decimals and prefixing zeros");
180 is
(sec_to_string
("1148220825.93000"),
181 "2006-05-21 14:13:45.93",
182 "sec_to_string() with decimals and extra trailing zeros");
183 is
(sec_to_string
(".863"),
184 "1970-01-01 00:00:00.863",
185 "sec_to_string() with missing zero before decimal point");
187 # sec_to_string() }}}
188 # sec_to_readable() {{{
190 is
(sec_to_readable
(0),
192 "sec_to_readable(0)");
193 is
(sec_to_readable
("pH()rtY tW0"),
195 "sec_to_readable() with invalid string");
196 is
(sec_to_readable
(86400),
198 "sec_to_readable(86400)");
199 is
(sec_to_readable
(86400*1000),
201 "sec_to_readable(86400*1000)");
202 is
(sec_to_readable
(86400+7200+180+4),
204 "sec_to_readable(86400+7200+180+4)");
205 is
(sec_to_readable
("3.14"),
207 "sec_to_readable(\"3.14\")");
208 is
(sec_to_readable
("-124"),
210 "sec_to_readable() rejects negative numbers");
211 is
(sec_to_readable
("-2.34"),
213 "sec_to_readable() rejects negative decimal");
214 is
(sec_to_readable
(".87"),
216 "sec_to_readable(), missing zero before decimal point");
217 is
(sec_to_readable
(""),
219 "sec_to_readable() with empty string");
221 # sec_to_readable() }}}
223 diag
("Testing geo routines...");
227 is
(ddd_to_dms
("12.34567"),
229 "ddd_to_dms(\"12.34567\")");
233 "ddd_to_dms(\"0\")");
239 is
(ddd_to_dms
("pH()rtY tW0"),
241 "ddd_to_dms(\"pH()rtY tW0\")");
243 is
(ddd_to_dms
("-12.34567"),
245 "ddd_to_dms(\"-12.34567\")");
247 is
(ddd_to_dms
("0.34567"),
249 "ddd_to_dms(\"0.34567\")");
251 is
(ddd_to_dms
(".34567"),
253 "ddd_to_dms(\".34567\")");
255 is
(ddd_to_dms
("-.34567"),
257 "ddd_to_dms(\"-.34567\")");
259 is
(ddd_to_dms
("-0.34567"),
261 "ddd_to_dms(\"-0.34567\")");
263 is
(ddd_to_dms
("180"),
265 "ddd_to_dms(\"180\")");
267 is
(ddd_to_dms
("-180"),
269 "ddd_to_dms(\"-180\")");
273 "ddd_to_dms(\"-1\")");
275 is
(ddd_to_dms
("2-3"),
277 "ddd_to_dms(\"2-3\")");
281 diag
("Testing trackpoint()..."); # {{{
287 "trackpoint() receives empty hash");
306 # trackpoint() (gpsml) {{{
310 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
311 "trackpoint() (gpsml)"
314 # trackpoint() (gpsml) }}}
315 # trackpoint() (gpx) {{{
317 $Dat{'format'} = "gpx";
320 qq{ <trkpt lat
="59.5214" lon
="7.392133"> <ele
>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt
>\n},
324 # trackpoint() (gpx) }}}
326 # trackpoint(): Various loop tests {{{
328 for my $Elem (qw{format lat lon type
}) {
331 $Dat{"$Elem"} = '2d';
334 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
339 for my $Elem (qw{year month day hour min sec
}) {
346 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
347 "trackpoint(): {'$Elem'} with empty value skips time"
351 $Dat{"$Elem"} = '2d';
353 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
354 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") skips time"
358 $Dat{$Elem} = "00000$Dat{$Elem}";
360 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
361 "trackpoint(): Strip prefixing zeros from {'$Elem'}"
365 $Dat{"$Elem"} = 0-$Dat{$Elem};
367 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
368 "trackpoint(): {'$Elem'} is negative, skip time"
371 if ($Elem ne "sec") {
373 $Dat{"$Elem"} = "$Dat{$Elem}.00";
375 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
376 "trackpoint(): Decimals in {'$Elem'}, skip time"
384 $Dat{'sec'} = "$Dat{'sec'}.00";
386 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
387 "trackpoint(): Remove trailing zeros in {'sec'} decimals"
390 for my $Elem (qw{format type error
}) {
395 "trackpoint(): Missing {'$Elem'}, return undef"
399 # Various loop tests }}}
403 diag
("Testing output from ../gpst");
405 diag
("Read empty input (/dev/null)..."); # {{{
406 testcmd
("../gpst </dev/null", # {{{
408 <?xml version="1.0" encoding="UTF-8"?>
418 testcmd
("../gpst -o gpx </dev/null", # {{{
432 diag
("Read empty files..."); # {{{
433 testcmd
("echo '<tp> </tp>' | ../gpst", # {{{
435 <?xml version="1.0" encoding="UTF-8"?>
442 "Don’t print empty trackpoints",
446 # Read empty files }}}
447 diag
("Testing --chronology option..."); # {{{
448 testcmd
("../gpst --chronology chronology-error.gpsml", # {{{
450 <?xml version="1.0" encoding="UTF-8"?>
453 <title>Chronology errors</title>
454 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
455 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
456 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
458 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
460 <pause>0:00:37:54</pause>
461 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
462 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
463 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
464 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
465 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
466 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
470 "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" .
471 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
472 "Check for chronology errors and duplicated times",
476 # --chronology option }}}
477 diag
("Testing --skip-dups option..."); # {{{
478 testcmd
("../gpst -d no_signal.mayko", # {{{
480 <?xml version="1.0" encoding="UTF-8"?>
483 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
484 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
485 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
486 <etp err="dup"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
487 <etp err="dup"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
488 <etp err="dup"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
489 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
490 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
491 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
496 "Remove duplicated positions from gpsml",
500 testcmd
("../gpst -d -o csv no_signal.mayko", # {{{
502 2002-12-22T21:42:24Z\t23.6746151\t70.6800486\t\t
503 2002-12-22T21:42:32Z\t23.6740038\t70.6799322\t\t
504 2002-12-22T21:42:54Z\t23.6723991\t70.6796266\t\t
505 2002-12-22T21:44:45Z\t23.6757566\t70.6800774\t\t
506 2002-12-22T21:44:52Z\t23.6753442\t70.6801502\t\t
507 2002-12-22T21:45:04Z\t23.6757542\t70.6801905\t\t
510 "Remove duplicated positions from csv output format",
514 testcmd
("../gpst -d -o clean no_signal.mayko", # {{{
516 23.6746151\t70.6800486\t
517 23.6740038\t70.6799322\t
518 23.6723991\t70.6796266\t
519 23.6757566\t70.6800774\t
520 23.6753442\t70.6801502\t
521 23.6757542\t70.6801905\t
524 "Remove duplicated positions from clean output format",
528 testcmd
("../gpst -d -o pgtab no_signal.mayko", # {{{
530 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N\t\\N
531 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N\t\\N
532 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
533 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N\t\\N
534 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N\t\\N
535 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N\t\\N
538 "Remove duplicated positions from pgtab output format",
542 # --skip-dups option }}}
543 diag
("Testing --epoch option..."); # {{{
544 testcmd
("../gpst --epoch pause.gpx", # {{{
546 <?xml version="1.0" encoding="UTF-8"?>
549 <title>ACTIVE LOG164705</title>
550 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
551 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
552 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
553 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
554 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
555 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
556 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
557 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
558 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
563 "--epoch is ignored in gpsml output",
567 testcmd
("../gpst --epoch -o gpx pause.gpx", # {{{
572 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
573 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
574 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
575 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
576 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
577 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
578 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
579 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
580 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
586 "--epoch is ignored in gpx output",
591 diag
("Testing --fix option..."); # {{{
592 testcmd
("../gpst --fix --chronology chronology-error.gpsml", # {{{
594 <?xml version="1.0" encoding="UTF-8"?>
597 <title>Chronology errors</title>
598 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
599 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
600 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
602 <etp err="chrono"> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </etp>
604 <pause>0:00:37:54</pause>
605 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
606 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
607 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
608 <etp err="duptime"> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </etp>
609 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
610 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
614 "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" .
615 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
616 "Remove bad timestamps",
621 diag
("Testing --from-date option..."); # {{{
622 # --from-date option }}}
623 diag
("Testing --help option..."); # {{{
625 diag
("Testing --inside option..."); # {{{
626 # --inside option }}}
627 diag
("Testing --undefined option..."); # {{{
628 # --undefined option }}}
629 diag
("Testing --near option..."); # {{{
631 diag
("Testing --output option..."); # {{{
633 testcmd
("../gpst log.mcsv", # {{{
635 <?xml version="1.0" encoding="UTF-8"?>
639 <title>ACTIVE LOG 125</title>
640 <tp> <time>2006-03-04T11:12:30Z</time> <lat>54.96883</lat> <lon>-1.62439</lon> <ele>77</ele> </tp>
641 <tp> <time>2006-03-04T11:12:47Z</time> <lat>54.96878</lat> <lon>-1.62413</lon> <ele>77</ele> </tp>
642 <tp> <time>2006-03-04T11:12:55Z</time> <lat>54.96913</lat> <lon>-1.62616</lon> <ele>77</ele> </tp>
643 <tp> <time>2006-03-04T11:13:04Z</time> <lat>54.96934</lat> <lon>-1.62624</lon> <ele>77.5</ele> </tp>
644 <tp> <time>2006-03-04T11:13:33Z</time> <lat>54.96934</lat> <lon>-1.62596</lon> <ele>78</ele> </tp>
645 <tp> <time>2006-03-04T11:13:48Z</time> <lat>54.96931</lat> <lon>-1.62645</lon> <ele>78</ele> </tp>
646 <tp> <time>2006-03-04T11:14:05Z</time> <lat>54.96918</lat> <lon>-1.62603</lon> <ele>79</ele> </tp>
647 <tp> <time>2006-03-04T11:14:33Z</time> <lat>54.96901</lat> <lon>-1.62364</lon> <ele>76.1</ele> </tp>
648 <tp> <time>2006-03-04T11:15:02Z</time> <lat>54.96922</lat> <lon>-1.6254</lon> <ele>76.1</ele> </tp>
649 <tp> <time>2006-03-04T11:15:27Z</time> <lat>54.96914</lat> <lon>-1.62526</lon> <ele>75.1</ele> </tp>
650 <tp> <time>2006-03-04T11:15:50Z</time> <lat>54.96911</lat> <lon>-1.62494</lon> <ele>75.1</ele> </tp>
651 <tp> <time>2006-03-04T11:16:03Z</time> <lat>54.9693</lat> <lon>-1.62489</lon> <ele>75.1</ele> </tp>
652 <tp> <time>2006-03-04T11:16:19Z</time> <lat>54.96901</lat> <lon>-1.62496</lon> <ele>75.1</ele> </tp>
653 <tp> <time>2006-03-04T11:16:52Z</time> <lat>54.96871</lat> <lon>-1.62466</lon> <ele>74.6</ele> </tp>
654 <tp> <time>2006-03-04T11:17:25Z</time> <lat>54.96908</lat> <lon>-1.62488</lon> <ele>72.7</ele> </tp>
656 <title>ACTIVE LOG 126</title>
657 <tp> <time>2006-03-04T11:18:32Z</time> <lat>54.96904</lat> <lon>-1.62482</lon> <ele>72.7</ele> </tp>
658 <tp> <time>2006-03-04T11:18:35Z</time> <lat>54.96913</lat> <lon>-1.62499</lon> <ele>71.3</ele> </tp>
659 <tp> <time>2006-03-04T11:18:38Z</time> <lat>54.96904</lat> <lon>-1.62497</lon> <ele>70.8</ele> </tp>
660 <tp> <time>2006-03-04T11:18:48Z</time> <lat>54.96913</lat> <lon>-1.62496</lon> <ele>71.8</ele> </tp>
661 <tp> <time>2006-03-04T11:18:55Z</time> <lat>54.96924</lat> <lon>-1.62501</lon> <ele>72.2</ele> </tp>
662 <tp> <time>2006-03-04T11:19:11Z</time> <lat>54.9694</lat> <lon>-1.62521</lon> <ele>71.8</ele> </tp>
663 <tp> <time>2006-03-04T11:19:30Z</time> <lat>54.96916</lat> <lon>-1.62515</lon> <ele>71.3</ele> </tp>
664 <tp> <time>2006-03-04T11:19:53Z</time> <lat>54.96921</lat> <lon>-1.625</lon> <ele>71.3</ele> </tp>
665 <tp> <time>2006-03-04T11:20:21Z</time> <lat>54.96801</lat> <lon>-1.62417</lon> <ele>71.8</ele> </tp>
667 <title>ACTIVE LOG 127</title>
668 <tp> <time>2006-03-04T11:21:16Z</time> <lat>54.96887</lat> <lon>-1.62504</lon> <ele>70.8</ele> </tp>
669 <tp> <time>2006-03-04T11:21:18Z</time> <lat>54.96898</lat> <lon>-1.62476</lon> <ele>69.8</ele> </tp>
670 <tp> <time>2006-03-04T11:21:29Z</time> <lat>54.9691</lat> <lon>-1.62475</lon> <ele>69.4</ele> </tp>
671 <tp> <time>2006-03-04T11:21:46Z</time> <lat>54.96918</lat> <lon>-1.62468</lon> <ele>70.3</ele> </tp>
672 <tp> <time>2006-03-04T11:22:39Z</time> <lat>54.9692</lat> <lon>-1.62465</lon> <ele>69.4</ele> </tp>
673 <tp> <time>2006-03-04T11:22:43Z</time> <lat>54.96924</lat> <lon>-1.62462</lon> <ele>71.8</ele> </tp>
674 <tp> <time>2006-03-04T11:22:45Z</time> <lat>54.96928</lat> <lon>-1.62463</lon> <ele>71.8</ele> </tp>
675 <tp> <time>2006-03-04T11:23:00Z</time> <lat>54.96945</lat> <lon>-1.62466</lon> <ele>69.4</ele> </tp>
680 "Read Mapsource TAB-separated format",
684 testcmd
("../gpst two-digit_year.mcsv", # {{{
686 <?xml version="1.0" encoding="UTF-8"?>
690 <title>ACTIVE LOG 032</title>
691 <tp> <time>2006-03-20T20:35:33Z</time> <lat>60.41324</lat> <lon>5.33352</lon> <ele>14</ele> </tp>
692 <tp> <time>2006-03-20T20:35:38Z</time> <lat>60.38802</lat> <lon>5.33845</lon> <ele>18</ele> </tp>
693 <tp> <time>2006-03-20T20:35:44Z</time> <lat>60.38709</lat> <lon>5.3379</lon> <ele>19</ele> </tp>
694 <tp> <time>2006-03-20T20:35:49Z</time> <lat>60.38641</lat> <lon>5.33732</lon> <ele>18</ele> </tp>
695 <tp> <time>2006-03-20T20:35:54Z</time> <lat>60.38581</lat> <lon>5.33647</lon> <ele>18</ele> </tp>
696 <tp> <time>2006-03-20T20:36:00Z</time> <lat>60.38516</lat> <lon>5.33528</lon> <ele>15</ele> </tp>
697 <tp> <time>2006-03-20T20:36:02Z</time> <lat>60.38495</lat> <lon>5.3349</lon> <ele>13</ele> </tp>
702 "Read Mapsource TAB-separated format with two-digit year",
706 testcmd
("../gpst log.gpstxt", # {{{
708 <?xml version="1.0" encoding="UTF-8"?>
711 <tp> <time>2003-06-13T14:36:09Z</time> <lat>59.521517</lat> <lon>7.391867</lon> <ele>762</ele> </tp>
712 <tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>
713 <tp> <time>2003-06-13T14:36:11Z</time> <lat>59.5213</lat> <lon>7.392417</lon> <ele>761</ele> </tp>
714 <tp> <time>2003-06-13T14:36:12Z</time> <lat>59.521183</lat> <lon>7.3927</lon> <ele>761</ele> </tp>
715 <etp err="nosignal"> <time>2003-06-13T14:36:13Z</time> </etp>
716 <tp> <time>2003-06-13T14:36:15Z</time> <lat>59.52085</lat> <lon>7.393517</lon> <ele>760</ele> </tp>
717 <tp> <time>2003-06-13T14:36:16Z</time> <lat>59.520733</lat> <lon>7.393783</lon> <ele>760</ele> </tp>
718 <tp> <time>2003-06-13T14:36:17Z</time> <lat>59.52065</lat> <lon>7.39405</lon> <ele>760</ele> </tp>
719 <tp> <time>2003-06-13T14:36:18Z</time> <lat>59.520583</lat> <lon>7.394333</lon> <ele>760</ele> </tp>
720 <tp> <time>2003-06-13T14:36:19Z</time> <lat>59.520533</lat> <lon>7.394633</lon> <ele>759</ele> </tp>
721 <tp> <time>2003-06-13T14:36:20Z</time> <lat>59.520483</lat> <lon>7.394917</lon> <ele>759</ele> </tp>
722 <tp> <time>2003-06-13T14:36:21Z</time> <lat>59.520433</lat> <lon>7.395233</lon> <ele>759</ele> </tp>
723 <etp err="nosignal"> <time>2003-06-13T14:36:22Z</time> </etp>
724 <tp> <time>2003-06-13T14:36:24Z</time> <lat>59.520283</lat> <lon>7.396233</lon> <ele>758</ele> </tp>
725 <tp> <time>2003-06-13T14:36:25Z</time> <lat>59.520233</lat> <lon>7.39655</lon> <ele>758</ele> </tp>
726 <tp> <time>2003-06-13T14:36:26Z</time> <lat>59.520183</lat> <lon>7.396883</lon> <ele>757</ele> </tp>
727 <tp> <time>2003-06-13T14:36:27Z</time> <lat>59.520133</lat> <lon>7.397217</lon> <ele>757</ele> </tp>
728 <tp> <time>2003-06-13T14:36:28Z</time> <lat>59.5201</lat> <lon>7.397567</lon> <ele>757</ele> </tp>
733 "Read Garmin serial text format",
737 testcmd
("../gpst log.dos.mayko", # {{{
739 <?xml version="1.0" encoding="UTF-8"?>
742 <tp> <time>2003-06-15T10:27:45Z</time> <lat>58.1818158</lat> <lon>8.1225077</lon> </tp>
743 <tp> <time>2003-06-15T10:27:53Z</time> <lat>58.1818712</lat> <lon>8.12532</lon> </tp>
744 <tp> <time>2003-06-15T10:27:57Z</time> <lat>58.1816347</lat> <lon>8.1266031</lon> </tp>
745 <tp> <time>2003-06-15T10:28:03Z</time> <lat>58.1812099</lat> <lon>8.1284612</lon> </tp>
746 <tp> <time>2003-06-15T10:28:06Z</time> <lat>58.1810315</lat> <lon>8.129395</lon> </tp>
747 <tp> <time>2003-06-15T10:28:10Z</time> <lat>58.1809621</lat> <lon>8.13074</lon> </tp>
752 "Read DOS-formatted Mayko format",
756 testcmd
("../gpst log.dos.gpstxt", # {{{
758 <?xml version="1.0" encoding="UTF-8"?>
761 <tp> <time>2003-01-05T16:47:11Z</time> <lat>66.908167</lat> <lon>15.022983</lon> <ele>11472</ele> </tp>
762 <tp> <time>2003-01-05T16:47:12Z</time> <lat>66.90625</lat> <lon>15.020667</lon> <ele>11472</ele> </tp>
763 <tp> <time>2003-01-05T16:47:13Z</time> <lat>66.904317</lat> <lon>15.01835</lon> <ele>11472</ele> </tp>
764 <tp> <time>2003-01-05T16:47:14Z</time> <lat>66.9024</lat> <lon>15.016017</lon> <ele>11473</ele> </tp>
765 <tp> <time>2003-01-05T16:47:15Z</time> <lat>66.900483</lat> <lon>15.0137</lon> <ele>11474</ele> </tp>
766 <tp> <time>2003-01-05T16:47:16Z</time> <lat>66.898567</lat> <lon>15.011383</lon> <ele>11474</ele> </tp>
767 <tp> <time>2003-01-05T16:47:17Z</time> <lat>66.896633</lat> <lon>15.009067</lon> <ele>11475</ele> </tp>
768 <tp> <time>2003-01-05T16:47:18Z</time> <lat>66.894717</lat> <lon>15.006733</lon> <ele>11475</ele> </tp>
769 <tp> <time>2003-01-05T16:47:19Z</time> <lat>66.8928</lat> <lon>15.004417</lon> <ele>11475</ele> </tp>
770 <tp> <time>2003-01-05T16:47:20Z</time> <lat>66.890867</lat> <lon>15.0021</lon> <ele>11475</ele> </tp>
771 <tp> <time>2003-01-05T16:47:21Z</time> <lat>66.88895</lat> <lon>14.999783</lon> <ele>11475</ele> </tp>
776 "Read DOS-formatted Garmin serial text format",
780 testcmd
("../gpst log.unix.mcsv", # {{{
782 <?xml version="1.0" encoding="UTF-8"?>
786 <title>ACTIVE LOG 058</title>
787 <tp> <time>2006-02-21T15:14:25Z</time> <lat>60.36662</lat> <lon>5.24885</lon> <ele>31.9</ele> </tp>
788 <tp> <time>2006-02-21T15:14:30Z</time> <lat>60.37057</lat> <lon>5.22956</lon> <ele>35.2</ele> </tp>
789 <tp> <time>2006-02-21T15:14:35Z</time> <lat>60.37019</lat> <lon>5.22817</lon> <ele>39.6</ele> </tp>
790 <tp> <time>2006-02-21T15:14:36Z</time> <lat>60.37012</lat> <lon>5.2279</lon> <ele>41</ele> </tp>
791 <tp> <time>2006-02-21T15:14:40Z</time> <lat>60.37009</lat> <lon>5.22682</lon> <ele>47.2</ele> </tp>
792 <tp> <time>2006-02-21T15:14:42Z</time> <lat>60.37011</lat> <lon>5.22641</lon> <ele>49.2</ele> </tp>
793 <tp> <time>2006-02-21T15:14:44Z</time> <lat>60.37011</lat> <lon>5.22607</lon> <ele>50.1</ele> </tp>
794 <tp> <time>2006-02-21T15:14:48Z</time> <lat>60.37002</lat> <lon>5.22568</lon> <ele>51.1</ele> </tp>
795 <tp> <time>2006-02-21T15:14:51Z</time> <lat>60.3701</lat> <lon>5.22548</lon> <ele>52.5</ele> </tp>
800 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
804 testcmd
("../gpst multitrack.gpx", # {{{
806 <?xml version="1.0" encoding="UTF-8"?>
809 <title>Track 1</title>
810 <tp> <time>2003-02-11T23:35:39Z</time> <lat>51.4968266</lat> <lon>-0.1448824</lon> </tp>
811 <tp> <time>2003-02-11T23:35:49Z</time> <lat>51.4968227</lat> <lon>-0.1449938</lon> </tp>
812 <tp> <time>2003-02-11T23:36:14Z</time> <lat>51.496904</lat> <lon>-0.1453202</lon> </tp>
814 <title>Track 2</title>
815 <tp> <time>2003-02-11T23:36:16Z</time> <lat>51.4969214</lat> <lon>-0.1453398</lon> </tp>
816 <tp> <time>2003-02-11T23:36:31Z</time> <lat>51.4969816</lat> <lon>-0.1455514</lon> </tp>
817 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
818 <tp> <time>2003-02-11T23:36:50Z</time> <lat>51.4970452</lat> <lon>-0.1457804</lon> </tp>
820 <title>Track 3</title>
821 <tp> <time>2003-02-11T23:37:05Z</time> <lat>51.497068</lat> <lon>-0.1458608</lon> </tp>
822 <tp> <time>2003-02-11T23:37:22Z</time> <lat>51.4971658</lat> <lon>-0.1460047</lon> </tp>
823 <tp> <time>2003-02-11T23:37:36Z</time> <lat>51.4972469</lat> <lon>-0.1461614</lon> </tp>
825 <title>Track 4</title>
826 <tp> <time>2003-02-11T23:37:43Z</time> <lat>51.4972731</lat> <lon>-0.1462394</lon> </tp>
827 <tp> <time>2003-02-11T23:38:04Z</time> <lat>51.4973437</lat> <lon>-0.1463232</lon> </tp>
828 <tp> <time>2003-02-11T23:38:28Z</time> <lat>51.4973337</lat> <lon>-0.1462949</lon> </tp>
829 <tp> <time>2003-02-11T23:38:34Z</time> <lat>51.4973218</lat> <lon>-0.1462825</lon> </tp>
830 <tp> <time>2003-02-11T23:38:35Z</time> <lat>51.4973145</lat> <lon>-0.1462732</lon> </tp>
835 "Read GPX file with multiple tracks",
839 testcmd
("../gpst compact.gpx", # {{{
841 <?xml version="1.0" encoding="UTF-8"?>
844 <title>All whitespace stripped</title>
845 <tp> <time>2002-12-30T15:22:04Z</time> <lat>70.660932</lat> <lon>23.7028354</lon> </tp>
846 <tp> <time>2002-12-30T15:22:06Z</time> <lat>70.6609392</lat> <lon>23.7028468</lon> </tp>
847 <tp> <time>2002-12-30T15:22:08Z</time> <lat>70.6609429</lat> <lon>23.7028499</lon> </tp>
848 <tp> <time>2002-12-30T15:22:11Z</time> <lat>70.6609381</lat> <lon>23.702862</lon> </tp>
849 <tp> <time>2002-12-30T15:22:12Z</time> <lat>70.6609368</lat> <lon>23.7028648</lon> </tp>
850 <tp> <time>2002-12-30T15:22:13Z</time> <lat>70.6609344</lat> <lon>23.7028652</lon> </tp>
851 <tp> <time>2002-12-30T15:22:15Z</time> <lat>70.6609349</lat> <lon>23.7028707</lon> </tp>
852 <tp> <time>2002-12-30T15:22:17Z</time> <lat>70.6609348</lat> <lon>23.7028654</lon> </tp>
853 <tp> <time>2002-12-30T15:22:19Z</time> <lat>70.6609347</lat> <lon>23.7028599</lon> </tp>
854 <tp> <time>2002-12-30T15:22:20Z</time> <lat>70.6609348</lat> <lon>23.7028609</lon> </tp>
855 <tp> <time>2002-12-30T15:22:23Z</time> <lat>70.6609388</lat> <lon>23.7028653</lon> </tp>
856 <tp> <time>2002-12-30T15:22:25Z</time> <lat>70.6609426</lat> <lon>23.7028732</lon> </tp>
861 "Read GPX one-liner",
865 testcmd
("../gpst missing.gpsml", # {{{
867 <?xml version="1.0" encoding="UTF-8"?>
870 <title>Missing various elements</title>
871 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
872 <tp> <time>2006-04-30T17:17:00Z</time> </tp>
873 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
874 <tp> <time>2006-04-30T17:17:11Z</time> <ele>483</ele> </tp>
875 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
876 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
877 <tp> <ele>484</ele> </tp>
878 <tp> <ele>486</ele> </tp>
879 <tp> <desc>Missing everything</desc> </tp>
880 <tp> <time>2006-04-30T17:18:03Z</time> <ele>490</ele> </tp>
881 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
886 "Read gpsml with various data missing",
890 testcmd
("../gpst different_dateformats.gpsml", # {{{
892 <?xml version="1.0" encoding="UTF-8"?>
895 <title>Date format variations</title>
896 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1</lat> <lon>1</lon> </tp>
897 <tp> <time>2006-01-01T00:00:02Z</time> <lat>2</lat> <lon>2</lon> </tp>
898 <tp> <time>2006-01-01T00:00:03Z</time> <lat>3</lat> <lon>3</lon> </tp>
899 <tp> <time>2006-01-01T00:00:04Z</time> <lat>4</lat> <lon>4</lon> </tp>
904 "Read different date formats from gpsml file",
908 testcmd
("../gpst multitrack-pause.gpx", # {{{
909 file_data
("multitrack-pause.gpsml"),
911 "Should be equal to multitrack-pause.gpsml",
916 testcmd
("../gpst -o gpx no_signal.mayko", # {{{
921 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
922 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
923 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
924 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> </trkpt>
925 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> </trkpt>
926 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> </trkpt>
927 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
928 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
929 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
935 "Output GPX from Mayko file with duplicates",
939 testcmd
("../gpst -o gpx comments.mayko", # {{{
944 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
945 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
946 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
947 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
948 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
949 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
950 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
953 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
954 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
960 "Output GPX from Mayko file with commented-out lines",
964 testcmd
("../gpst -o gpx missing.gpsml", # {{{
969 <trkpt lat="60.42353" lon="5.34185"> <time>2006-04-30T17:17:09Z</time> </trkpt>
970 <trkpt> <ele>483</ele> <time>2006-04-30T17:17:11Z</time> </trkpt>
971 <trkpt> <ele>485</ele> <time>2006-04-30T17:17:22Z</time> </trkpt>
972 <trkpt lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
973 <trkpt> <ele>484</ele> </trkpt>
974 <trkpt> <ele>486</ele> </trkpt>
975 <trkpt> <ele>490</ele> <time>2006-04-30T17:18:03Z</time> </trkpt>
976 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
982 "Output GPX from gpsml with missing data",
987 testcmd
("../gpst -o xgraph multitrack.gpx", # {{{
989 -0.1448824 51.4968266
990 -0.1449938 51.4968227
991 -0.1453202 51.4969040
992 move -0.1453398 51.4969214
993 -0.1455514 51.4969816
994 -0.1457489 51.4970224
995 -0.1457804 51.4970452
996 move -0.1458608 51.4970680
997 -0.1460047 51.4971658
998 -0.1461614 51.4972469
999 move -0.1462394 51.4972731
1000 -0.1463232 51.4973437
1001 -0.1462949 51.4973337
1002 -0.1462825 51.4973218
1003 -0.1462732 51.4973145
1006 "Output xgraph format from GPX"
1011 testcmd
("../gpst -o pgtab compact.gpx", # {{{
1013 2002-12-30T15:22:04Z\t(70.6609320,23.7028354)\t\\N\t\\N\t\\N\t\\N\t\\N
1014 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N\t\\N
1015 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N\t\\N
1016 2002-12-30T15:22:11Z\t(70.6609381,23.7028620)\t\\N\t\\N\t\\N\t\\N\t\\N
1017 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N\t\\N
1018 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N\t\\N
1019 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N\t\\N
1020 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N\t\\N
1021 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N\t\\N
1022 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N\t\\N
1023 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N\t\\N
1024 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N\t\\N
1030 testcmd
("../gpst -o pgtab no_signal.mayko", # {{{
1032 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N\t\\N
1033 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N\t\\N
1034 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1035 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1036 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1037 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N\t\\N
1038 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N\t\\N
1039 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N\t\\N
1040 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N\t\\N
1046 testcmd
("../gpst -o pgtab missing.gpsml", # {{{
1048 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N\t\\N
1049 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N\t\\N
1050 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N\t\\N
1057 testcmd
("../gpst -o csv log.dos.mayko", # {{{
1059 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1060 2003-06-15T10:27:53Z\t8.1253200\t58.1818712\t\t
1061 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1062 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1063 2003-06-15T10:28:06Z\t8.1293950\t58.1810315\t\t
1064 2003-06-15T10:28:10Z\t8.1307400\t58.1809621\t\t
1067 "Read DOS-formatted Mayko format",
1072 testcmd
("../gpst -o pgwtab multitrack.gpx", # {{{
1074 (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
1075 (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
1076 (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
1077 (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
1078 (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
1079 (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
1082 "Test pgwtab format",
1087 testcmd
("../gpst -o pgwupd multitrack.gpx", # {{{
1090 UPDATE logg SET sted = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1091 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1094 UPDATE logg SET sted = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1095 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1098 UPDATE logg SET sted = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1099 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1102 UPDATE logg SET sted = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1103 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1106 UPDATE logg SET sted = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1107 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1110 UPDATE logg SET sted = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1111 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1115 "Test pgwupd format",
1125 # --output option }}}
1126 diag
("Testing --outside option..."); # {{{
1127 # --outside option }}}
1128 diag
("Testing --pos1 and --pos2 options..."); # {{{
1129 # --pos1 and --pos2 options }}}
1130 diag
("Testing --require option..."); # {{{
1131 testcmd
("../gpst -re multitrack.gpx", # {{{
1133 <?xml version="1.0" encoding="UTF-8"?>
1136 <title>Track 1</title>
1138 <title>Track 2</title>
1139 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1141 <title>Track 3</title>
1143 <title>Track 4</title>
1148 "Require elevation from GPX data",
1152 testcmd
("../gpst -re one_ele.dos.gpsml", # {{{
1154 <?xml version="1.0" encoding="UTF-8"?>
1157 <title>Only one point has elevation</title>
1158 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1163 "Require elevation from gpsml",
1168 local $TODO = "Shall lat/lon be cleared if one is missing?";
1169 testcmd
("../gpst -re missing.gpsml", # {{{
1171 <?xml version="1.0" encoding="UTF-8"?>
1174 <title>Missing various elements</title>
1175 <tp> <time>2006-04-30T17:17:11Z</time> <ele>483</ele> </tp>
1176 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1177 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1178 <tp> <ele>484</ele> </tp>
1179 <tp> <ele>486</ele> </tp>
1180 <tp> <time>2006-04-30T17:18:03Z</time> <ele>490</ele> </tp>
1181 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1186 "Require elevation",
1190 testcmd
("../gpst -rt missing.gpsml", # {{{
1192 <?xml version="1.0" encoding="UTF-8"?>
1195 <title>Missing various elements</title>
1196 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1197 <tp> <time>2006-04-30T17:17:00Z</time> </tp>
1198 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1199 <tp> <time>2006-04-30T17:17:11Z</time> <ele>483</ele> </tp>
1200 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1201 <tp> <time>2006-04-30T17:18:03Z</time> <ele>490</ele> </tp>
1202 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1211 testcmd
("../gpst -rp missing.gpsml", # {{{
1213 <?xml version="1.0" encoding="UTF-8"?>
1216 <title>Missing various elements</title>
1217 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1218 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1219 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1228 testcmd
("../gpst -ret missing.gpsml", # {{{
1230 <?xml version="1.0" encoding="UTF-8"?>
1233 <title>Missing various elements</title>
1234 <tp> <time>2006-04-30T17:17:11Z</time> <ele>483</ele> </tp>
1235 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1236 <tp> <time>2006-04-30T17:18:03Z</time> <ele>490</ele> </tp>
1237 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1242 "Require elevation and time",
1246 testcmd
("../gpst -retp missing.gpsml", # {{{
1248 <?xml version="1.0" encoding="UTF-8"?>
1251 <title>Missing various elements</title>
1252 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1257 "Require elevation, time and position",
1261 testcmd
("../gpst -rep missing.gpsml", # {{{
1263 <?xml version="1.0" encoding="UTF-8"?>
1266 <title>Missing various elements</title>
1267 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1268 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1273 "Require elevation and position",
1278 # --require option }}}
1279 diag
("Testing --round option..."); # {{{
1280 testcmd
("../gpst --round lat=4,lon=5,ele=1 pause.gpx", # {{{
1282 <?xml version="1.0" encoding="UTF-8"?>
1285 <title>ACTIVE LOG164705</title>
1286 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1287 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1288 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1289 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1290 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1291 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1292 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1293 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1294 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1302 # --round option }}}
1303 diag
("Testing --short-date option..."); # {{{
1304 # --short-date option }}}
1305 diag
("Testing --save-to-file option..."); # {{{
1306 # --save-to-file option }}}
1307 diag
("Testing --create-breaks option..."); # {{{
1308 testcmd
("../gpst -t pause.gpx", # {{{
1310 <?xml version="1.0" encoding="UTF-8"?>
1313 <title>ACTIVE LOG164705</title>
1314 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1315 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1316 <pause>0:00:02:18</pause>
1317 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1318 <pause>0:00:04:32</pause>
1319 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1320 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1321 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1322 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1323 <pause>0:00:02:05</pause>
1324 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1325 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1330 "Output gpsml with <pause> elements from GPX files",
1334 testcmd
("../gpst -t multitrack-pause.gpx", # {{{
1336 <?xml version="1.0" encoding="UTF-8"?>
1339 <title>track1</title>
1340 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1341 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1342 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1344 <title>track2</title>
1345 <pause>0:23:59:58</pause>
1346 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1347 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1348 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1349 <pause>0:01:00:00</pause>
1350 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1352 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1354 <title>track3</title>
1355 <pause>1:01:00:03</pause>
1356 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1357 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1358 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1360 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1361 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1362 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1363 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1364 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1369 "Insert <pause> between gpx tracks",
1373 testcmd
("../gpst -t multitrack-pause.gpsml", # {{{
1375 <?xml version="1.0" encoding="UTF-8"?>
1378 <title>track1</title>
1379 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1380 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1381 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1383 <title>track2</title>
1384 <pause>0:23:59:58</pause>
1385 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1386 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1387 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1388 <pause>0:01:00:00</pause>
1389 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1391 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1393 <title>track3</title>
1394 <pause>1:01:00:03</pause>
1395 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1396 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1397 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1399 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1400 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1401 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1402 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1403 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1408 "Insert <pause> between gpsml titles",
1412 # --create-breaks option }}}
1413 diag
("Testing --comment-out-dups option..."); # {{{
1414 testcmd
("../gpst -u no_signal.mayko >nosignal.tmp", # {{{
1421 testcmd
("../gpst nosignal.tmp", # {{{
1423 <?xml version="1.0" encoding="UTF-8"?>
1426 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
1427 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
1428 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
1429 <desc>20021222T214351-20021222T214354: CO: No signal \x7B\x7B\x7B</desc>
1430 <etp err="desc"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1431 <etp err="desc"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1432 <etp err="desc"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1433 <desc>20021222T214351-20021222T214354: CO: No signal \x7D\x7D\x7D</desc>
1435 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
1436 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
1437 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
1442 "Read output from 'gpst -u *.mayko'",
1446 unlink("nosignal.tmp") || warn("nosignal.tmp: Cannot delete file: $!\n");
1447 testcmd
("../gpst -u no_signal.mayko", # {{{
1449 xmaplog 1.0 Mon Dec 23 02:00:50 2002
1450 1 70.6800486 23.6746151 57.4 0 12/22/2002 21:42:24
1451 1 70.6799322 23.6740038 6.3 0 12/22/2002 21:42:32
1452 1 70.6796266 23.6723991 6.0 0 12/22/2002 21:42:54
1453 # 20021222T214351-20021222T214354: CO: No signal \x7B\x7B\x7B
1454 # 1 70.6796266 23.6723991 0.0 0 12/22/2002 21:43:51
1455 # 1 70.6796266 23.6723991 0.0 0 12/22/2002 21:43:52
1456 # 1 70.6796266 23.6723991 0.0 0 12/22/2002 21:43:54
1457 # 20021222T214351-20021222T214354: CO: No signal \x7D\x7D\x7D
1459 1 70.6800774 23.6757566 5.1 0 12/22/2002 21:44:45
1460 1 70.6801502 23.6753442 4.8 0 12/22/2002 21:44:52
1461 1 70.6801905 23.6757542 2.5 0 12/22/2002 21:45:04
1464 "Read Mayko format with no signal, output old Mayko format",
1468 # --comment-out-dups option }}}
1469 diag
("Testing --verbose option..."); # {{{
1470 # --verbose option }}}
1471 diag
("Testing --version option..."); # {{{
1472 like
(`../gpst --version`, # {{{
1473 qr/^(\$Id: .*? \$\n)+$/s,
1478 # --version option }}}
1479 diag
("Testing --strip-whitespace option..."); # {{{
1480 testcmd
("../gpst -w -o gpx pause.gpx", # {{{
1482 $stripped_gpx_header
1485 <trkpt lat="60.425494" lon="5.299534"><ele>25.260</ele><time>2006-05-21T16:49:11Z</time></trkpt>
1486 <trkpt lat="60.425464" lon="5.299610"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
1487 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
1488 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
1489 <trkpt lat="60.425339" lon="5.299958"><ele>30.980</ele><time>2006-05-21T16:56:47Z</time></trkpt>
1490 <trkpt lat="60.425238" lon="5.299640"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
1491 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
1492 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
1493 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
1499 "Strip whitespace from GPX output",
1503 testcmd
("../gpst -o gpx -w comments.mayko", # {{{
1505 $stripped_gpx_header
1508 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
1509 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
1510 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
1511 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
1512 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
1513 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
1514 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
1517 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
1518 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
1524 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1528 # --strip-whitespace option }}}
1529 diag
("Testing --double-y-scale option..."); # {{{
1530 testcmd
("../gpst -y -o clean pause.gpx", # {{{
1532 5.299534\t120.850988\t25.260
1533 5.299610\t120.850928\t24.931
1534 5.299694\t120.850628\t27.975
1535 5.299741\t120.850768\t31.017
1536 5.299958\t120.850678\t30.980
1537 5.299640\t120.850476\t30.538
1538 5.299686\t120.850492\t30.515
1539 5.299773\t120.85069\t31.936
1540 5.299419\t120.850914\t31.794
1543 "Double y scale, clean output from gpx format",
1547 testcmd
("../gpst -y -o clean log.dos.mayko", # {{{
1549 8.1225077\t116.3636316\t
1550 8.1253200\t116.3637424\t
1551 8.1266031\t116.3632694\t
1552 8.1284612\t116.3624198\t
1553 8.1293950\t116.362063\t
1554 8.1307400\t116.3619242\t
1557 "Double y scale, clean output from mayko format",
1561 # --double-y-scale option }}}
1562 diag
("Testing --debug option..."); # {{{
1563 # --debug option }}}
1564 diag
("Strip error from Mayko format..."); # {{{
1566 testcmd
("../gpst -o csv date_error.mayko", # {{{
1568 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
1569 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
1570 2003-06-13T09:12:41Z\t5.5813636\t60.4283320\t\t
1571 2003-06-13T09:12:42Z\t5.5817430\t60.4283806\t\t
1574 "Strip error from mayko format in csv output",
1578 testcmd
("../gpst -o clean date_error.mayko", # {{{
1580 5.5794667\t60.4280897\t
1581 5.5802255\t60.4281867\t
1582 5.5813636\t60.4283320\t
1583 5.5817430\t60.4283806\t
1586 "Strip error from mayko format in clean output",
1590 testcmd
("../gpst -o gpsml date_error.mayko", # {{{
1592 <?xml version="1.0" encoding="UTF-8"?>
1595 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
1596 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
1597 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
1598 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
1599 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
1604 "Strip error from mayko format in gpsml output",
1608 testcmd
("../gpst -o gpx date_error.mayko", # {{{
1610 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1613 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
1614 xmlns="http://www.topografix.com/GPX/1/1"
1615 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1616 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
1620 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
1621 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
1622 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
1623 <trkpt lat="60.4283320" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
1624 <trkpt lat="60.4283806" lon="5.5817430"> <time>2003-06-13T09:12:42Z</time> </trkpt>
1630 "Strip error from mayko format in gpx output",
1634 testcmd
("../gpst -o gpstrans date_error.mayko", # {{{
1636 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
1637 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
1638 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
1639 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
1640 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
1643 "Strip error from mayko format in gpstrans output",
1647 testcmd
("../gpst -o pgtab date_error.mayko", # {{{
1649 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N\t\\N
1650 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N\t\\N
1651 2003-06-13T09:12:41Z\t(60.4283320,5.5813636)\t\\N\t\\N\t\\N\t\\N\t\\N
1652 2003-06-13T09:12:42Z\t(60.4283806,5.5817430)\t\\N\t\\N\t\\N\t\\N\t\\N
1655 "Strip error from mayko format in pgtab output",
1659 testcmd
("../gpst -o poscount date_error.mayko", # {{{
1661 5.5802255\t60.4281867\t1
1662 5.5817430\t60.4283806\t1
1663 5.5813636\t60.4283320\t1
1664 5.5794667\t60.4280897\t1
1667 "Strip error from mayko format in poscount output",
1671 testcmd
("../gpst -o xgraph date_error.mayko", # {{{
1673 5.5794667 60.4280897
1674 5.5802255 60.4281867
1675 5.5813636 60.4283320
1676 5.5817430 60.4283806
1679 "Strip error from mayko format in xgraph output",
1683 testcmd
("../gpst -o ygraph date_error.mayko", # {{{
1686 5.5794667 60.4280897
1689 5.5802255 60.4281867
1692 5.5813636 60.4283320
1695 5.5817430 60.4283806
1699 "Strip error from mayko format in ygraph output",
1704 # Strip error from Mayko format }}}
1709 if ($Opt{'all'} || $Opt{'todo'}) {
1710 diag
("Running TODO tests..."); # {{{
1713 local $TODO = "Remove extra \\n in the beginning";
1714 testcmd
("../gpst -t -o clean pause.gpx", # {{{
1716 5.299534\t60.425494\t25.260
1717 5.299610\t60.425464\t24.931
1719 5.299694\t60.425314\t27.975
1721 5.299741\t60.425384\t31.017
1722 5.299958\t60.425339\t30.980
1723 5.299640\t60.425238\t30.538
1724 5.299686\t60.425246\t30.515
1726 5.299773\t60.425345\t31.936
1727 5.299419\t60.425457\t31.794
1730 "Output clean format with time breaks",
1733 testcmd
("../gpst -o csv multitrack.gpx", # {{{
1735 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
1736 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
1737 2003-02-11T23:36:14Z\t-0.1453202\t51.4969040\t\t
1739 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
1740 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
1741 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
1742 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
1744 2003-02-11T23:37:05Z\t-0.1458608\t51.4970680\t\t
1745 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
1746 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
1748 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
1749 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
1750 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
1751 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
1752 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
1755 "Output csv format from gpx",
1759 testcmd
("../gpst -o csv pause.gpx", # {{{
1761 2006-05-21 16:49:11\t5.299534\t60.425494\t25.260\t
1762 2006-05-21 16:49:46\t5.299610\t60.425464\t24.931\t
1763 2006-05-21 16:52:04\t5.299694\t60.425314\t27.975\t
1764 2006-05-21 16:56:36\t5.299741\t60.425384\t31.017\t
1765 2006-05-21 16:56:47\t5.299958\t60.425339\t30.980\t
1766 2006-05-21 16:56:56\t5.299640\t60.425238\t30.538\t
1767 2006-05-21 16:57:03\t5.299686\t60.425246\t30.515\t
1768 2006-05-21 16:59:08\t5.299773\t60.425345\t31.936\t
1769 2006-05-21 17:00:54\t5.299419\t60.425457\t31.794\t
1772 "csv format from gpx",
1776 testcmd
("../gpst --epoch -o csv pause.gpx", # {{{
1778 1148230151\t5.299534\t60.425494\t25.260\t
1779 1148230186\t5.299610\t60.425464\t24.931\t
1780 1148230324\t5.299694\t60.425314\t27.975\t
1781 1148230596\t5.299741\t60.425384\t31.017\t
1782 1148230607\t5.299958\t60.425339\t30.980\t
1783 1148230616\t5.299640\t60.425238\t30.538\t
1784 1148230623\t5.299686\t60.425246\t30.515\t
1785 1148230748\t5.299773\t60.425345\t31.936\t
1786 1148230854\t5.299419\t60.425457\t31.794\t
1789 "csv format with epoch seconds from gpx",
1793 $TODO = "Use gpsml, this Mayko thing is obsolete.";
1794 testcmd
("../gpst -u no_signal.mayko", # {{{
1796 <?xml version="1.0" encoding="UTF-8"?>
1799 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
1800 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
1801 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
1802 <desc>20021222T214351-20021222T214354: CO: No signal \x7B\x7B\x7B</desc>
1803 <etp err="nosignal"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1804 <etp err="nosignal"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1805 <etp err="nosignal"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
1806 <desc>20021222T214351-20021222T214354: CO: No signal \x7D\x7D\x7D</desc>
1808 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
1809 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
1810 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
1815 "Output gpsml from the -u option",
1818 $TODO = "Tweak output";
1819 testcmd
("../gpst -o gpx multitrack-pause.gpsml", # {{{
1820 file_data
("multitrack-pause.gpx"),
1822 "Should be equal to multitrack-pause.gpx",
1827 # list_nearest_waypoints() {{{
1829 like
(list_nearest_waypoints
(60.42541, 5.29959, 3),
1831 "list_nearest_waypoints()"
1839 diag
("Testing finished.");
1843 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
1844 my $stderr_cmd = "";
1845 my $deb_str = $Opt{'debug'} ?
" --debug" : "";
1852 my $TMP_STDERR = "gpst-stderr.tmp";
1854 if (defined($Exp_stderr) && !length($deb_str)) {
1855 $stderr_cmd = " 2>$TMP_STDERR";
1857 is
(`$Cmd$deb_str$stderr_cmd`, $Exp_stdout, $Txt);
1858 if (defined($Exp_stderr)) {
1859 if (!length($deb_str)) {
1860 is
(file_data
($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
1861 unlink($TMP_STDERR);
1864 diag
("Warning: stderr not defined for '$Txt'");
1870 # Return file content as a string {{{
1873 if (open(FP
, "<", $File)) {
1874 $Txt = join("", <FP
>);
1884 # Print program version {{{
1891 # Send the help message to stdout {{{
1898 Usage: $progname [options] [file [files [...]]]
1900 Contains tests for the gpst(1) program.
1905 Run all tests, also TODOs.
1909 Run only the TODO tests.
1911 Print version information.
1913 Print debugging messages.
1922 # Plain Old Documentation (POD) {{{
1936 run-tests.pl [options] [file [files [...]]]
1940 Contains tests for the gpst(1) program.
1946 =item B<-a>, B<--all>
1948 Run all tests, also TODOs.
1950 =item B<-h>, B<--help>
1952 Print a brief help summary.
1954 =item B<-t>, B<--todo>
1956 Run only the TODO tests.
1960 Print version information.
1964 Print debugging messages.
1970 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
1974 Copyleft © Øyvind A. Holm <sunny@sunbase.org>
1975 This is free software; see the file F<COPYING> for legalese stuff.
1979 This program is free software; you can redistribute it and/or modify it
1980 under the terms of the GNU General Public License as published by the
1981 Free Software Foundation; either version 2 of the License, or (at your
1982 option) any later version.
1984 This program is distributed in the hope that it will be useful, but
1985 WITHOUT ANY WARRANTY; without even the implied warranty of
1986 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1987 See the GNU General Public License for more details.
1989 You should have received a copy of the GNU General Public License along
1990 with this program; if not, write to the Free Software Foundation, Inc.,
1991 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2001 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :