Remove branches/gpst-breakfix/, it has its own branch now.
[gpstools.git] / branches / gpst.xml-option / tests / run-tests.pl
blob8f7c761cd0ec82591cfafdb03044e58b583232af
1 #!/usr/bin/perl -w
3 #=======================================================================
4 # $Id$
5 # Test suite for gpst.
7 # Character set: UTF-8
8 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
9 # License: GNU General Public License, see end of file for legal stuff.
10 #=======================================================================
12 BEGIN {
13 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
14 our @version_array;
17 use strict;
18 use Getopt::Long;
19 use Test::More qw{no_plan};
21 use GPST;
22 use GPSTdate;
23 use GPSTdebug;
24 use GPSTgeo;
25 use GPSTxml;
27 $| = 1;
29 our $Debug = 0;
31 our %Opt = (
32 'all' => 0,
33 'debug' => 0,
34 'help' => 0,
35 'todo' => 0,
36 'version' => 0,
39 our $progname = $0;
40 $progname =~ s#^.*/(.*?)$#$1#;
42 my $rcs_id = '$Id$';
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");
47 GetOptions(
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");
55 our %Cmd = (
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"?>
65 <gpx
66 version="1.1"
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"
72 END
73 my $stripped_gpx_header = $gpx_header;
74 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
76 if ($Opt{'todo'} && !$Opt{'all'}) {
77 goto todo_section;
80 diag("Nytt...");
82 diag("Testing --chronology option with --xml..."); # {{{
83 testcmd("../gpst --chronology --xml chronology-error.gpsml", # {{{
84 <<END,
85 <?xml version="1.0" encoding="UTF-8"?>
86 <chronoerr>
87 <error>
88 <file>chronology-error.gpsml</file>
89 <line>9</line>
90 <corrtime>2006-05-02T09:46:46Z</corrtime>
91 <errtime>2006-05-02T09:40:07Z</errtime>
92 <diff>300</diff>
93 </error>
94 <error>
95 <file>chronology-error.gpsml</file>
96 <line>15</line>
97 <duptime>2006-05-02T10:18:09Z</duptime>
98 </error>
99 </chronoerr>
104 # }}}
105 # --chronology option }}}
107 diag("Testing conversion routines...");
109 # txt_to_xml() and xml_to_txt() {{{
111 is(txt_to_xml("abc"),
112 "abc",
113 "txt_to_xml(\"abc\")");
114 is(txt_to_xml("<&>"),
115 "&lt;&amp;&gt;",
116 "txt_to_xml(\"<&>\")");
117 is(txt_to_xml("first line\nsecond <\rthird\r\n<&>"),
118 "first line\nsecond &lt;\rthird\r\n&lt;&amp;&gt;",
119 "txt_to_xml() with multiline string");
121 is(xml_to_txt("abc"),
122 "abc",
123 "xml_to_txt(\"abc\")");
124 is(xml_to_txt("&lt;&amp;&gt;"),
125 "<&>",
126 "xml_to_txt(\"&lt;&amp;&gt;\")");
127 is(xml_to_txt("first line\nsecond &lt;\rthird\r\n&lt;&amp;&gt;"),
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æøåÆØÅ"),
139 "abcæøåÆØÅ",
140 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
142 is(postgresql_copy_safe("abc\t'\r\n"),
143 "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),
163 undef,
164 "sec_to_string(-5000) — negative numbers unsupported atm");
165 is(sec_to_string(""),
166 undef,
167 "sec_to_string(\"\")");
168 is(sec_to_string("pH()rtY tW0"),
169 undef,
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),
191 "0:00:00:00",
192 "sec_to_readable(0)");
193 is(sec_to_readable("pH()rtY tW0"),
194 undef,
195 "sec_to_readable() with invalid string");
196 is(sec_to_readable(86400),
197 "1:00:00:00",
198 "sec_to_readable(86400)");
199 is(sec_to_readable(86400*1000),
200 "1000:00:00:00",
201 "sec_to_readable(86400*1000)");
202 is(sec_to_readable(86400+7200+180+4),
203 "1:02:03:04",
204 "sec_to_readable(86400+7200+180+4)");
205 is(sec_to_readable("3.14"),
206 "0:00:00:03.14",
207 "sec_to_readable(\"3.14\")");
208 is(sec_to_readable("-124"),
209 undef,
210 "sec_to_readable() rejects negative numbers");
211 is(sec_to_readable("-2.34"),
212 undef,
213 "sec_to_readable() rejects negative decimal");
214 is(sec_to_readable(".87"),
215 "0:00:00:00.87",
216 "sec_to_readable(), missing zero before decimal point");
217 is(sec_to_readable(""),
218 "0:00:00:00",
219 "sec_to_readable() with empty string");
221 # sec_to_readable() }}}
223 diag("Testing geo routines...");
225 # ddd_to_dms() {{{
227 is(ddd_to_dms("12.34567"),
228 "12\xB020'44.4\"",
229 "ddd_to_dms(\"12.34567\")");
231 is(ddd_to_dms("0"),
232 "0\xB000'00.0\"",
233 "ddd_to_dms(\"0\")");
235 is(ddd_to_dms(""),
236 "0\xB000'00.0\"",
237 "ddd_to_dms(\"\")");
239 is(ddd_to_dms("pH()rtY tW0"),
240 undef,
241 "ddd_to_dms(\"pH()rtY tW0\")");
243 is(ddd_to_dms("-12.34567"),
244 "-12\xB020'44.4\"",
245 "ddd_to_dms(\"-12.34567\")");
247 is(ddd_to_dms("0.34567"),
248 "0\xB020'44.4\"",
249 "ddd_to_dms(\"0.34567\")");
251 is(ddd_to_dms(".34567"),
252 "0\xB020'44.4\"",
253 "ddd_to_dms(\".34567\")");
255 is(ddd_to_dms("-.34567"),
256 "-0\xB020'44.4\"",
257 "ddd_to_dms(\"-.34567\")");
259 is(ddd_to_dms("-0.34567"),
260 "-0\xB020'44.4\"",
261 "ddd_to_dms(\"-0.34567\")");
263 is(ddd_to_dms("180"),
264 "180\xB000'00.0\"",
265 "ddd_to_dms(\"180\")");
267 is(ddd_to_dms("-180"),
268 "-180\xB000'00.0\"",
269 "ddd_to_dms(\"-180\")");
271 is(ddd_to_dms("-1"),
272 "-1\xB000'00.0\"",
273 "ddd_to_dms(\"-1\")");
275 is(ddd_to_dms("2-3"),
276 undef,
277 "ddd_to_dms(\"2-3\")");
279 # ddd_to_dms() }}}
281 diag("Testing trackpoint()..."); # {{{
283 my %Dat = ();
285 is(trackpoint(%Dat),
286 undef,
287 "trackpoint() receives empty hash");
289 my %Bck = (
290 # {{{
291 'format' => 'gpsml',
292 'year' => '2003',
293 'month' => '06',
294 'day' => '13',
295 'hour' => '14',
296 'min' => '36',
297 'sec' => '10',
298 'lat' => '59.5214',
299 'lon' => '7.392133',
300 'ele' => '762',
301 'error' => "",
302 'type' => 'tp',
303 # }}}
306 # trackpoint() (gpsml) {{{
307 %Dat = %Bck;
309 trackpoint(%Dat),
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) {{{
316 %Dat = %Bck;
317 $Dat{'format'} = "gpx";
319 trackpoint(%Dat),
320 qq{ <trkpt lat="59.5214" lon="7.392133"> <ele>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt>\n},
321 "trackpoint() (gpx)"
324 # trackpoint() (gpx) }}}
326 # trackpoint(): Various loop tests {{{
328 for my $Elem (qw{format lat lon type}) {
329 my %Dat = %Bck;
331 $Dat{"$Elem"} = '2d';
332 is(trackpoint(%Dat),
333 undef,
334 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
339 for my $Elem (qw{year month day hour min sec}) {
340 # Date tests {{{
341 my %Dat;
343 %Dat = %Bck;
344 $Dat{"$Elem"} = '';
345 is(trackpoint(%Dat),
346 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
347 "trackpoint(): {'$Elem'} with empty value skips time"
350 %Dat = %Bck;
351 $Dat{"$Elem"} = '2d';
352 is(trackpoint(%Dat),
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"
357 %Dat = %Bck;
358 $Dat{$Elem} = "00000$Dat{$Elem}";
359 is(trackpoint(%Dat),
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'}"
364 %Dat = %Bck;
365 $Dat{"$Elem"} = 0-$Dat{$Elem};
366 is(trackpoint(%Dat),
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") {
372 %Dat = %Bck;
373 $Dat{"$Elem"} = "$Dat{$Elem}.00";
374 is(trackpoint(%Dat),
375 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
376 "trackpoint(): Decimals in {'$Elem'}, skip time"
380 # Date tests }}}
383 %Dat = %Bck;
384 $Dat{'sec'} = "$Dat{'sec'}.00";
385 is(trackpoint(%Dat),
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}) {
391 my %Dat = %Bck;
392 $Dat{$Elem} = undef;
393 is(trackpoint(%Dat),
394 undef,
395 "trackpoint(): Missing {'$Elem'}, return undef"
399 # Various loop tests }}}
401 # trackpoint() }}}
403 diag("Testing output from ../gpst");
405 diag("Read empty input (/dev/null)..."); # {{{
406 testcmd("../gpst </dev/null", # {{{
407 <<END,
408 <?xml version="1.0" encoding="UTF-8"?>
409 <gpsml>
410 <track>
411 </track>
412 </gpsml>
417 # }}}
418 testcmd("../gpst -o gpx </dev/null", # {{{
419 <<END,
420 $gpx_header
421 <trk>
422 <trkseg>
423 </trkseg>
424 </trk>
425 </gpx>
430 # }}}
431 # empty input }}}
432 diag("Read empty files..."); # {{{
433 testcmd("echo '<tp> </tp>' | ../gpst", # {{{
434 <<END,
435 <?xml version="1.0" encoding="UTF-8"?>
436 <gpsml>
437 <track>
438 </track>
439 </gpsml>
442 "Don’t print empty trackpoints",
445 # }}}
446 # Read empty files }}}
447 diag("Testing --chronology option..."); # {{{
448 testcmd("../gpst --chronology chronology-error.gpsml", # {{{
449 <<END,
450 <?xml version="1.0" encoding="UTF-8"?>
451 <gpsml>
452 <track>
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>
457 <break/>
458 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
459 <break/>
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>
467 </track>
468 </gpsml>
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",
475 # }}}
476 # --chronology option }}}
477 diag("Testing --skip-dups option..."); # {{{
478 testcmd("../gpst -d no_signal.mayko", # {{{
479 <<END,
480 <?xml version="1.0" encoding="UTF-8"?>
481 <gpsml>
482 <track>
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>
492 </track>
493 </gpsml>
496 "Remove duplicated positions from gpsml",
499 # }}}
500 testcmd("../gpst -d -o csv no_signal.mayko", # {{{
501 <<END,
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",
513 # }}}
514 testcmd("../gpst -d -o clean no_signal.mayko", # {{{
515 <<END,
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",
527 # }}}
528 testcmd("../gpst -d -o pgtab no_signal.mayko", # {{{
529 <<END,
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",
541 # }}}
542 # --skip-dups option }}}
543 diag("Testing --epoch option..."); # {{{
544 testcmd("../gpst --epoch pause.gpx", # {{{
545 <<END,
546 <?xml version="1.0" encoding="UTF-8"?>
547 <gpsml>
548 <track>
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>
559 </track>
560 </gpsml>
563 "--epoch is ignored in gpsml output",
566 # }}}
567 testcmd("../gpst --epoch -o gpx pause.gpx", # {{{
568 <<END,
569 $gpx_header
570 <trk>
571 <trkseg>
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>
581 </trkseg>
582 </trk>
583 </gpx>
586 "--epoch is ignored in gpx output",
589 # }}}
590 # --epoch option }}}
591 diag("Testing --fix option..."); # {{{
592 testcmd("../gpst --fix --chronology chronology-error.gpsml", # {{{
593 <<END,
594 <?xml version="1.0" encoding="UTF-8"?>
595 <gpsml>
596 <track>
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>
601 <break/>
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>
603 <break/>
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>
611 </track>
612 </gpsml>
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",
619 # }}}
620 # --fix option }}}
621 diag("Testing --from-date option..."); # {{{
622 # --from-date option }}}
623 diag("Testing --help option..."); # {{{
624 # --help option }}}
625 diag("Testing --inside option..."); # {{{
626 # --inside option }}}
627 diag("Testing --undefined option..."); # {{{
628 # --undefined option }}}
629 diag("Testing --near option..."); # {{{
630 # --near option }}}
631 diag("Testing --output option..."); # {{{
632 # gpsml (Default)
633 testcmd("../gpst log.mcsv", # {{{
634 <<END,
635 <?xml version="1.0" encoding="UTF-8"?>
636 <gpsml>
637 <track>
638 <break/>
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>
655 <break/>
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>
666 <break/>
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>
676 </track>
677 </gpsml>
680 "Read Mapsource TAB-separated format",
683 # }}}
684 testcmd("../gpst two-digit_year.mcsv", # {{{
685 <<END,
686 <?xml version="1.0" encoding="UTF-8"?>
687 <gpsml>
688 <track>
689 <break/>
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>
698 </track>
699 </gpsml>
702 "Read Mapsource TAB-separated format with two-digit year",
705 # }}}
706 testcmd("../gpst log.gpstxt", # {{{
707 <<END,
708 <?xml version="1.0" encoding="UTF-8"?>
709 <gpsml>
710 <track>
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>
729 </track>
730 </gpsml>
733 "Read Garmin serial text format",
736 # }}}
737 testcmd("../gpst log.dos.mayko", # {{{
738 <<END,
739 <?xml version="1.0" encoding="UTF-8"?>
740 <gpsml>
741 <track>
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>
748 </track>
749 </gpsml>
752 "Read DOS-formatted Mayko format",
755 # }}}
756 testcmd("../gpst log.dos.gpstxt", # {{{
757 <<END,
758 <?xml version="1.0" encoding="UTF-8"?>
759 <gpsml>
760 <track>
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>
772 </track>
773 </gpsml>
776 "Read DOS-formatted Garmin serial text format",
779 # }}}
780 testcmd("../gpst log.unix.mcsv", # {{{
781 <<END,
782 <?xml version="1.0" encoding="UTF-8"?>
783 <gpsml>
784 <track>
785 <break/>
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>
796 </track>
797 </gpsml>
800 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
803 # }}}
804 testcmd("../gpst multitrack.gpx", # {{{
805 <<END,
806 <?xml version="1.0" encoding="UTF-8"?>
807 <gpsml>
808 <track>
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>
813 <break/>
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>
819 <break/>
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>
824 <break/>
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>
831 </track>
832 </gpsml>
835 "Read GPX file with multiple tracks",
838 # }}}
839 testcmd("../gpst compact.gpx", # {{{
840 <<END,
841 <?xml version="1.0" encoding="UTF-8"?>
842 <gpsml>
843 <track>
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>
857 </track>
858 </gpsml>
861 "Read GPX one-liner",
864 # }}}
865 testcmd("../gpst missing.gpsml", # {{{
866 <<END,
867 <?xml version="1.0" encoding="UTF-8"?>
868 <gpsml>
869 <track>
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>
882 </track>
883 </gpsml>
886 "Read gpsml with various data missing",
889 # }}}
890 testcmd("../gpst different_dateformats.gpsml", # {{{
891 <<END,
892 <?xml version="1.0" encoding="UTF-8"?>
893 <gpsml>
894 <track>
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>
900 </track>
901 </gpsml>
904 "Read different date formats from gpsml file",
907 # }}}
908 testcmd("../gpst multitrack-pause.gpx", # {{{
909 file_data("multitrack-pause.gpsml"),
911 "Should be equal to multitrack-pause.gpsml",
914 # }}}
915 # gpx
916 testcmd("../gpst -o gpx no_signal.mayko", # {{{
917 <<END,
918 $gpx_header
919 <trk>
920 <trkseg>
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>
930 </trkseg>
931 </trk>
932 </gpx>
935 "Output GPX from Mayko file with duplicates",
938 # }}}
939 testcmd("../gpst -o gpx comments.mayko", # {{{
940 <<END,
941 $gpx_header
942 <trk>
943 <trkseg>
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>
951 </trkseg>
952 <trkseg>
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>
955 </trkseg>
956 </trk>
957 </gpx>
960 "Output GPX from Mayko file with commented-out lines",
963 # }}}
964 testcmd("../gpst -o gpx missing.gpsml", # {{{
965 <<END,
966 $gpx_header
967 <trk>
968 <trkseg>
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>
977 </trkseg>
978 </trk>
979 </gpx>
982 "Output GPX from gpsml with missing data",
985 # }}}
986 # xgraph
987 testcmd("../gpst -o xgraph multitrack.gpx", # {{{
988 <<END,
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"
1009 # }}}
1010 # pgtab
1011 testcmd("../gpst -o pgtab compact.gpx", # {{{
1012 <<END,
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
1029 # }}}
1030 testcmd("../gpst -o pgtab no_signal.mayko", # {{{
1031 <<END,
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
1045 # }}}
1046 testcmd("../gpst -o pgtab missing.gpsml", # {{{
1047 <<END,
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
1055 # }}}
1056 # csv
1057 testcmd("../gpst -o csv log.dos.mayko", # {{{
1058 <<END,
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",
1070 # }}}
1071 # pgwtab
1072 testcmd("../gpst -o pgwtab multitrack.gpx", # {{{
1073 <<END,
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",
1085 # }}}
1086 # pgwupd
1087 testcmd("../gpst -o pgwupd multitrack.gpx", # {{{
1088 <<END,
1089 BEGIN;
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;
1092 COMMIT;
1093 BEGIN;
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;
1096 COMMIT;
1097 BEGIN;
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;
1100 COMMIT;
1101 BEGIN;
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;
1104 COMMIT;
1105 BEGIN;
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;
1108 COMMIT;
1109 BEGIN;
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;
1112 COMMIT;
1115 "Test pgwupd format",
1118 # }}}
1119 # clean
1120 # gpstrans
1121 # poscount
1122 # ps (Unfinished)
1123 # svg (Unfinished)
1124 # ygraph
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", # {{{
1132 <<END,
1133 <?xml version="1.0" encoding="UTF-8"?>
1134 <gpsml>
1135 <track>
1136 <title>Track 1</title>
1137 <break/>
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>
1140 <break/>
1141 <title>Track 3</title>
1142 <break/>
1143 <title>Track 4</title>
1144 </track>
1145 </gpsml>
1148 "Require elevation from GPX data",
1151 # }}}
1152 testcmd("../gpst -re one_ele.dos.gpsml", # {{{
1153 <<END,
1154 <?xml version="1.0" encoding="UTF-8"?>
1155 <gpsml>
1156 <track>
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>
1159 </track>
1160 </gpsml>
1163 "Require elevation from gpsml",
1166 # }}}
1167 TODO: {
1168 local $TODO = "Shall lat/lon be cleared if one is missing?";
1169 testcmd("../gpst -re missing.gpsml", # {{{
1170 <<END,
1171 <?xml version="1.0" encoding="UTF-8"?>
1172 <gpsml>
1173 <track>
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>
1182 </track>
1183 </gpsml>
1186 "Require elevation",
1189 # }}}
1190 testcmd("../gpst -rt missing.gpsml", # {{{
1191 <<END,
1192 <?xml version="1.0" encoding="UTF-8"?>
1193 <gpsml>
1194 <track>
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>
1203 </track>
1204 </gpsml>
1207 "Require time",
1210 # }}}
1211 testcmd("../gpst -rp missing.gpsml", # {{{
1212 <<END,
1213 <?xml version="1.0" encoding="UTF-8"?>
1214 <gpsml>
1215 <track>
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>
1220 </track>
1221 </gpsml>
1224 "Require position",
1227 # }}}
1228 testcmd("../gpst -ret missing.gpsml", # {{{
1229 <<END,
1230 <?xml version="1.0" encoding="UTF-8"?>
1231 <gpsml>
1232 <track>
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>
1238 </track>
1239 </gpsml>
1242 "Require elevation and time",
1245 # }}}
1246 testcmd("../gpst -retp missing.gpsml", # {{{
1247 <<END,
1248 <?xml version="1.0" encoding="UTF-8"?>
1249 <gpsml>
1250 <track>
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>
1253 </track>
1254 </gpsml>
1257 "Require elevation, time and position",
1260 # }}}
1261 testcmd("../gpst -rep missing.gpsml", # {{{
1262 <<END,
1263 <?xml version="1.0" encoding="UTF-8"?>
1264 <gpsml>
1265 <track>
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>
1269 </track>
1270 </gpsml>
1273 "Require elevation and position",
1276 # }}}
1278 # --require option }}}
1279 diag("Testing --round option..."); # {{{
1280 testcmd("../gpst --round lat=4,lon=5,ele=1 pause.gpx", # {{{
1281 <<END,
1282 <?xml version="1.0" encoding="UTF-8"?>
1283 <gpsml>
1284 <track>
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>
1295 </track>
1296 </gpsml>
1301 # }}}
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", # {{{
1309 <<END,
1310 <?xml version="1.0" encoding="UTF-8"?>
1311 <gpsml>
1312 <track>
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>
1326 </track>
1327 </gpsml>
1330 "Output gpsml with <pause> elements from GPX files",
1333 # }}}
1334 testcmd("../gpst -t multitrack-pause.gpx", # {{{
1335 <<END,
1336 <?xml version="1.0" encoding="UTF-8"?>
1337 <gpsml>
1338 <track>
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>
1343 <break/>
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>
1351 <break/>
1352 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1353 <break/>
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>
1359 <break/>
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>
1365 </track>
1366 </gpsml>
1369 "Insert <pause> between gpx tracks",
1372 # }}}
1373 testcmd("../gpst -t multitrack-pause.gpsml", # {{{
1374 <<END,
1375 <?xml version="1.0" encoding="UTF-8"?>
1376 <gpsml>
1377 <track>
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>
1382 <break/>
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>
1390 <break/>
1391 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1392 <break/>
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>
1398 <break/>
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>
1404 </track>
1405 </gpsml>
1408 "Insert <pause> between gpsml titles",
1411 # }}}
1412 # --create-breaks option }}}
1413 diag("Testing --comment-out-dups option..."); # {{{
1414 testcmd("../gpst -u no_signal.mayko >nosignal.tmp", # {{{
1417 "Redirect stdout",
1420 # }}}
1421 testcmd("../gpst nosignal.tmp", # {{{
1422 <<END,
1423 <?xml version="1.0" encoding="UTF-8"?>
1424 <gpsml>
1425 <track>
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>
1434 <break/>
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>
1438 </track>
1439 </gpsml>
1442 "Read output from 'gpst -u *.mayko'",
1445 # }}}
1446 unlink("nosignal.tmp") || warn("nosignal.tmp: Cannot delete file: $!\n");
1447 testcmd("../gpst -u no_signal.mayko", # {{{
1448 <<END,
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
1458 # move
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",
1467 # }}}
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,
1474 "../gpst --version"
1477 # }}}
1478 # --version option }}}
1479 diag("Testing --strip-whitespace option..."); # {{{
1480 testcmd("../gpst -w -o gpx pause.gpx", # {{{
1481 <<END,
1482 $stripped_gpx_header
1483 <trk>
1484 <trkseg>
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>
1494 </trkseg>
1495 </trk>
1496 </gpx>
1499 "Strip whitespace from GPX output",
1502 # }}}
1503 testcmd("../gpst -o gpx -w comments.mayko", # {{{
1504 <<END,
1505 $stripped_gpx_header
1506 <trk>
1507 <trkseg>
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>
1515 </trkseg>
1516 <trkseg>
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>
1519 </trkseg>
1520 </trk>
1521 </gpx>
1524 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1527 # }}}
1528 # --strip-whitespace option }}}
1529 diag("Testing --double-y-scale option..."); # {{{
1530 testcmd("../gpst -y -o clean pause.gpx", # {{{
1531 <<END,
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",
1546 # }}}
1547 testcmd("../gpst -y -o clean log.dos.mayko", # {{{
1548 <<END,
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",
1560 # }}}
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", # {{{
1567 <<END,
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",
1577 # }}}
1578 testcmd("../gpst -o clean date_error.mayko", # {{{
1579 <<END,
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",
1589 # }}}
1590 testcmd("../gpst -o gpsml date_error.mayko", # {{{
1591 <<END,
1592 <?xml version="1.0" encoding="UTF-8"?>
1593 <gpsml>
1594 <track>
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>
1600 </track>
1601 </gpsml>
1604 "Strip error from mayko format in gpsml output",
1607 # }}}
1608 testcmd("../gpst -o gpx date_error.mayko", # {{{
1609 <<END,
1610 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1611 <gpx
1612 version="1.1"
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"
1618 <trk>
1619 <trkseg>
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>
1625 </trkseg>
1626 </trk>
1627 </gpx>
1630 "Strip error from mayko format in gpx output",
1633 # }}}
1634 testcmd("../gpst -o gpstrans date_error.mayko", # {{{
1635 <<END,
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",
1646 # }}}
1647 testcmd("../gpst -o pgtab date_error.mayko", # {{{
1648 <<END,
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",
1658 # }}}
1659 testcmd("../gpst -o poscount date_error.mayko", # {{{
1660 <<END,
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",
1670 # }}}
1671 testcmd("../gpst -o xgraph date_error.mayko", # {{{
1672 <<END,
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",
1682 # }}}
1683 testcmd("../gpst -o ygraph date_error.mayko", # {{{
1684 <<END,
1685 "Time = 0.0
1686 5.5794667 60.4280897
1688 "Time = 2.0
1689 5.5802255 60.4281867
1691 "Time = 5.0
1692 5.5813636 60.4283320
1694 "Time = 6.0
1695 5.5817430 60.4283806
1699 "Strip error from mayko format in ygraph output",
1702 # }}}
1704 # Strip error from Mayko format }}}
1706 todo_section:
1709 if ($Opt{'all'} || $Opt{'todo'}) {
1710 diag("Running TODO tests..."); # {{{
1712 TODO: {
1713 local $TODO = "Remove extra \\n in the beginning";
1714 testcmd("../gpst -t -o clean pause.gpx", # {{{
1715 <<END,
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",
1732 # }}}
1733 testcmd("../gpst -o csv multitrack.gpx", # {{{
1734 <<END,
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
1738 \t\t\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
1743 \t\t\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
1747 \t\t\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",
1758 # }}}
1759 testcmd("../gpst -o csv pause.gpx", # {{{
1760 <<END,
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",
1775 # }}}
1776 testcmd("../gpst --epoch -o csv pause.gpx", # {{{
1777 <<END,
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",
1792 # }}}
1793 $TODO = "Use gpsml, this Mayko thing is obsolete.";
1794 testcmd("../gpst -u no_signal.mayko", # {{{
1795 <<END,
1796 <?xml version="1.0" encoding="UTF-8"?>
1797 <gpsml>
1798 <track>
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>
1807 <break/>
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>
1811 </track>
1812 </gpsml>
1815 "Output gpsml from the -u option",
1817 # }}}
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",
1825 # }}}
1826 $TODO = 'Fix it.';
1827 # list_nearest_waypoints() {{{
1829 like(list_nearest_waypoints(60.42541, 5.29959, 3),
1830 qr/^\(.*,.*,.*\)$/,
1831 "list_nearest_waypoints()"
1834 # }}}
1836 # TODO tests }}}
1839 diag("Testing finished.");
1841 sub testcmd {
1842 # {{{
1843 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
1844 my $stderr_cmd = "";
1845 my $deb_str = $Opt{'debug'} ? " --debug" : "";
1846 my $Txt = join("",
1847 "\"$Cmd\"",
1848 defined($Desc)
1849 ? " - $Desc"
1850 : ""
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);
1863 } else {
1864 diag("Warning: stderr not defined for '$Txt'");
1866 # }}}
1869 sub file_data {
1870 # Return file content as a string {{{
1871 my $File = shift;
1872 my $Txt;
1873 if (open(FP, "<", $File)) {
1874 $Txt = join("", <FP>);
1875 close(FP);
1876 return($Txt);
1877 } else {
1878 return undef;
1880 # }}}
1883 sub print_version {
1884 # Print program version {{{
1885 print("$rcs_id\n");
1886 exit(0);
1887 # }}}
1888 } # print_version()
1890 sub usage {
1891 # Send the help message to stdout {{{
1892 my $Retval = shift;
1894 print(<<END);
1896 $rcs_id
1898 Usage: $progname [options] [file [files [...]]]
1900 Contains tests for the gpst(1) program.
1902 Options:
1904 -a, --all
1905 Run all tests, also TODOs.
1906 -h, --help
1907 Show this help.
1908 -t, --todo
1909 Run only the TODO tests.
1910 --version
1911 Print version information.
1912 --debug
1913 Print debugging messages.
1916 exit($Retval);
1917 # }}}
1918 } # usage()
1920 __END__
1922 # Plain Old Documentation (POD) {{{
1924 =pod
1926 =head1 NAME
1928 run-tests.pl
1930 =head1 REVISION
1932 $Id$
1934 =head1 SYNOPSIS
1936 run-tests.pl [options] [file [files [...]]]
1938 =head1 DESCRIPTION
1940 Contains tests for the gpst(1) program.
1942 =head1 OPTIONS
1944 =over 4
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.
1958 =item B<--version>
1960 Print version information.
1962 =item B<--debug>
1964 Print debugging messages.
1966 =back
1968 =head1 AUTHOR
1970 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
1972 =head1 COPYRIGHT
1974 Copyleft © Øyvind A. Holm &lt;sunny@sunbase.org&gt;
1975 This is free software; see the file F<COPYING> for legalese stuff.
1977 =head1 LICENCE
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
1993 =head1 SEE ALSO
1995 gpst(1)
1997 =cut
1999 # }}}
2001 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
2002 # End of file $Id$