gpsfold: Remove $Id$ at EOF.
[gpstools.git] / branches / gpst.gpxfix / tests / run-tests.pl
blob3cada3c90ec7de26308e2cf1363126c9a191f9c4
1 #!/usr/bin/perl -w
3 #=======================================================================
4 # $Id$
5 # File ID: b9e66fa2-f924-11dd-b57f-0001805bf4b1
6 # Test suite for gpst(1).
8 # Character set: UTF-8
9 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
14 BEGIN {
15 push(@INC, "$ENV{'HOME'}/bin/src/gpstools");
16 our @version_array;
17 use Test::More qw{no_plan};
18 use_ok(GPST);
19 use_ok(GPSTdate);
20 use_ok(GPSTdebug);
21 use_ok(GPSTgeo);
22 use_ok(GPSTxml);
25 use strict;
26 use Getopt::Long;
28 $| = 1;
30 our $Debug = 0;
31 our $CMD = "../gpst";
33 our %Opt = (
35 'all' => 0,
36 'debug' => 0,
37 'help' => 0,
38 'todo' => 0,
39 'verbose' => 0,
40 'version' => 0,
44 our $progname = $0;
45 $progname =~ s/^.*\/(.*?)$/$1/;
47 my $rcs_id = '$Id$';
48 my $id_date = $rcs_id;
49 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
51 push(@main::version_array, $rcs_id);
53 my @cmdline_array = @ARGV;
55 Getopt::Long::Configure("bundling");
56 GetOptions(
58 "all|a" => \$Opt{'all'},
59 "debug" => \$Opt{'debug'},
60 "help|h" => \$Opt{'help'},
61 "todo|t" => \$Opt{'todo'},
62 "verbose|v+" => \$Opt{'verbose'},
63 "version" => \$Opt{'version'},
65 ) || die("$progname: Option error. Use -h for help.\n");
67 our %Cmd = (
68 'gpsbabel' => 'gpsbabel',
71 $Opt{'debug'} && ($Debug = 1);
72 $Opt{'help'} && usage(0);
73 if ($Opt{'version'}) {
74 print_version();
75 exit(0);
78 diag(sprintf("========== Executing \"%s%s%s\" ==========",
79 $progname,
80 scalar(@cmdline_array) ? " " : "",
81 join(" ", @cmdline_array)));
83 chomp(my $gpx_header = <<END);
84 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
85 <gpx
86 version="1.1"
87 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
88 xmlns="http://www.topografix.com/GPX/1/1"
89 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
90 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
92 END
93 my $stripped_gpx_header = $gpx_header;
94 $stripped_gpx_header =~ s/^\s*(.*)$/$1/mg;
96 if ($Opt{'todo'} && !$Opt{'all'}) {
97 goto todo_section;
100 =pod
102 testcmd("$CMD command", # {{{
103 <<END,
104 [expected stdin]
107 "description",
110 # }}}
112 =cut
114 diag("Tests for this branch");
116 testcmd("../gpst -o gpx extensions.gpx", # {{{
117 <<END,
118 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
119 <gpx
120 version="1.1"
121 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
122 xmlns="http://www.topografix.com/GPX/1/1"
123 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
124 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
126 <trk>
127 <trkseg>
128 <trkpt lat="1.1" lon="2.1"> <ele>3.1</ele> <extensions> <test>yepp1</test> </extensions> </trkpt>
129 <trkpt lat="1.2" lon="2.2"> <ele>3.2</ele> <extensions> <test>yepp2</test> </extensions> </trkpt>
130 <extensions> <another>test</another> </extensions>
131 </trkseg>
132 </trk>
133 </gpx>
136 "Read and output GPX with <extensions> element",
139 # }}}
140 testcmd("../gpst -w -o gpx extensions.gpx", # {{{
141 <<END,
142 $stripped_gpx_header
143 <trk>
144 <trkseg>
145 <trkpt lat="1.1" lon="2.1"><ele>3.1</ele><extensions><test>yepp1</test></extensions></trkpt>
146 <trkpt lat="1.2" lon="2.2"><ele>3.2</ele><extensions><test>yepp2</test></extensions></trkpt>
147 <extensions><another>test</another></extensions>
148 </trkseg>
149 </trk>
150 </gpx>
153 "Read and output GPX with <extensions> element and strip whitespace",
156 # }}}
157 testcmd("../gpst -o gpx many-extensions.gpx", # {{{
158 <<END,
159 $gpx_header
160 <metadata>
161 <name>File with &lt;extensions&gt; elements</name>
162 <author>Me</author>
163 <extensions>
165 <aa>metadata aa</aa>
166 </a>
167 <mb>bb in metadata</mb>
168 </extensions>
169 </metadata>
170 <wpt lat="11" lon="12">
171 <name>Somewhere in Nigeria</name>
172 <extensions>
173 <wa>in wpt</wa>
174 </extensions>
175 </wpt>
176 <trk>
177 <name>Track 1</name>
178 <extensions>
179 <blurfl>inside trk</blurfl>
180 </extensions>
181 <trkseg>
182 <trkpt lat="21" lon="22">
183 <time>2001-02-03T04:05:06Z</time>
184 <extensions>
185 <ba>1 in trkpt</ba>
186 <bb>trkpt 2</bb>
187 <bc>
188 <bca>bca trkpt</bca>
189 <bcb>trkpt bcb</bcb>
190 <bcc>
191 <bcca>
192 <bccba>bccba stuff</bccba>
193 </bcca>
194 <bccb>
195 <bccbb>bccba thingy</bccbb>
196 </bccb>
197 </bcc>
198 </bc>
199 </extensions>
200 </trkpt>
201 <extensions>
202 <da>trkseg 1</da>
203 <db>trkseg 2</db>
204 </extensions>
205 </trkseg>
206 </trk>
207 <extensions>
209 <fa>in gpx</fa>
210 </f>
211 <g>Penguin Power</g>
212 </extensions>
213 </gpx>
216 "Output GPX format from GPX with many <extensions>",
219 # }}}
220 diag("Testing conversion routines...");
222 # txt_to_xml() and xml_to_txt() {{{
224 is(txt_to_xml("abc"),
225 "abc",
226 "txt_to_xml(\"abc\")");
227 is(txt_to_xml("<&>"),
228 "&lt;&amp;&gt;",
229 "txt_to_xml(\"<&>\")");
230 is(txt_to_xml("first line\nsecond <\rthird\r\n<&>"),
231 "first line\nsecond &lt;\rthird\r\n&lt;&amp;&gt;",
232 "txt_to_xml() with multiline string");
234 is(xml_to_txt("abc"),
235 "abc",
236 "xml_to_txt(\"abc\")");
237 is(xml_to_txt("&lt;&amp;&gt;"),
238 "<&>",
239 "xml_to_txt(\"&lt;&amp;&gt;\")");
240 is(xml_to_txt("first line\nsecond &lt;\rthird\r\n&lt;&amp;&gt;"),
241 "first line\nsecond <\rthird\r\n<&>",
242 "xml_to_txt() with multiline string");
244 # txt_to_xml() and xml_to_txt() }}}
245 # postgresql_copy_safe() {{{
247 is(postgresql_copy_safe(""),
249 "postgresql_copy_safe() with empty string");
251 is(postgresql_copy_safe("abcæøåÆØÅ"),
252 "abcæøåÆØÅ",
253 "postgresql_copy_safe(\"abcæøåÆØÅ\")");
255 is(postgresql_copy_safe("abc\t'\r\n"),
256 "abc\\t'\\r\\n",
257 "postgresql_copy_safe(\"abc\\t'\\r\\n\")");
259 is(postgresql_copy_safe("¤%/&gurgle\t325\\wer\ndfv'\r!\"#\n%\twe\r\x00sdf\xFFsadc\n\t\x00sdc\n"),
260 "¤%/&gurgle\\t325\\\\wer\\ndfv'\\r!\"#\\n%\\twe\\r\x00sdf\xFFsadc\\n\\t\x00sdc\\n",
261 "postgresql_copy_safe() with multiline, nulls and stuff");
263 # postgresql_copy_safe() }}}
265 diag("Testing date routines...");
267 # sec_to_string() {{{
269 is(sec_to_string(1148220825),
270 "2006-05-21 14:13:45",
271 "sec_to_string() without separator");
272 is(sec_to_string(1148220825, "T"),
273 "2006-05-21T14:13:45",
274 "sec_to_string() with separator");
275 is(sec_to_string(-5000),
276 undef,
277 "sec_to_string(-5000) — negative numbers unsupported atm");
278 is(sec_to_string(""),
279 undef,
280 "sec_to_string(\"\")");
281 is(sec_to_string("pH()rtY tW0"),
282 undef,
283 "sec_to_string() with invalid string");
284 is(sec_to_string("00000000000000000000001148220825"),
285 "2006-05-21 14:13:45",
286 "sec_to_string() with a bunch of leading zeros");
287 is(sec_to_string("1148220825.93"),
288 "2006-05-21 14:13:45.93",
289 "sec_to_string() with decimals");
290 is(sec_to_string("000000000000000000000000000001148220825.7312"),
291 "2006-05-21 14:13:45.7312",
292 "sec_to_string() with decimals and prefixing zeros");
293 is(sec_to_string("1148220825.93000"),
294 "2006-05-21 14:13:45.93",
295 "sec_to_string() with decimals and extra trailing zeros");
296 is(sec_to_string(".863"),
297 "1970-01-01 00:00:00.863",
298 "sec_to_string() with missing zero before decimal point");
300 # sec_to_string() }}}
301 # sec_to_readable() {{{
303 is(sec_to_readable(0),
304 "0:00:00:00",
305 "sec_to_readable(0)");
306 is(sec_to_readable("pH()rtY tW0"),
307 undef,
308 "sec_to_readable() with invalid string");
309 is(sec_to_readable(86400),
310 "1:00:00:00",
311 "sec_to_readable(86400)");
312 is(sec_to_readable(86400*1000),
313 "1000:00:00:00",
314 "sec_to_readable(86400*1000)");
315 is(sec_to_readable(86400+7200+180+4),
316 "1:02:03:04",
317 "sec_to_readable(86400+7200+180+4)");
318 is(sec_to_readable("3.14"),
319 "0:00:00:03.14",
320 "sec_to_readable(\"3.14\")");
321 is(sec_to_readable("-124"),
322 undef,
323 "sec_to_readable() rejects negative numbers");
324 is(sec_to_readable("-2.34"),
325 undef,
326 "sec_to_readable() rejects negative decimal");
327 is(sec_to_readable(".87"),
328 "0:00:00:00.87",
329 "sec_to_readable(), missing zero before decimal point");
330 is(sec_to_readable(""),
331 "0:00:00:00",
332 "sec_to_readable() with empty string");
334 # sec_to_readable() }}}
336 diag("Testing geo routines...");
338 # ddd_to_dms() {{{
340 is(ddd_to_dms("12.34567"),
341 "12\xB020'44.4\"",
342 "ddd_to_dms(\"12.34567\")");
344 is(ddd_to_dms("0"),
345 "0\xB000'00.0\"",
346 "ddd_to_dms(\"0\")");
348 is(ddd_to_dms(""),
349 "0\xB000'00.0\"",
350 "ddd_to_dms(\"\")");
352 is(ddd_to_dms("pH()rtY tW0"),
353 undef,
354 "ddd_to_dms(\"pH()rtY tW0\")");
356 is(ddd_to_dms("-12.34567"),
357 "-12\xB020'44.4\"",
358 "ddd_to_dms(\"-12.34567\")");
360 is(ddd_to_dms("0.34567"),
361 "0\xB020'44.4\"",
362 "ddd_to_dms(\"0.34567\")");
364 is(ddd_to_dms(".34567"),
365 "0\xB020'44.4\"",
366 "ddd_to_dms(\".34567\")");
368 is(ddd_to_dms("-.34567"),
369 "-0\xB020'44.4\"",
370 "ddd_to_dms(\"-.34567\")");
372 is(ddd_to_dms("-0.34567"),
373 "-0\xB020'44.4\"",
374 "ddd_to_dms(\"-0.34567\")");
376 is(ddd_to_dms("180"),
377 "180\xB000'00.0\"",
378 "ddd_to_dms(\"180\")");
380 is(ddd_to_dms("-180"),
381 "-180\xB000'00.0\"",
382 "ddd_to_dms(\"-180\")");
384 is(ddd_to_dms("-1"),
385 "-1\xB000'00.0\"",
386 "ddd_to_dms(\"-1\")");
388 is(ddd_to_dms("2-3"),
389 undef,
390 "ddd_to_dms(\"2-3\")");
392 # ddd_to_dms() }}}
394 diag("Testing trackpoint()..."); # {{{
396 my %Dat = ();
398 is(trackpoint(%Dat),
399 undef,
400 "trackpoint() receives empty hash");
402 my %Bck = (
403 # {{{
404 'format' => 'gpsml',
405 'year' => '2003',
406 'month' => '06',
407 'day' => '13',
408 'hour' => '14',
409 'min' => '36',
410 'sec' => '10',
411 'lat' => '59.5214',
412 'lon' => '7.392133',
413 'ele' => '762',
414 'error' => "",
415 'what' => 'tp',
416 # }}}
419 # trackpoint() (gpsml) {{{
420 %Dat = %Bck;
422 trackpoint(%Dat),
423 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
424 "trackpoint() (gpsml)"
427 # trackpoint() (gpsml) }}}
428 # trackpoint() (gpx) {{{
429 %Dat = %Bck;
430 $Dat{'format'} = "gpx";
432 trackpoint(%Dat),
433 qq{ <trkpt lat="59.5214" lon="7.392133"> <ele>762</ele> <time>2003-06-13T14:36:10Z</time> </trkpt>\n},
434 "trackpoint() (gpx)"
437 # trackpoint() (gpx) }}}
439 # trackpoint(): Various loop tests {{{
441 for my $Elem (qw{format lat lon what}) {
442 my %Dat = %Bck;
444 $Dat{"$Elem"} = '2d';
445 is(trackpoint(%Dat),
446 undef,
447 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") returns undef"
452 for my $Elem (qw{year month day hour min sec}) {
453 # Date tests {{{
454 my %Dat;
456 %Dat = %Bck;
457 $Dat{"$Elem"} = '';
458 is(trackpoint(%Dat),
459 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
460 "trackpoint(): {'$Elem'} with empty value skips time"
463 %Dat = %Bck;
464 $Dat{"$Elem"} = '2d';
465 is(trackpoint(%Dat),
466 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
467 "trackpoint(): {'$Elem'} with invalid value (\"$Dat{$Elem}\") skips time"
470 %Dat = %Bck;
471 $Dat{$Elem} = "00000$Dat{$Elem}";
472 is(trackpoint(%Dat),
473 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
474 "trackpoint(): Strip prefixing zeros from {'$Elem'}"
477 %Dat = %Bck;
478 $Dat{"$Elem"} = 0-$Dat{$Elem};
479 is(trackpoint(%Dat),
480 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
481 "trackpoint(): {'$Elem'} is negative, skip time"
484 if ($Elem ne "sec") {
485 %Dat = %Bck;
486 $Dat{"$Elem"} = "$Dat{$Elem}.00";
487 is(trackpoint(%Dat),
488 "<tp> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
489 "trackpoint(): Decimals in {'$Elem'}, skip time"
493 # Date tests }}}
496 %Dat = %Bck;
497 $Dat{'sec'} = "$Dat{'sec'}.00";
498 is(trackpoint(%Dat),
499 "<tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>\n",
500 "trackpoint(): Remove trailing zeros in {'sec'} decimals"
503 for my $Elem (qw{format what error}) {
504 my %Dat = %Bck;
505 $Dat{$Elem} = undef;
506 is(trackpoint(%Dat),
507 undef,
508 "trackpoint(): Missing {'$Elem'}, return undef"
512 # Various loop tests }}}
514 # trackpoint() }}}
516 diag("Testing output from ../gpst");
518 diag("Read empty input (/dev/null)..."); # {{{
519 testcmd("../gpst </dev/null", # {{{
520 <<END,
521 <?xml version="1.0" encoding="UTF-8"?>
522 <gpsml>
523 <track>
524 </track>
525 </gpsml>
528 "Read from /dev/null",
531 # }}}
532 testcmd("../gpst -o gpx </dev/null", # {{{
533 <<END,
534 $gpx_header
535 <trk>
536 <trkseg>
537 </trkseg>
538 </trk>
539 </gpx>
542 "Output gpx from /dev/null",
545 # }}}
546 # empty input }}}
547 diag("Read empty files..."); # {{{
548 testcmd("echo '<tp> </tp>' | ../gpst", # {{{
549 <<END,
550 <?xml version="1.0" encoding="UTF-8"?>
551 <gpsml>
552 <track>
553 </track>
554 </gpsml>
557 "Don’t print empty trackpoints",
560 # }}}
561 # Read empty files }}}
562 diag("Testing --chronology option..."); # {{{
563 testcmd("../gpst --chronology chronology-error.gpsml", # {{{
564 <<END,
565 <?xml version="1.0" encoding="UTF-8"?>
566 <gpsml>
567 <track>
568 <title>Chronology errors</title>
569 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
570 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
571 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
572 <break/>
573 <tp> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </tp>
574 <break/>
575 <pause>0:00:37:54</pause>
576 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
577 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
578 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
579 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
580 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
581 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
582 </track>
583 </gpsml>
585 "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" .
586 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
587 "Check for chronology errors and duplicated times",
590 # }}}
591 # --chronology option }}}
592 diag("Testing --skip-dups option..."); # {{{
593 testcmd("../gpst -d no_signal.mayko", # {{{
594 <<END,
595 <?xml version="1.0" encoding="UTF-8"?>
596 <gpsml>
597 <track>
598 <tp> <time>2002-12-22T21:42:24Z</time> <lat>70.6800486</lat> <lon>23.6746151</lon> </tp>
599 <tp> <time>2002-12-22T21:42:32Z</time> <lat>70.6799322</lat> <lon>23.6740038</lon> </tp>
600 <tp> <time>2002-12-22T21:42:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </tp>
601 <etp err="dup"> <time>2002-12-22T21:43:51Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
602 <etp err="dup"> <time>2002-12-22T21:43:52Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
603 <etp err="dup"> <time>2002-12-22T21:43:54Z</time> <lat>70.6796266</lat> <lon>23.6723991</lon> </etp>
604 <tp> <time>2002-12-22T21:44:45Z</time> <lat>70.6800774</lat> <lon>23.6757566</lon> </tp>
605 <tp> <time>2002-12-22T21:44:52Z</time> <lat>70.6801502</lat> <lon>23.6753442</lon> </tp>
606 <tp> <time>2002-12-22T21:45:04Z</time> <lat>70.6801905</lat> <lon>23.6757542</lon> </tp>
607 </track>
608 </gpsml>
611 "Remove duplicated positions from gpsml",
614 # }}}
615 testcmd("../gpst -d -o csv no_signal.mayko", # {{{
616 <<END,
617 2002-12-22T21:42:24Z\t23.6746151\t70.6800486\t\t
618 2002-12-22T21:42:32Z\t23.6740038\t70.6799322\t\t
619 2002-12-22T21:42:54Z\t23.6723991\t70.6796266\t\t
620 2002-12-22T21:44:45Z\t23.6757566\t70.6800774\t\t
621 2002-12-22T21:44:52Z\t23.6753442\t70.6801502\t\t
622 2002-12-22T21:45:04Z\t23.6757542\t70.6801905\t\t
625 "Remove duplicated positions from csv output format",
628 # }}}
629 testcmd("../gpst -d -o clean no_signal.mayko", # {{{
630 <<END,
631 23.6746151\t70.6800486\t
632 23.6740038\t70.6799322\t
633 23.6723991\t70.6796266\t
634 23.6757566\t70.6800774\t
635 23.6753442\t70.6801502\t
636 23.6757542\t70.6801905\t
639 "Remove duplicated positions from clean output format",
642 # }}}
643 testcmd("../gpst -d -o pgtab no_signal.mayko", # {{{
644 <<END,
645 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
646 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
647 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
648 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
649 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
650 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
653 "Remove duplicated positions from pgtab output format",
656 # }}}
657 # --skip-dups option }}}
658 diag("Testing --epoch option..."); # {{{
659 testcmd("../gpst -e pause.gpx", # {{{
660 <<END,
661 <?xml version="1.0" encoding="UTF-8"?>
662 <gpsml>
663 <track>
664 <title>ACTIVE LOG164705</title>
665 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
666 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
667 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
668 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
669 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
670 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
671 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
672 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
673 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
674 </track>
675 </gpsml>
678 "--epoch is ignored in gpsml output",
681 # }}}
682 testcmd("../gpst -e -o gpx pause-noname.gpx", # {{{
683 <<END,
684 $gpx_header
685 <trk>
686 <trkseg>
687 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
688 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
689 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
690 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
691 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
692 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
693 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
694 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
695 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
696 </trkseg>
697 </trk>
698 </gpx>
701 "--epoch is ignored in gpx output",
704 # }}}
705 # --epoch option }}}
706 diag("Testing --fix option..."); # {{{
707 testcmd("../gpst --fix --chronology chronology-error.gpsml", # {{{
708 <<END,
709 <?xml version="1.0" encoding="UTF-8"?>
710 <gpsml>
711 <track>
712 <title>Chronology errors</title>
713 <tp> <time>2006-05-02T09:46:37Z</time> <lat>60.45369</lat> <lon>5.31559</lon> <ele>95</ele> </tp>
714 <tp> <time>2006-05-02T09:46:42Z</time> <lat>60.45353</lat> <lon>5.31548</lon> <ele>94</ele> </tp>
715 <tp> <time>2006-05-02T09:46:46Z</time> <lat>60.45353</lat> <lon>5.31561</lon> <ele>94</ele> </tp>
716 <break/>
717 <etp err="chrono"> <time>2006-05-02T09:40:07Z</time> <lat>60.45369</lat> <lon>5.31597</lon> <desc>Out of chronology</desc> </etp>
718 <break/>
719 <pause>0:00:37:54</pause>
720 <tp> <time>2006-05-02T10:18:01Z</time> <lat>60.45418</lat> <lon>5.31517</lon> <ele>92</ele> </tp>
721 <tp> <time>2006-05-02T10:18:06Z</time> <lat>60.45407</lat> <lon>5.31542</lon> <ele>91</ele> </tp>
722 <tp> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </tp>
723 <etp err="duptime"> <time>2006-05-02T10:18:09Z</time> <lat>60.45401</lat> <lon>5.31543</lon> <ele>98</ele> </etp>
724 <tp> <time>2006-05-02T10:18:10Z</time> <lat>60.45395</lat> <lon>5.31544</lon> <ele>103</ele> </tp>
725 <tp> <time>2006-05-02T10:18:11Z</time> <lat>60.45391</lat> <lon>5.31545</lon> <ele>107</ele> </tp>
726 </track>
727 </gpsml>
729 "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" .
730 "gpst: chronology-error.gpsml: \"2006-05-02T10:18:09Z\": Duplicated time\n",
731 "Remove bad timestamps",
734 # }}}
735 # --fix option }}}
736 diag("Testing --from-date option..."); # {{{
737 # --from-date option }}}
738 diag("Testing -h (--help) option...");
739 likecmd("$CMD -h", # {{{
740 '/ Show this help\./',
741 '/^$/',
742 "Option -h prints help screen",
745 # }}}
746 ok(`$CMD -h` !~ /\$Id: /s, "\"$CMD -h\" - No Id with only -h");
747 # --help option }}}
748 diag("Testing --inside option..."); # {{{
749 testcmd("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --inside multitrack-pause.gpx", # {{{
750 <<END,
751 <?xml version="1.0" encoding="UTF-8"?>
752 <gpsml>
753 <track>
754 <title>track1</title>
755 <break/>
756 <title>track2</title>
757 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
758 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
759 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
760 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
761 <break/>
762 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
763 <break/>
764 <title>track3</title>
765 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
766 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
767 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
768 </track>
769 </gpsml>
772 "Check --inside option (gpx to gpst)",
774 # }}}
776 # --inside option }}}
777 diag("Testing --undefined option..."); # {{{
778 # --undefined option }}}
779 diag("Testing --near option..."); # {{{
780 # --near option }}}
781 diag("Testing --output option..."); # {{{
782 # gpsml (Default)
783 testcmd("../gpst log.mcsv", # {{{
784 <<END,
785 <?xml version="1.0" encoding="UTF-8"?>
786 <gpsml>
787 <track>
788 <break/>
789 <title>ACTIVE LOG 125</title>
790 <tp> <time>2006-03-04T11:12:30Z</time> <lat>54.96883</lat> <lon>-1.62439</lon> <ele>77</ele> </tp>
791 <tp> <time>2006-03-04T11:12:47Z</time> <lat>54.96878</lat> <lon>-1.62413</lon> <ele>77</ele> </tp>
792 <tp> <time>2006-03-04T11:12:55Z</time> <lat>54.96913</lat> <lon>-1.62616</lon> <ele>77</ele> </tp>
793 <tp> <time>2006-03-04T11:13:04Z</time> <lat>54.96934</lat> <lon>-1.62624</lon> <ele>77.5</ele> </tp>
794 <tp> <time>2006-03-04T11:13:33Z</time> <lat>54.96934</lat> <lon>-1.62596</lon> <ele>78</ele> </tp>
795 <tp> <time>2006-03-04T11:13:48Z</time> <lat>54.96931</lat> <lon>-1.62645</lon> <ele>78</ele> </tp>
796 <tp> <time>2006-03-04T11:14:05Z</time> <lat>54.96918</lat> <lon>-1.62603</lon> <ele>79</ele> </tp>
797 <tp> <time>2006-03-04T11:14:33Z</time> <lat>54.96901</lat> <lon>-1.62364</lon> <ele>76.1</ele> </tp>
798 <tp> <time>2006-03-04T11:15:02Z</time> <lat>54.96922</lat> <lon>-1.6254</lon> <ele>76.1</ele> </tp>
799 <tp> <time>2006-03-04T11:15:27Z</time> <lat>54.96914</lat> <lon>-1.62526</lon> <ele>75.1</ele> </tp>
800 <tp> <time>2006-03-04T11:15:50Z</time> <lat>54.96911</lat> <lon>-1.62494</lon> <ele>75.1</ele> </tp>
801 <tp> <time>2006-03-04T11:16:03Z</time> <lat>54.9693</lat> <lon>-1.62489</lon> <ele>75.1</ele> </tp>
802 <tp> <time>2006-03-04T11:16:19Z</time> <lat>54.96901</lat> <lon>-1.62496</lon> <ele>75.1</ele> </tp>
803 <tp> <time>2006-03-04T11:16:52Z</time> <lat>54.96871</lat> <lon>-1.62466</lon> <ele>74.6</ele> </tp>
804 <tp> <time>2006-03-04T11:17:25Z</time> <lat>54.96908</lat> <lon>-1.62488</lon> <ele>72.7</ele> </tp>
805 <break/>
806 <title>ACTIVE LOG 126</title>
807 <tp> <time>2006-03-04T11:18:32Z</time> <lat>54.96904</lat> <lon>-1.62482</lon> <ele>72.7</ele> </tp>
808 <tp> <time>2006-03-04T11:18:35Z</time> <lat>54.96913</lat> <lon>-1.62499</lon> <ele>71.3</ele> </tp>
809 <tp> <time>2006-03-04T11:18:38Z</time> <lat>54.96904</lat> <lon>-1.62497</lon> <ele>70.8</ele> </tp>
810 <tp> <time>2006-03-04T11:18:48Z</time> <lat>54.96913</lat> <lon>-1.62496</lon> <ele>71.8</ele> </tp>
811 <tp> <time>2006-03-04T11:18:55Z</time> <lat>54.96924</lat> <lon>-1.62501</lon> <ele>72.2</ele> </tp>
812 <tp> <time>2006-03-04T11:19:11Z</time> <lat>54.9694</lat> <lon>-1.62521</lon> <ele>71.8</ele> </tp>
813 <tp> <time>2006-03-04T11:19:30Z</time> <lat>54.96916</lat> <lon>-1.62515</lon> <ele>71.3</ele> </tp>
814 <tp> <time>2006-03-04T11:19:53Z</time> <lat>54.96921</lat> <lon>-1.625</lon> <ele>71.3</ele> </tp>
815 <tp> <time>2006-03-04T11:20:21Z</time> <lat>54.96801</lat> <lon>-1.62417</lon> <ele>71.8</ele> </tp>
816 <break/>
817 <title>ACTIVE LOG 127</title>
818 <tp> <time>2006-03-04T11:21:16Z</time> <lat>54.96887</lat> <lon>-1.62504</lon> <ele>70.8</ele> </tp>
819 <tp> <time>2006-03-04T11:21:18Z</time> <lat>54.96898</lat> <lon>-1.62476</lon> <ele>69.8</ele> </tp>
820 <tp> <time>2006-03-04T11:21:29Z</time> <lat>54.9691</lat> <lon>-1.62475</lon> <ele>69.4</ele> </tp>
821 <tp> <time>2006-03-04T11:21:46Z</time> <lat>54.96918</lat> <lon>-1.62468</lon> <ele>70.3</ele> </tp>
822 <tp> <time>2006-03-04T11:22:39Z</time> <lat>54.9692</lat> <lon>-1.62465</lon> <ele>69.4</ele> </tp>
823 <tp> <time>2006-03-04T11:22:43Z</time> <lat>54.96924</lat> <lon>-1.62462</lon> <ele>71.8</ele> </tp>
824 <tp> <time>2006-03-04T11:22:45Z</time> <lat>54.96928</lat> <lon>-1.62463</lon> <ele>71.8</ele> </tp>
825 <tp> <time>2006-03-04T11:23:00Z</time> <lat>54.96945</lat> <lon>-1.62466</lon> <ele>69.4</ele> </tp>
826 </track>
827 </gpsml>
830 "Read Mapsource TAB-separated format",
833 # }}}
834 testcmd("../gpst two-digit_year.mcsv", # {{{
835 <<END,
836 <?xml version="1.0" encoding="UTF-8"?>
837 <gpsml>
838 <track>
839 <break/>
840 <title>ACTIVE LOG 032</title>
841 <tp> <time>2006-03-20T20:35:33Z</time> <lat>60.41324</lat> <lon>5.33352</lon> <ele>14</ele> </tp>
842 <tp> <time>2006-03-20T20:35:38Z</time> <lat>60.38802</lat> <lon>5.33845</lon> <ele>18</ele> </tp>
843 <tp> <time>2006-03-20T20:35:44Z</time> <lat>60.38709</lat> <lon>5.3379</lon> <ele>19</ele> </tp>
844 <tp> <time>2006-03-20T20:35:49Z</time> <lat>60.38641</lat> <lon>5.33732</lon> <ele>18</ele> </tp>
845 <tp> <time>2006-03-20T20:35:54Z</time> <lat>60.38581</lat> <lon>5.33647</lon> <ele>18</ele> </tp>
846 <tp> <time>2006-03-20T20:36:00Z</time> <lat>60.38516</lat> <lon>5.33528</lon> <ele>15</ele> </tp>
847 <tp> <time>2006-03-20T20:36:02Z</time> <lat>60.38495</lat> <lon>5.3349</lon> <ele>13</ele> </tp>
848 </track>
849 </gpsml>
852 "Read Mapsource TAB-separated format with two-digit year",
855 # }}}
856 testcmd("../gpst log.gpstxt", # {{{
857 <<END,
858 <?xml version="1.0" encoding="UTF-8"?>
859 <gpsml>
860 <track>
861 <tp> <time>2003-06-13T14:36:09Z</time> <lat>59.521517</lat> <lon>7.391867</lon> <ele>762</ele> </tp>
862 <tp> <time>2003-06-13T14:36:10Z</time> <lat>59.5214</lat> <lon>7.392133</lon> <ele>762</ele> </tp>
863 <tp> <time>2003-06-13T14:36:11Z</time> <lat>59.5213</lat> <lon>7.392417</lon> <ele>761</ele> </tp>
864 <tp> <time>2003-06-13T14:36:12Z</time> <lat>59.521183</lat> <lon>7.3927</lon> <ele>761</ele> </tp>
865 <etp err="nosignal"> <time>2003-06-13T14:36:13Z</time> </etp>
866 <tp> <time>2003-06-13T14:36:15Z</time> <lat>59.52085</lat> <lon>7.393517</lon> <ele>760</ele> </tp>
867 <tp> <time>2003-06-13T14:36:16Z</time> <lat>59.520733</lat> <lon>7.393783</lon> <ele>760</ele> </tp>
868 <tp> <time>2003-06-13T14:36:17Z</time> <lat>59.52065</lat> <lon>7.39405</lon> <ele>760</ele> </tp>
869 <tp> <time>2003-06-13T14:36:18Z</time> <lat>59.520583</lat> <lon>7.394333</lon> <ele>760</ele> </tp>
870 <tp> <time>2003-06-13T14:36:19Z</time> <lat>59.520533</lat> <lon>7.394633</lon> <ele>759</ele> </tp>
871 <tp> <time>2003-06-13T14:36:20Z</time> <lat>59.520483</lat> <lon>7.394917</lon> <ele>759</ele> </tp>
872 <tp> <time>2003-06-13T14:36:21Z</time> <lat>59.520433</lat> <lon>7.395233</lon> <ele>759</ele> </tp>
873 <etp err="nosignal"> <time>2003-06-13T14:36:22Z</time> </etp>
874 <tp> <time>2003-06-13T14:36:24Z</time> <lat>59.520283</lat> <lon>7.396233</lon> <ele>758</ele> </tp>
875 <tp> <time>2003-06-13T14:36:25Z</time> <lat>59.520233</lat> <lon>7.39655</lon> <ele>758</ele> </tp>
876 <tp> <time>2003-06-13T14:36:26Z</time> <lat>59.520183</lat> <lon>7.396883</lon> <ele>757</ele> </tp>
877 <tp> <time>2003-06-13T14:36:27Z</time> <lat>59.520133</lat> <lon>7.397217</lon> <ele>757</ele> </tp>
878 <tp> <time>2003-06-13T14:36:28Z</time> <lat>59.5201</lat> <lon>7.397567</lon> <ele>757</ele> </tp>
879 </track>
880 </gpsml>
883 "Read Garmin serial text format",
886 # }}}
887 testcmd("../gpst log.dos.mayko", # {{{
888 <<END,
889 <?xml version="1.0" encoding="UTF-8"?>
890 <gpsml>
891 <track>
892 <tp> <time>2003-06-15T10:27:45Z</time> <lat>58.1818158</lat> <lon>8.1225077</lon> </tp>
893 <tp> <time>2003-06-15T10:27:53Z</time> <lat>58.1818712</lat> <lon>8.12532</lon> </tp>
894 <tp> <time>2003-06-15T10:27:57Z</time> <lat>58.1816347</lat> <lon>8.1266031</lon> </tp>
895 <tp> <time>2003-06-15T10:28:03Z</time> <lat>58.1812099</lat> <lon>8.1284612</lon> </tp>
896 <tp> <time>2003-06-15T10:28:06Z</time> <lat>58.1810315</lat> <lon>8.129395</lon> </tp>
897 <tp> <time>2003-06-15T10:28:10Z</time> <lat>58.1809621</lat> <lon>8.13074</lon> </tp>
898 </track>
899 </gpsml>
902 "Read DOS-formatted Mayko format",
905 # }}}
906 testcmd("../gpst log.dos.gpstxt", # {{{
907 <<END,
908 <?xml version="1.0" encoding="UTF-8"?>
909 <gpsml>
910 <track>
911 <tp> <time>2003-01-05T16:47:11Z</time> <lat>66.908167</lat> <lon>15.022983</lon> <ele>11472</ele> </tp>
912 <tp> <time>2003-01-05T16:47:12Z</time> <lat>66.90625</lat> <lon>15.020667</lon> <ele>11472</ele> </tp>
913 <tp> <time>2003-01-05T16:47:13Z</time> <lat>66.904317</lat> <lon>15.01835</lon> <ele>11472</ele> </tp>
914 <tp> <time>2003-01-05T16:47:14Z</time> <lat>66.9024</lat> <lon>15.016017</lon> <ele>11473</ele> </tp>
915 <tp> <time>2003-01-05T16:47:15Z</time> <lat>66.900483</lat> <lon>15.0137</lon> <ele>11474</ele> </tp>
916 <tp> <time>2003-01-05T16:47:16Z</time> <lat>66.898567</lat> <lon>15.011383</lon> <ele>11474</ele> </tp>
917 <tp> <time>2003-01-05T16:47:17Z</time> <lat>66.896633</lat> <lon>15.009067</lon> <ele>11475</ele> </tp>
918 <tp> <time>2003-01-05T16:47:18Z</time> <lat>66.894717</lat> <lon>15.006733</lon> <ele>11475</ele> </tp>
919 <tp> <time>2003-01-05T16:47:19Z</time> <lat>66.8928</lat> <lon>15.004417</lon> <ele>11475</ele> </tp>
920 <tp> <time>2003-01-05T16:47:20Z</time> <lat>66.890867</lat> <lon>15.0021</lon> <ele>11475</ele> </tp>
921 <tp> <time>2003-01-05T16:47:21Z</time> <lat>66.88895</lat> <lon>14.999783</lon> <ele>11475</ele> </tp>
922 </track>
923 </gpsml>
926 "Read DOS-formatted Garmin serial text format",
929 # }}}
930 testcmd("../gpst log.unix.mcsv", # {{{
931 <<END,
932 <?xml version="1.0" encoding="UTF-8"?>
933 <gpsml>
934 <track>
935 <break/>
936 <title>ACTIVE LOG 058</title>
937 <tp> <time>2006-02-21T15:14:25Z</time> <lat>60.36662</lat> <lon>5.24885</lon> <ele>31.9</ele> </tp>
938 <tp> <time>2006-02-21T15:14:30Z</time> <lat>60.37057</lat> <lon>5.22956</lon> <ele>35.2</ele> </tp>
939 <tp> <time>2006-02-21T15:14:35Z</time> <lat>60.37019</lat> <lon>5.22817</lon> <ele>39.6</ele> </tp>
940 <tp> <time>2006-02-21T15:14:36Z</time> <lat>60.37012</lat> <lon>5.2279</lon> <ele>41</ele> </tp>
941 <tp> <time>2006-02-21T15:14:40Z</time> <lat>60.37009</lat> <lon>5.22682</lon> <ele>47.2</ele> </tp>
942 <tp> <time>2006-02-21T15:14:42Z</time> <lat>60.37011</lat> <lon>5.22641</lon> <ele>49.2</ele> </tp>
943 <tp> <time>2006-02-21T15:14:44Z</time> <lat>60.37011</lat> <lon>5.22607</lon> <ele>50.1</ele> </tp>
944 <tp> <time>2006-02-21T15:14:48Z</time> <lat>60.37002</lat> <lon>5.22568</lon> <ele>51.1</ele> </tp>
945 <tp> <time>2006-02-21T15:14:51Z</time> <lat>60.3701</lat> <lon>5.22548</lon> <ele>52.5</ele> </tp>
946 </track>
947 </gpsml>
950 "Read UNIX-formatted Garmin Mapsource TAB-separated format",
953 # }}}
954 testcmd("../gpst multitrack.gpx", # {{{
955 <<END,
956 <?xml version="1.0" encoding="UTF-8"?>
957 <gpsml>
958 <track>
959 <title>Track 1</title>
960 <tp> <time>2003-02-11T23:35:39Z</time> <lat>51.4968266</lat> <lon>-0.1448824</lon> <desc>Trackpoint description #2 not meant for the GPS</desc> </tp>
961 <tp> <time>2003-02-11T23:35:49Z</time> <lat>51.4968227</lat> <lon>-0.1449938</lon> </tp>
962 <tp> <time>2003-02-11T23:36:14Z</time> <lat>51.496904</lat> <lon>-0.1453202</lon> </tp>
963 <break/>
964 <title>Track 2</title>
965 <tp> <time>2003-02-11T23:36:16Z</time> <lat>51.4969214</lat> <lon>-0.1453398</lon> </tp>
966 <tp> <time>2003-02-11T23:36:31Z</time> <lat>51.4969816</lat> <lon>-0.1455514</lon> </tp>
967 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
968 <tp> <time>2003-02-11T23:36:50Z</time> <lat>51.4970452</lat> <lon>-0.1457804</lon> </tp>
969 <break/>
970 <title>Track 3</title>
971 <tp> <time>2003-02-11T23:37:05Z</time> <lat>51.497068</lat> <lon>-0.1458608</lon> </tp>
972 <tp> <time>2003-02-11T23:37:22Z</time> <lat>51.4971658</lat> <lon>-0.1460047</lon> </tp>
973 <tp> <time>2003-02-11T23:37:36Z</time> <lat>51.4972469</lat> <lon>-0.1461614</lon> </tp>
974 <break/>
975 <title>Track 4</title>
976 <tp> <time>2003-02-11T23:37:43Z</time> <lat>51.4972731</lat> <lon>-0.1462394</lon> </tp>
977 <tp> <time>2003-02-11T23:38:04Z</time> <lat>51.4973437</lat> <lon>-0.1463232</lon> </tp>
978 <tp> <time>2003-02-11T23:38:28Z</time> <lat>51.4973337</lat> <lon>-0.1462949</lon> </tp>
979 <tp> <time>2003-02-11T23:38:34Z</time> <lat>51.4973218</lat> <lon>-0.1462825</lon> </tp>
980 <tp> <time>2003-02-11T23:38:35Z</time> <lat>51.4973145</lat> <lon>-0.1462732</lon> </tp>
981 </track>
982 </gpsml>
985 "Read GPX file with multiple tracks",
988 # }}}
989 testcmd("../gpst compact.gpx", # {{{
990 <<END,
991 <?xml version="1.0" encoding="UTF-8"?>
992 <gpsml>
993 <track>
994 <title>All whitespace stripped</title>
995 <tp> <time>2002-12-30T15:22:04Z</time> <lat>70.660932</lat> <lon>23.7028354</lon> </tp>
996 <tp> <time>2002-12-30T15:22:06Z</time> <lat>70.6609392</lat> <lon>23.7028468</lon> </tp>
997 <tp> <time>2002-12-30T15:22:08Z</time> <lat>70.6609429</lat> <lon>23.7028499</lon> </tp>
998 <tp> <time>2002-12-30T15:22:11Z</time> <lat>70.6609381</lat> <lon>23.702862</lon> </tp>
999 <tp> <time>2002-12-30T15:22:12Z</time> <lat>70.6609368</lat> <lon>23.7028648</lon> </tp>
1000 <tp> <time>2002-12-30T15:22:13Z</time> <lat>70.6609344</lat> <lon>23.7028652</lon> </tp>
1001 <tp> <time>2002-12-30T15:22:15Z</time> <lat>70.6609349</lat> <lon>23.7028707</lon> </tp>
1002 <tp> <time>2002-12-30T15:22:17Z</time> <lat>70.6609348</lat> <lon>23.7028654</lon> </tp>
1003 <tp> <time>2002-12-30T15:22:19Z</time> <lat>70.6609347</lat> <lon>23.7028599</lon> </tp>
1004 <tp> <time>2002-12-30T15:22:20Z</time> <lat>70.6609348</lat> <lon>23.7028609</lon> </tp>
1005 <tp> <time>2002-12-30T15:22:23Z</time> <lat>70.6609388</lat> <lon>23.7028653</lon> </tp>
1006 <tp> <time>2002-12-30T15:22:25Z</time> <lat>70.6609426</lat> <lon>23.7028732</lon> </tp>
1007 </track>
1008 </gpsml>
1011 "Read GPX one-liner",
1014 # }}}
1015 testcmd("../gpst missing.gpsml", # {{{
1016 <<END,
1017 <?xml version="1.0" encoding="UTF-8"?>
1018 <gpsml>
1019 <track>
1020 <title>Missing various elements</title>
1021 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1022 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1023 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1024 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1025 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1026 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1027 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1028 <tp> <ele>486</ele> </tp>
1029 <tp> <desc>Missing everything</desc> </tp>
1030 <tp> <lat>60.42339</lat> </tp>
1031 <tp> <lon>5.34262</lon> </tp>
1032 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1033 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1034 </track>
1035 </gpsml>
1038 "Read gpsml with various data missing",
1041 # }}}
1042 testcmd("../gpst different_dateformats.gpsml", # {{{
1043 <<END,
1044 <?xml version="1.0" encoding="UTF-8"?>
1045 <gpsml>
1046 <track>
1047 <title>Date format variations</title>
1048 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1</lat> <lon>1</lon> </tp>
1049 <tp> <time>2006-01-01T00:00:02Z</time> <lat>2</lat> <lon>2</lon> </tp>
1050 <tp> <time>2006-01-01T00:00:03Z</time> <lat>3</lat> <lon>3</lon> </tp>
1051 <tp> <time>2006-01-01T00:00:04Z</time> <lat>4</lat> <lon>4</lon> </tp>
1052 </track>
1053 </gpsml>
1056 "Read different date formats from gpsml file",
1059 # }}}
1060 testcmd("../gpst multitrack-pause.gpx", # {{{
1061 file_data("multitrack-pause.gpsml"),
1063 "Should be equal to multitrack-pause.gpsml",
1066 # }}}
1067 # gpx
1068 testcmd("../gpst -o gpx no_signal.mayko", # {{{
1069 <<END,
1070 $gpx_header
1071 <trk>
1072 <trkseg>
1073 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
1074 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
1075 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
1076 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> </trkpt>
1077 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> </trkpt>
1078 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> </trkpt>
1079 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
1080 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1081 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1082 </trkseg>
1083 </trk>
1084 </gpx>
1087 "Output GPX from Mayko file with duplicates",
1090 # }}}
1091 testcmd("../gpst -o gpx comments.mayko", # {{{
1092 <<END,
1093 $gpx_header
1094 <trk>
1095 <trkseg>
1096 <trkpt lat="70.6800486" lon="23.6746151"> <time>2002-12-22T21:42:24Z</time> </trkpt>
1097 <trkpt lat="70.6799322" lon="23.6740038"> <time>2002-12-22T21:42:32Z</time> </trkpt>
1098 <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:42:54Z</time> </trkpt>
1099 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:51Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1100 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:52Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1101 <!-- <trkpt lat="70.6796266" lon="23.6723991"> <time>2002-12-22T21:43:54Z</time> <extensions> <error>desc</error> </extensions> </trkpt> -->
1102 <trkpt lat="70.6800774" lon="23.6757566"> <time>2002-12-22T21:44:45Z</time> </trkpt>
1103 </trkseg>
1104 <trkseg>
1105 <trkpt lat="70.6801502" lon="23.6753442"> <time>2002-12-22T21:44:52Z</time> </trkpt>
1106 <trkpt lat="70.6801905" lon="23.6757542"> <time>2002-12-22T21:45:04Z</time> </trkpt>
1107 </trkseg>
1108 </trk>
1109 </gpx>
1112 "Output GPX from Mayko file with commented-out lines",
1115 # }}}
1116 testcmd("../gpst -o gpx missing-noname.gpsml", # {{{
1117 <<END,
1118 $gpx_header
1119 <trk>
1120 <trkseg>
1121 <trkpt lat="60.42353" lon="5.34185"> <time>2006-04-30T17:17:09Z</time> </trkpt>
1122 <trkpt> <ele>483</ele> <time>2006-04-30T17:17:11Z</time> </trkpt>
1123 <trkpt> <ele>485</ele> <time>2006-04-30T17:17:22Z</time> </trkpt>
1124 <trkpt lat="60.42347" lon="5.34212"> <ele>486</ele> </trkpt>
1125 <trkpt> <ele>484</ele> </trkpt>
1126 <trkpt> <ele>486</ele> </trkpt>
1127 <trkpt> <ele>490</ele> <time>2006-04-30T17:18:03Z</time> </trkpt>
1128 <trkpt lat="60.42338" lon="5.34269"> <ele>487</ele> <time>2006-04-30T17:18:05Z</time> </trkpt>
1129 </trkseg>
1130 </trk>
1131 </gpx>
1134 "Output GPX from gpsml with missing data",
1137 # }}}
1138 # xgraph
1139 testcmd("../gpst -o xgraph multitrack.gpx", # {{{
1140 <<END,
1141 -0.1448824 51.4968266
1142 -0.1449938 51.4968227
1143 -0.1453202 51.4969040
1144 move -0.1453398 51.4969214
1145 -0.1455514 51.4969816
1146 -0.1457489 51.4970224
1147 -0.1457804 51.4970452
1148 move -0.1458608 51.4970680
1149 -0.1460047 51.4971658
1150 -0.1461614 51.4972469
1151 move -0.1462394 51.4972731
1152 -0.1463232 51.4973437
1153 -0.1462949 51.4973337
1154 -0.1462825 51.4973218
1155 -0.1462732 51.4973145
1158 "Output xgraph format from GPX",
1161 # }}}
1162 # pgtab
1163 testcmd("../gpst -o pgtab compact.gpx", # {{{
1164 <<END,
1165 2002-12-30T15:22:04Z\t(70.6609320,23.7028354)\t\\N\t\\N\t\\N\t\\N
1166 2002-12-30T15:22:06Z\t(70.6609392,23.7028468)\t\\N\t\\N\t\\N\t\\N
1167 2002-12-30T15:22:08Z\t(70.6609429,23.7028499)\t\\N\t\\N\t\\N\t\\N
1168 2002-12-30T15:22:11Z\t(70.6609381,23.7028620)\t\\N\t\\N\t\\N\t\\N
1169 2002-12-30T15:22:12Z\t(70.6609368,23.7028648)\t\\N\t\\N\t\\N\t\\N
1170 2002-12-30T15:22:13Z\t(70.6609344,23.7028652)\t\\N\t\\N\t\\N\t\\N
1171 2002-12-30T15:22:15Z\t(70.6609349,23.7028707)\t\\N\t\\N\t\\N\t\\N
1172 2002-12-30T15:22:17Z\t(70.6609348,23.7028654)\t\\N\t\\N\t\\N\t\\N
1173 2002-12-30T15:22:19Z\t(70.6609347,23.7028599)\t\\N\t\\N\t\\N\t\\N
1174 2002-12-30T15:22:20Z\t(70.6609348,23.7028609)\t\\N\t\\N\t\\N\t\\N
1175 2002-12-30T15:22:23Z\t(70.6609388,23.7028653)\t\\N\t\\N\t\\N\t\\N
1176 2002-12-30T15:22:25Z\t(70.6609426,23.7028732)\t\\N\t\\N\t\\N\t\\N
1179 "Output pgtab from gpx format",
1182 # }}}
1183 testcmd("../gpst -o pgtab no_signal.mayko", # {{{
1184 <<END,
1185 2002-12-22T21:42:24Z\t(70.6800486,23.6746151)\t\\N\t\\N\t\\N\t\\N
1186 2002-12-22T21:42:32Z\t(70.6799322,23.6740038)\t\\N\t\\N\t\\N\t\\N
1187 2002-12-22T21:42:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1188 2002-12-22T21:43:51Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1189 2002-12-22T21:43:52Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1190 2002-12-22T21:43:54Z\t(70.6796266,23.6723991)\t\\N\t\\N\t\\N\t\\N
1191 2002-12-22T21:44:45Z\t(70.6800774,23.6757566)\t\\N\t\\N\t\\N\t\\N
1192 2002-12-22T21:44:52Z\t(70.6801502,23.6753442)\t\\N\t\\N\t\\N\t\\N
1193 2002-12-22T21:45:04Z\t(70.6801905,23.6757542)\t\\N\t\\N\t\\N\t\\N
1196 "Output pgtab from mayko format",
1199 # }}}
1200 testcmd("../gpst -o pgtab missing.gpsml", # {{{
1201 <<END,
1202 2006-04-30T17:17:09Z\t(60.42353,5.34185)\t\\N\t\\N\t\\N\t\\N
1203 \\N\t(60.42347,5.34212)\t486\t\\N\t\\N\t\\N
1204 2006-04-30T17:18:05Z\t(60.42338,5.34269)\t487\t\\N\t\\N\t\\N
1207 "Output pgtab from missing.gpsml",
1210 # }}}
1211 # csv
1212 testcmd("../gpst -o csv log.dos.mayko", # {{{
1213 <<END,
1214 2003-06-15T10:27:45Z\t8.1225077\t58.1818158\t\t
1215 2003-06-15T10:27:53Z\t8.1253200\t58.1818712\t\t
1216 2003-06-15T10:27:57Z\t8.1266031\t58.1816347\t\t
1217 2003-06-15T10:28:03Z\t8.1284612\t58.1812099\t\t
1218 2003-06-15T10:28:06Z\t8.1293950\t58.1810315\t\t
1219 2003-06-15T10:28:10Z\t8.1307400\t58.1809621\t\t
1222 "Output csv from DOS-formatted Mayko format",
1225 # }}}
1226 # pgwtab
1227 testcmd("../gpst -o pgwtab multitrack.gpx", # {{{
1228 <<END,
1229 (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
1230 (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
1231 (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
1232 (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
1233 (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
1234 (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
1237 "Test pgwtab format",
1240 # }}}
1241 # pgwupd
1242 testcmd("../gpst -o pgwupd multitrack.gpx", # {{{
1243 <<END,
1244 BEGIN;
1245 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1246 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1247 COMMIT;
1248 BEGIN;
1249 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1250 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1251 COMMIT;
1252 BEGIN;
1253 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1254 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1255 COMMIT;
1256 BEGIN;
1257 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1258 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1259 COMMIT;
1260 BEGIN;
1261 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1262 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1263 COMMIT;
1264 BEGIN;
1265 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1266 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1267 COMMIT;
1270 "Test pgwupd format",
1273 # }}}
1274 # clean
1275 testcmd("../gpst -t -o clean pause.gpx", # {{{
1276 <<END,
1277 5.299534\t60.425494\t25.260
1278 5.299610\t60.425464\t24.931
1280 5.299694\t60.425314\t27.975
1282 5.299741\t60.425384\t31.017
1283 5.299958\t60.425339\t30.980
1284 5.299640\t60.425238\t30.538
1285 5.299686\t60.425246\t30.515
1287 5.299773\t60.425345\t31.936
1288 5.299419\t60.425457\t31.794
1291 "Output clean format with time breaks",
1293 # }}}
1294 # gpstrans
1295 # poscount
1296 # ps (Unfinished)
1297 # svg (Unfinished)
1298 # ygraph
1299 # --output option }}}
1300 diag("Testing --outside option..."); # {{{
1301 testcmd("../gpst --pos1 2.11,2.12 --pos2 3.31,3.32 --outside multitrack-pause.gpx", # {{{
1302 <<END,
1303 <?xml version="1.0" encoding="UTF-8"?>
1304 <gpsml>
1305 <track>
1306 <title>track1</title>
1307 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1308 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1309 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1310 <break/>
1311 <title>track2</title>
1312 <break/>
1313 <title>track3</title>
1314 <break/>
1315 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1316 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1317 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1318 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1319 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1320 </track>
1321 </gpsml>
1324 "Check --outside option (gpx to gpst)",
1327 # }}}
1328 # --outside option }}}
1329 diag("Testing --pos1 and --pos2 options..."); # {{{
1330 # --pos1 and --pos2 options }}}
1331 diag("Testing --require option..."); # {{{
1332 testcmd("../gpst -re multitrack.gpx", # {{{
1333 <<END,
1334 <?xml version="1.0" encoding="UTF-8"?>
1335 <gpsml>
1336 <track>
1337 <title>Track 1</title>
1338 <break/>
1339 <title>Track 2</title>
1340 <tp> <time>2003-02-11T23:36:43Z</time> <lat>51.4970224</lat> <lon>-0.1457489</lon> <ele>1000</ele> </tp>
1341 <break/>
1342 <title>Track 3</title>
1343 <break/>
1344 <title>Track 4</title>
1345 </track>
1346 </gpsml>
1349 "Require elevation from GPX data",
1352 # }}}
1353 testcmd("../gpst -re one_ele.dos.gpsml", # {{{
1354 <<END,
1355 <?xml version="1.0" encoding="UTF-8"?>
1356 <gpsml>
1357 <track>
1358 <title>Only one point has elevation</title>
1359 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1360 </track>
1361 </gpsml>
1364 "Require elevation from gpsml",
1367 # }}}
1368 testcmd("../gpst -re missing.gpsml", # {{{
1369 <<END,
1370 <?xml version="1.0" encoding="UTF-8"?>
1371 <gpsml>
1372 <track>
1373 <title>Missing various elements</title>
1374 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1375 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1376 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1377 <tp> <lon>5.34224</lon> <ele>484</ele> </tp>
1378 <tp> <ele>486</ele> </tp>
1379 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1380 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1381 </track>
1382 </gpsml>
1385 "Require elevation",
1388 # }}}
1389 testcmd("../gpst -rt missing.gpsml", # {{{
1390 <<END,
1391 <?xml version="1.0" encoding="UTF-8"?>
1392 <gpsml>
1393 <track>
1394 <title>Missing various elements</title>
1395 <tp> <time>2006-04-30T17:16:59Z</time> </tp>
1396 <tp> <time>2006-04-30T17:17:00Z</time> <lat>60.42352</lat> </tp>
1397 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1398 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1399 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1400 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1401 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1402 </track>
1403 </gpsml>
1406 "Require time",
1409 # }}}
1410 testcmd("../gpst -rp missing.gpsml", # {{{
1411 <<END,
1412 <?xml version="1.0" encoding="UTF-8"?>
1413 <gpsml>
1414 <track>
1415 <title>Missing various elements</title>
1416 <tp> <time>2006-04-30T17:17:09Z</time> <lat>60.42353</lat> <lon>5.34185</lon> </tp>
1417 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1418 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1419 </track>
1420 </gpsml>
1423 "Require position",
1426 # }}}
1427 testcmd("../gpst -ret missing.gpsml", # {{{
1428 <<END,
1429 <?xml version="1.0" encoding="UTF-8"?>
1430 <gpsml>
1431 <track>
1432 <title>Missing various elements</title>
1433 <tp> <time>2006-04-30T17:17:11Z</time> <lon>5.34187</lon> <ele>483</ele> </tp>
1434 <tp> <time>2006-04-30T17:17:22Z</time> <ele>485</ele> </tp>
1435 <tp> <time>2006-04-30T17:18:03Z</time> <lat>60.42339</lat> <ele>490</ele> </tp>
1436 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1437 </track>
1438 </gpsml>
1441 "Require elevation and time",
1444 # }}}
1445 testcmd("../gpst -retp missing.gpsml", # {{{
1446 <<END,
1447 <?xml version="1.0" encoding="UTF-8"?>
1448 <gpsml>
1449 <track>
1450 <title>Missing various elements</title>
1451 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1452 </track>
1453 </gpsml>
1456 "Require elevation, time and position",
1459 # }}}
1460 testcmd("../gpst -rep missing.gpsml", # {{{
1461 <<END,
1462 <?xml version="1.0" encoding="UTF-8"?>
1463 <gpsml>
1464 <track>
1465 <title>Missing various elements</title>
1466 <tp> <lat>60.42347</lat> <lon>5.34212</lon> <ele>486</ele> </tp>
1467 <tp> <time>2006-04-30T17:18:05Z</time> <lat>60.42338</lat> <lon>5.34269</lon> <ele>487</ele> </tp>
1468 </track>
1469 </gpsml>
1472 "Require elevation and position",
1475 # }}}
1476 # --require option }}}
1477 diag("Testing --round option..."); # {{{
1478 testcmd("../gpst -R lat=4,lon=5,ele=1 pause.gpx", # {{{
1479 <<END,
1480 <?xml version="1.0" encoding="UTF-8"?>
1481 <gpsml>
1482 <track>
1483 <title>ACTIVE LOG164705</title>
1484 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.4255</lat> <lon>5.29953</lon> <ele>25.3</ele> </tp>
1485 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.4255</lat> <lon>5.29961</lon> <ele>24.9</ele> </tp>
1486 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.4253</lat> <lon>5.29969</lon> <ele>28</ele> </tp>
1487 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.4254</lat> <lon>5.29974</lon> <ele>31</ele> </tp>
1488 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.4253</lat> <lon>5.29996</lon> <ele>31</ele> </tp>
1489 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.4252</lat> <lon>5.29964</lon> <ele>30.5</ele> </tp>
1490 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.4252</lat> <lon>5.29969</lon> <ele>30.5</ele> </tp>
1491 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.4253</lat> <lon>5.29977</lon> <ele>31.9</ele> </tp>
1492 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.4255</lat> <lon>5.29942</lon> <ele>31.8</ele> </tp>
1493 </track>
1494 </gpsml>
1497 "--round works with lat, lon, ele from gpx",
1500 # }}}
1501 testcmd("../gpst -R lat=3,lon=3,ele=1 -o pgtab pause.gpx", # {{{
1502 <<END,
1503 2006-05-21T16:49:11Z\t(60.425,5.3)\t25.3\t\\N\t\\N\t\\N
1504 2006-05-21T16:49:46Z\t(60.425,5.3)\t24.9\t\\N\t\\N\t\\N
1505 2006-05-21T16:52:04Z\t(60.425,5.3)\t28\t\\N\t\\N\t\\N
1506 2006-05-21T16:56:36Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1507 2006-05-21T16:56:47Z\t(60.425,5.3)\t31\t\\N\t\\N\t\\N
1508 2006-05-21T16:56:56Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1509 2006-05-21T16:57:03Z\t(60.425,5.3)\t30.5\t\\N\t\\N\t\\N
1510 2006-05-21T16:59:08Z\t(60.425,5.3)\t31.9\t\\N\t\\N\t\\N
1511 2006-05-21T17:00:54Z\t(60.425,5.299)\t31.8\t\\N\t\\N\t\\N
1514 "pgtab output from gpx works with --round lat, lon, ele",
1517 # }}}
1518 testcmd("../gpst -R lat=3,lon=3,ele=1 -o pgwtab multitrack.gpx", # {{{
1519 <<END,
1520 (51.478,-0.001)\t0-Meridian\t\\N\t\\N\t\\N\t11-FEB-03 15:46\t11-FEB-03 15:46\t\\N\t\\N
1521 (51.532,-0.177)\tAbbey Road\t34.5\t\\N\t\\N\tDet hellige gangfeltet der Beatles valsa over.\t26-FEB-06 17:29:46\t\\N\t\\N
1522 (61.637,8.312)\tGaldhøpiggen med ', &, < og >. ☺\t2469\tmountain\t2006-05-08T18:27:59Z\tHer er det &, < og >. ☺\tSchwæra greie\thttp://www.example.org/\tWaypoint
1523 (60.397,5.351)\tHalfdan Griegs vei\t\\N\t\\N\t\\N\t04-AUG-02 19:42\t04-AUG-02 19:42\t\\N\t\\N
1524 (51.51,-0.13)\tLeicester Square\t\\N\t\\N\t\\N\t11-FEB-03 18:00\t11-FEB-03 18:00\t\\N\t\\N
1525 (60.969,9.285)\tLeira camping\t\\N\t\\N\t\\N\t03-OKT-02 21:58\t03-OKT-02 21:58\t\\N\t\\N
1528 "--round works with lat, lon, ele from gpx, pgwtab output",
1531 # }}}
1532 testcmd("../gpst -R lat=3,lon=3,ele=1 -o pgwupd multitrack.gpx", # {{{
1533 <<END,
1534 BEGIN;
1535 UPDATE logg SET name = clname(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1536 UPDATE logg SET dist = cldist(coor) WHERE (point(51.478,-0.001) <-> coor) < 0.05;
1537 COMMIT;
1538 BEGIN;
1539 UPDATE logg SET name = clname(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1540 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532,-0.177) <-> coor) < 0.05;
1541 COMMIT;
1542 BEGIN;
1543 UPDATE logg SET name = clname(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1544 UPDATE logg SET dist = cldist(coor) WHERE (point(61.637,8.312) <-> coor) < 0.05;
1545 COMMIT;
1546 BEGIN;
1547 UPDATE logg SET name = clname(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1548 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397,5.351) <-> coor) < 0.05;
1549 COMMIT;
1550 BEGIN;
1551 UPDATE logg SET name = clname(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1552 UPDATE logg SET dist = cldist(coor) WHERE (point(51.51,-0.13) <-> coor) < 0.05;
1553 COMMIT;
1554 BEGIN;
1555 UPDATE logg SET name = clname(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1556 UPDATE logg SET dist = cldist(coor) WHERE (point(60.969,9.285) <-> coor) < 0.05;
1557 COMMIT;
1560 "pgwupd output and --round works with lat, lon, ele from gpx",
1563 # }}}
1564 # --round option }}}
1565 diag("Testing --short-date option..."); # {{{
1566 # --short-date option }}}
1567 diag("Testing --save-to-file option..."); # {{{
1568 # --save-to-file option }}}
1569 diag("Testing --create-breaks option..."); # {{{
1570 testcmd("../gpst -t pause.gpx", # {{{
1571 <<END,
1572 <?xml version="1.0" encoding="UTF-8"?>
1573 <gpsml>
1574 <track>
1575 <title>ACTIVE LOG164705</title>
1576 <tp> <time>2006-05-21T16:49:11Z</time> <lat>60.425494</lat> <lon>5.299534</lon> <ele>25.26</ele> </tp>
1577 <tp> <time>2006-05-21T16:49:46Z</time> <lat>60.425464</lat> <lon>5.29961</lon> <ele>24.931</ele> </tp>
1578 <pause>0:00:02:18</pause>
1579 <tp> <time>2006-05-21T16:52:04Z</time> <lat>60.425314</lat> <lon>5.299694</lon> <ele>27.975</ele> </tp>
1580 <pause>0:00:04:32</pause>
1581 <tp> <time>2006-05-21T16:56:36Z</time> <lat>60.425384</lat> <lon>5.299741</lon> <ele>31.017</ele> </tp>
1582 <tp> <time>2006-05-21T16:56:47Z</time> <lat>60.425339</lat> <lon>5.299958</lon> <ele>30.98</ele> </tp>
1583 <tp> <time>2006-05-21T16:56:56Z</time> <lat>60.425238</lat> <lon>5.29964</lon> <ele>30.538</ele> </tp>
1584 <tp> <time>2006-05-21T16:57:03Z</time> <lat>60.425246</lat> <lon>5.299686</lon> <ele>30.515</ele> </tp>
1585 <pause>0:00:02:05</pause>
1586 <tp> <time>2006-05-21T16:59:08Z</time> <lat>60.425345</lat> <lon>5.299773</lon> <ele>31.936</ele> </tp>
1587 <tp> <time>2006-05-21T17:00:54Z</time> <lat>60.425457</lat> <lon>5.299419</lon> <ele>31.794</ele> </tp>
1588 </track>
1589 </gpsml>
1592 "Output gpsml with <pause> elements from GPX files",
1595 # }}}
1596 testcmd("../gpst -t multitrack-pause.gpx", # {{{
1597 <<END,
1598 <?xml version="1.0" encoding="UTF-8"?>
1599 <gpsml>
1600 <track>
1601 <title>track1</title>
1602 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1603 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1604 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1605 <break/>
1606 <title>track2</title>
1607 <pause>0:23:59:58</pause>
1608 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1609 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1610 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1611 <pause>0:01:00:00</pause>
1612 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1613 <break/>
1614 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1615 <break/>
1616 <title>track3</title>
1617 <pause>1:01:00:03</pause>
1618 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1619 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1620 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1621 <break/>
1622 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1623 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1624 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1625 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1626 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1627 </track>
1628 </gpsml>
1631 "Insert <pause> between gpx tracks",
1634 # }}}
1635 testcmd("../gpst -t multitrack-pause.gpsml", # {{{
1636 <<END,
1637 <?xml version="1.0" encoding="UTF-8"?>
1638 <gpsml>
1639 <track>
1640 <title>track1</title>
1641 <tp> <time>2006-01-01T00:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1642 <tp> <time>2006-01-01T00:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1643 <tp> <time>2006-01-01T00:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1644 <break/>
1645 <title>track2</title>
1646 <pause>0:23:59:58</pause>
1647 <tp> <time>2006-01-02T00:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1648 <tp> <time>2006-01-02T00:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1649 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1650 <pause>0:01:00:00</pause>
1651 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1652 <break/>
1653 <tp> <time>2006-01-02T01:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1654 <break/>
1655 <title>track3</title>
1656 <pause>1:01:00:03</pause>
1657 <tp> <time>2006-01-03T02:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1658 <tp> <time>2006-01-03T02:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1659 <tp> <time>2006-01-03T02:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1660 <break/>
1661 <tp> <time>2006-01-03T02:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1662 <tp> <time>2006-01-03T02:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1663 <tp> <time>2006-01-03T02:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1664 <tp> <time>2006-01-03T02:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1665 <tp> <time>2006-01-03T02:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1666 </track>
1667 </gpsml>
1670 "Insert <pause> between gpsml titles",
1673 # }}}
1674 # --create-breaks option }}}
1675 diag("Testing -T (--time-shift) option...");
1676 testcmd("$CMD -T 3600 multitrack-pause.gpx", # {{{
1677 <<END,
1678 <?xml version="1.0" encoding="UTF-8"?>
1679 <gpsml>
1680 <track>
1681 <title>track1</title>
1682 <tp> <time>2006-01-01T01:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1683 <tp> <time>2006-01-01T01:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1684 <tp> <time>2006-01-01T01:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1685 <break/>
1686 <title>track2</title>
1687 <tp> <time>2006-01-02T01:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1688 <tp> <time>2006-01-02T01:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1689 <tp> <time>2006-01-02T01:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1690 <tp> <time>2006-01-02T02:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1691 <break/>
1692 <tp> <time>2006-01-02T02:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1693 <break/>
1694 <title>track3</title>
1695 <tp> <time>2006-01-03T03:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1696 <tp> <time>2006-01-03T03:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1697 <tp> <time>2006-01-03T03:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1698 <break/>
1699 <tp> <time>2006-01-03T03:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1700 <tp> <time>2006-01-03T03:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1701 <tp> <time>2006-01-03T03:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1702 <tp> <time>2006-01-03T03:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1703 <tp> <time>2006-01-03T03:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1704 </track>
1705 </gpsml>
1708 "Add one hour to GPX input, output gpsml",
1711 # }}}
1712 testcmd("$CMD -T -3600 multitrack-pause.gpx", # {{{
1713 <<END,
1714 <?xml version="1.0" encoding="UTF-8"?>
1715 <gpsml>
1716 <track>
1717 <title>track1</title>
1718 <tp> <time>2005-12-31T23:00:00Z</time> <lat>1.11</lat> <lon>1.12</lon> </tp>
1719 <tp> <time>2005-12-31T23:00:01Z</time> <lat>1.21</lat> <lon>1.22</lon> </tp>
1720 <tp> <time>2005-12-31T23:00:02Z</time> <lat>1.31</lat> <lon>1.32</lon> </tp>
1721 <break/>
1722 <title>track2</title>
1723 <tp> <time>2006-01-01T23:00:00Z</time> <lat>2.11</lat> <lon>2.12</lon> </tp>
1724 <tp> <time>2006-01-01T23:00:04Z</time> <lat>2.21</lat> <lon>2.22</lon> </tp>
1725 <tp> <time>2006-01-01T23:00:16Z</time> <lat>2.31</lat> <lon>2.32</lon> </tp>
1726 <tp> <time>2006-01-02T00:00:16Z</time> <lat>2.41</lat> <lon>2.42</lon> </tp>
1727 <break/>
1728 <tp> <time>2006-01-02T00:00:17Z</time> <lat>2.451</lat> <lon>2.452</lon> </tp>
1729 <break/>
1730 <title>track3</title>
1731 <tp> <time>2006-01-03T01:00:20Z</time> <lat>3.11</lat> <lon>3.12</lon> </tp>
1732 <tp> <time>2006-01-03T01:00:21Z</time> <lat>3.21</lat> <lon>3.22</lon> </tp>
1733 <tp> <time>2006-01-03T01:00:22Z</time> <lat>3.31</lat> <lon>3.32</lon> </tp>
1734 <break/>
1735 <tp> <time>2006-01-03T01:00:23Z</time> <lat>3.41</lat> <lon>3.42</lon> </tp>
1736 <tp> <time>2006-01-03T01:00:24Z</time> <lat>3.51</lat> <lon>3.52</lon> </tp>
1737 <tp> <time>2006-01-03T01:00:25Z</time> <lat>3.61</lat> <lon>3.62</lon> </tp>
1738 <tp> <time>2006-01-03T01:00:26Z</time> <lat>3.71</lat> <lon>3.72</lon> </tp>
1739 <tp> <time>2006-01-03T01:00:27Z</time> <lat>3.81</lat> <lon>3.82</lon> </tp>
1740 </track>
1741 </gpsml>
1744 "Subtract one hour from GPX input, output gpsml",
1747 # }}}
1748 testcmd("$CMD -T 1 -o gpx multitrack-pause.gpx", # {{{
1749 <<END,
1750 $gpx_header
1751 <trk>
1752 <trkseg>
1753 <trkpt lat="1.11" lon="1.12"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1754 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:02Z</time> </trkpt>
1755 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:03Z</time> </trkpt>
1756 </trkseg>
1757 <trkseg>
1758 <trkpt lat="2.11" lon="2.12"> <time>2006-01-02T00:00:01Z</time> </trkpt>
1759 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:05Z</time> </trkpt>
1760 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:17Z</time> </trkpt>
1761 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:17Z</time> </trkpt>
1762 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:18Z</time> </trkpt>
1763 </trkseg>
1764 <trkseg>
1765 </trkseg>
1766 <trkseg>
1767 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1768 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1769 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1770 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1771 </trkseg>
1772 <trkseg>
1773 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1774 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1775 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:27Z</time> </trkpt>
1776 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:28Z</time> </trkpt>
1777 </trkseg>
1778 </trk>
1779 </gpx>
1782 "Add one second to GPX input, output GPX",
1785 # }}}
1786 testcmd("$CMD --time-shift -1 -o gpx multitrack-pause.gpsml", # {{{
1787 <<END,
1788 $gpx_header
1789 <trk>
1790 <trkseg>
1791 <trkpt lat="1.11" lon="1.12"> <time>2005-12-31T23:59:59Z</time> </trkpt>
1792 <trkpt lat="1.21" lon="1.22"> <time>2006-01-01T00:00:00Z</time> </trkpt>
1793 <trkpt lat="1.31" lon="1.32"> <time>2006-01-01T00:00:01Z</time> </trkpt>
1794 </trkseg>
1795 <trkseg>
1796 <trkpt lat="2.11" lon="2.12"> <time>2006-01-01T23:59:59Z</time> </trkpt>
1797 <trkpt lat="2.21" lon="2.22"> <time>2006-01-02T00:00:03Z</time> </trkpt>
1798 <trkpt lat="2.31" lon="2.32"> <time>2006-01-02T00:00:15Z</time> </trkpt>
1799 <trkpt lat="2.41" lon="2.42"> <time>2006-01-02T01:00:15Z</time> </trkpt>
1800 <trkpt lat="2.451" lon="2.452"> <time>2006-01-02T01:00:16Z</time> </trkpt>
1801 </trkseg>
1802 <trkseg>
1803 </trkseg>
1804 <trkseg>
1805 <trkpt lat="3.11" lon="3.12"> <time>2006-01-03T02:00:19Z</time> </trkpt>
1806 <trkpt lat="3.21" lon="3.22"> <time>2006-01-03T02:00:20Z</time> </trkpt>
1807 <trkpt lat="3.31" lon="3.32"> <time>2006-01-03T02:00:21Z</time> </trkpt>
1808 <trkpt lat="3.41" lon="3.42"> <time>2006-01-03T02:00:22Z</time> </trkpt>
1809 </trkseg>
1810 <trkseg>
1811 <trkpt lat="3.51" lon="3.52"> <time>2006-01-03T02:00:23Z</time> </trkpt>
1812 <trkpt lat="3.61" lon="3.62"> <time>2006-01-03T02:00:24Z</time> </trkpt>
1813 <trkpt lat="3.71" lon="3.72"> <time>2006-01-03T02:00:25Z</time> </trkpt>
1814 <trkpt lat="3.81" lon="3.82"> <time>2006-01-03T02:00:26Z</time> </trkpt>
1815 </trkseg>
1816 </trk>
1817 </gpx>
1820 "Subtract one second from gpsml input, output GPX, use long option",
1823 # }}}
1824 testcmd("$CMD -T 0 -o pgtab multitrack-pause.gpx", # {{{
1825 <<END,
1826 2006-01-01T00:00:00Z\t(1.11,1.12)\t\\N\t\\N\t\\N\t\\N
1827 2006-01-01T00:00:01Z\t(1.21,1.22)\t\\N\t\\N\t\\N\t\\N
1828 2006-01-01T00:00:02Z\t(1.31,1.32)\t\\N\t\\N\t\\N\t\\N
1829 2006-01-02T00:00:00Z\t(2.11,2.12)\t\\N\t\\N\t\\N\t\\N
1830 2006-01-02T00:00:04Z\t(2.21,2.22)\t\\N\t\\N\t\\N\t\\N
1831 2006-01-02T00:00:16Z\t(2.31,2.32)\t\\N\t\\N\t\\N\t\\N
1832 2006-01-02T01:00:16Z\t(2.41,2.42)\t\\N\t\\N\t\\N\t\\N
1833 2006-01-02T01:00:17Z\t(2.451,2.452)\t\\N\t\\N\t\\N\t\\N
1834 2006-01-03T02:00:20Z\t(3.11,3.12)\t\\N\t\\N\t\\N\t\\N
1835 2006-01-03T02:00:21Z\t(3.21,3.22)\t\\N\t\\N\t\\N\t\\N
1836 2006-01-03T02:00:22Z\t(3.31,3.32)\t\\N\t\\N\t\\N\t\\N
1837 2006-01-03T02:00:23Z\t(3.41,3.42)\t\\N\t\\N\t\\N\t\\N
1838 2006-01-03T02:00:24Z\t(3.51,3.52)\t\\N\t\\N\t\\N\t\\N
1839 2006-01-03T02:00:25Z\t(3.61,3.62)\t\\N\t\\N\t\\N\t\\N
1840 2006-01-03T02:00:26Z\t(3.71,3.72)\t\\N\t\\N\t\\N\t\\N
1841 2006-01-03T02:00:27Z\t(3.81,3.82)\t\\N\t\\N\t\\N\t\\N
1844 "Read GPX, time-shift 0 seconds, output pgtab",
1847 # }}}
1848 diag("Testing -v (--verbose) option...");
1849 likecmd("$CMD -hv", # {{{
1850 '/\$Id: .*? \$.* Show this help\./s',
1851 '/^$/',
1852 "Option --version with -h returns Id string and help screen",
1855 # }}}
1856 diag("Testing --version option...");
1857 likecmd("$CMD --version", # {{{
1858 '/\$Id: .*? \$/',
1859 '/^$/',
1860 "Option --version returns Id string",
1863 # }}}
1864 # --version option }}}
1865 diag("Testing --strip-whitespace option..."); # {{{
1866 testcmd("../gpst -w -o gpx pause-noname.gpx", # {{{
1867 <<END,
1868 $stripped_gpx_header
1869 <trk>
1870 <trkseg>
1871 <trkpt lat="60.425494" lon="5.299534"><ele>25.260</ele><time>2006-05-21T16:49:11Z</time></trkpt>
1872 <trkpt lat="60.425464" lon="5.299610"><ele>24.931</ele><time>2006-05-21T16:49:46Z</time></trkpt>
1873 <trkpt lat="60.425314" lon="5.299694"><ele>27.975</ele><time>2006-05-21T16:52:04Z</time></trkpt>
1874 <trkpt lat="60.425384" lon="5.299741"><ele>31.017</ele><time>2006-05-21T16:56:36Z</time></trkpt>
1875 <trkpt lat="60.425339" lon="5.299958"><ele>30.980</ele><time>2006-05-21T16:56:47Z</time></trkpt>
1876 <trkpt lat="60.425238" lon="5.299640"><ele>30.538</ele><time>2006-05-21T16:56:56Z</time></trkpt>
1877 <trkpt lat="60.425246" lon="5.299686"><ele>30.515</ele><time>2006-05-21T16:57:03Z</time></trkpt>
1878 <trkpt lat="60.425345" lon="5.299773"><ele>31.936</ele><time>2006-05-21T16:59:08Z</time></trkpt>
1879 <trkpt lat="60.425457" lon="5.299419"><ele>31.794</ele><time>2006-05-21T17:00:54Z</time></trkpt>
1880 </trkseg>
1881 </trk>
1882 </gpx>
1885 "Strip whitespace from GPX output",
1888 # }}}
1889 testcmd("../gpst -o gpx -w comments.mayko", # {{{
1890 <<END,
1891 $stripped_gpx_header
1892 <trk>
1893 <trkseg>
1894 <trkpt lat="70.6800486" lon="23.6746151"><time>2002-12-22T21:42:24Z</time></trkpt>
1895 <trkpt lat="70.6799322" lon="23.6740038"><time>2002-12-22T21:42:32Z</time></trkpt>
1896 <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:42:54Z</time></trkpt>
1897 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:51Z</time><extensions><error>desc</error></extensions></trkpt> -->
1898 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:52Z</time><extensions><error>desc</error></extensions></trkpt> -->
1899 <!-- <trkpt lat="70.6796266" lon="23.6723991"><time>2002-12-22T21:43:54Z</time><extensions><error>desc</error></extensions></trkpt> -->
1900 <trkpt lat="70.6800774" lon="23.6757566"><time>2002-12-22T21:44:45Z</time></trkpt>
1901 </trkseg>
1902 <trkseg>
1903 <trkpt lat="70.6801502" lon="23.6753442"><time>2002-12-22T21:44:52Z</time></trkpt>
1904 <trkpt lat="70.6801905" lon="23.6757542"><time>2002-12-22T21:45:04Z</time></trkpt>
1905 </trkseg>
1906 </trk>
1907 </gpx>
1910 "Output whitespace-stripped GPX from Mayko file with commented-out lines",
1913 # }}}
1914 testcmd("../gpst -w -o pgwupd multitrack.gpx", # {{{
1915 <<END,
1916 BEGIN;
1917 UPDATE logg SET name = clname(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1918 UPDATE logg SET dist = cldist(coor) WHERE (point(51.477880000,-0.001470000) <-> coor) < 0.05;
1919 COMMIT;
1920 BEGIN;
1921 UPDATE logg SET name = clname(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1922 UPDATE logg SET dist = cldist(coor) WHERE (point(51.532030,-0.177330) <-> coor) < 0.05;
1923 COMMIT;
1924 BEGIN;
1925 UPDATE logg SET name = clname(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1926 UPDATE logg SET dist = cldist(coor) WHERE (point(61.636684,8.312254) <-> coor) < 0.05;
1927 COMMIT;
1928 BEGIN;
1929 UPDATE logg SET name = clname(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1930 UPDATE logg SET dist = cldist(coor) WHERE (point(60.397460000,5.350610000) <-> coor) < 0.05;
1931 COMMIT;
1932 BEGIN;
1933 UPDATE logg SET name = clname(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1934 UPDATE logg SET dist = cldist(coor) WHERE (point(51.510130000,-0.130410000) <-> coor) < 0.05;
1935 COMMIT;
1936 BEGIN;
1937 UPDATE logg SET name = clname(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1938 UPDATE logg SET dist = cldist(coor) WHERE (point(60.968540000,9.285350000) <-> coor) < 0.05;
1939 COMMIT;
1942 "Strip whitespace from pgwupd output",
1945 # }}}
1946 # --strip-whitespace option }}}
1947 diag("Testing --double-y-scale option..."); # {{{
1948 testcmd("../gpst -y -o clean pause.gpx", # {{{
1949 <<END,
1950 5.299534\t120.850988\t25.260
1951 5.299610\t120.850928\t24.931
1952 5.299694\t120.850628\t27.975
1953 5.299741\t120.850768\t31.017
1954 5.299958\t120.850678\t30.980
1955 5.299640\t120.850476\t30.538
1956 5.299686\t120.850492\t30.515
1957 5.299773\t120.85069\t31.936
1958 5.299419\t120.850914\t31.794
1961 "Double y scale, clean output from gpx format",
1964 # }}}
1965 testcmd("../gpst -y -o clean log.dos.mayko", # {{{
1966 <<END,
1967 8.1225077\t116.3636316\t
1968 8.1253200\t116.3637424\t
1969 8.1266031\t116.3632694\t
1970 8.1284612\t116.3624198\t
1971 8.1293950\t116.362063\t
1972 8.1307400\t116.3619242\t
1975 "Double y scale, clean output from mayko format",
1978 # }}}
1979 # --double-y-scale option }}}
1980 diag("Testing --debug option..."); # {{{
1981 # --debug option }}}
1982 diag("Strip error from Mayko format..."); # {{{
1984 testcmd("../gpst -o csv date_error.mayko", # {{{
1985 <<END,
1986 2003-06-13T09:12:36Z\t5.5794667\t60.4280897\t\t
1987 2003-06-13T09:12:38Z\t5.5802255\t60.4281867\t\t
1988 2003-06-13T09:12:41Z\t5.5813636\t60.4283320\t\t
1989 2003-06-13T09:12:42Z\t5.5817430\t60.4283806\t\t
1992 "Strip error from mayko format in csv output",
1995 # }}}
1996 testcmd("../gpst -o clean date_error.mayko", # {{{
1997 <<END,
1998 5.5794667\t60.4280897\t
1999 5.5802255\t60.4281867\t
2000 5.5813636\t60.4283320\t
2001 5.5817430\t60.4283806\t
2004 "Strip error from mayko format in clean output",
2007 # }}}
2008 testcmd("../gpst -o gpsml date_error.mayko", # {{{
2009 <<END,
2010 <?xml version="1.0" encoding="UTF-8"?>
2011 <gpsml>
2012 <track>
2013 <tp> <time>2003-06-13T09:12:36Z</time> <lat>60.4280897</lat> <lon>5.5794667</lon> </tp>
2014 <tp> <time>2003-06-13T09:12:38Z</time> <lat>60.4281867</lat> <lon>5.5802255</lon> </tp>
2015 <etp err="error"> <time>2037-06-25T17:19:22Z</time> <lat>103.4034054</lat> <lon>129.7271053</lon> </etp>
2016 <tp> <time>2003-06-13T09:12:41Z</time> <lat>60.428332</lat> <lon>5.5813636</lon> </tp>
2017 <tp> <time>2003-06-13T09:12:42Z</time> <lat>60.4283806</lat> <lon>5.581743</lon> </tp>
2018 </track>
2019 </gpsml>
2022 "Strip error from mayko format in gpsml output",
2025 # }}}
2026 testcmd("../gpst -o gpx date_error.mayko", # {{{
2027 <<END,
2028 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2029 <gpx
2030 version="1.1"
2031 creator="gpst - http://svn.sunbase.org/repos/utils/trunk/src/gpstools/"
2032 xmlns="http://www.topografix.com/GPX/1/1"
2033 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2034 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
2036 <trk>
2037 <trkseg>
2038 <trkpt lat="60.4280897" lon="5.5794667"> <time>2003-06-13T09:12:36Z</time> </trkpt>
2039 <trkpt lat="60.4281867" lon="5.5802255"> <time>2003-06-13T09:12:38Z</time> </trkpt>
2040 <!-- <trkpt lat="103.4034054" lon="129.7271053"> <time>2037-06-25T17:19:22Z</time> <extensions> <error>error</error> </extensions> </trkpt> -->
2041 <trkpt lat="60.4283320" lon="5.5813636"> <time>2003-06-13T09:12:41Z</time> </trkpt>
2042 <trkpt lat="60.4283806" lon="5.5817430"> <time>2003-06-13T09:12:42Z</time> </trkpt>
2043 </trkseg>
2044 </trk>
2045 </gpx>
2048 "Strip error from mayko format in gpx output",
2051 # }}}
2052 testcmd("../gpst -o gpstrans date_error.mayko", # {{{
2053 <<END,
2054 Format: DMS UTC Offset: 0.00 hrs Datum[100]: WGS 84
2055 T\t06/13/2003 09:12:36\t60\xB025'41.1"\t5\xB034'46.1"
2056 T\t06/13/2003 09:12:38\t60\xB025'41.5"\t5\xB034'48.8"
2057 T\t06/13/2003 09:12:41\t60\xB025'42.0"\t5\xB034'52.9"
2058 T\t06/13/2003 09:12:42\t60\xB025'42.2"\t5\xB034'54.3"
2061 "Strip error from mayko format in gpstrans output",
2064 # }}}
2065 testcmd("../gpst -o pgtab date_error.mayko", # {{{
2066 <<END,
2067 2003-06-13T09:12:36Z\t(60.4280897,5.5794667)\t\\N\t\\N\t\\N\t\\N
2068 2003-06-13T09:12:38Z\t(60.4281867,5.5802255)\t\\N\t\\N\t\\N\t\\N
2069 2003-06-13T09:12:41Z\t(60.4283320,5.5813636)\t\\N\t\\N\t\\N\t\\N
2070 2003-06-13T09:12:42Z\t(60.4283806,5.5817430)\t\\N\t\\N\t\\N\t\\N
2073 "Strip error from mayko format in pgtab output",
2076 # }}}
2077 testcmd("../gpst -o poscount date_error.mayko", # {{{
2078 <<END,
2079 5.5802255\t60.4281867\t1
2080 5.5817430\t60.4283806\t1
2081 5.5813636\t60.4283320\t1
2082 5.5794667\t60.4280897\t1
2085 "Strip error from mayko format in poscount output",
2088 # }}}
2089 testcmd("../gpst -o xgraph date_error.mayko", # {{{
2090 <<END,
2091 5.5794667 60.4280897
2092 5.5802255 60.4281867
2093 5.5813636 60.4283320
2094 5.5817430 60.4283806
2097 "Strip error from mayko format in xgraph output",
2100 # }}}
2101 testcmd("../gpst -o ygraph date_error.mayko", # {{{
2102 <<END,
2103 "Time = 0.0
2104 5.5794667 60.4280897
2106 "Time = 2.0
2107 5.5802255 60.4281867
2109 "Time = 5.0
2110 5.5813636 60.4283320
2112 "Time = 6.0
2113 5.5817430 60.4283806
2117 "Strip error from mayko format in ygraph output",
2120 # }}}
2122 # Strip error from Mayko format }}}
2124 todo_section:
2127 if ($Opt{'all'} || $Opt{'todo'}) {
2128 diag("Running TODO tests..."); # {{{
2130 TODO: {
2131 local $TODO = "Fix read/write of GPX name element";
2132 testcmd("../gpst -o gpx pause.gpx", # {{{
2133 <<END,
2134 $gpx_header
2135 <trk>
2136 <name>ACTIVE LOG164705</name>
2137 <trkseg>
2138 <trkpt lat="60.425494" lon="5.299534"> <ele>25.260</ele> <time>2006-05-21T16:49:11Z</time> </trkpt>
2139 <trkpt lat="60.425464" lon="5.299610"> <ele>24.931</ele> <time>2006-05-21T16:49:46Z</time> </trkpt>
2140 <trkpt lat="60.425314" lon="5.299694"> <ele>27.975</ele> <time>2006-05-21T16:52:04Z</time> </trkpt>
2141 <trkpt lat="60.425384" lon="5.299741"> <ele>31.017</ele> <time>2006-05-21T16:56:36Z</time> </trkpt>
2142 <trkpt lat="60.425339" lon="5.299958"> <ele>30.980</ele> <time>2006-05-21T16:56:47Z</time> </trkpt>
2143 <trkpt lat="60.425238" lon="5.299640"> <ele>30.538</ele> <time>2006-05-21T16:56:56Z</time> </trkpt>
2144 <trkpt lat="60.425246" lon="5.299686"> <ele>30.515</ele> <time>2006-05-21T16:57:03Z</time> </trkpt>
2145 <trkpt lat="60.425345" lon="5.299773"> <ele>31.936</ele> <time>2006-05-21T16:59:08Z</time> </trkpt>
2146 <trkpt lat="60.425457" lon="5.299419"> <ele>31.794</ele> <time>2006-05-21T17:00:54Z</time> </trkpt>
2147 </trkseg>
2148 </trk>
2149 </gpx>
2152 "Read and write name element from/to GPX",
2155 # }}}
2156 local $TODO = "Remove extra \\n in the beginning";
2157 testcmd("../gpst -o csv multitrack.gpx", # {{{
2158 <<END,
2159 2003-02-11T23:35:39Z\t-0.1448824\t51.4968266\t\t
2160 2003-02-11T23:35:49Z\t-0.1449938\t51.4968227\t\t
2161 2003-02-11T23:36:14Z\t-0.1453202\t51.4969040\t\t
2162 \t\t\t\t
2163 2003-02-11T23:36:16Z\t-0.1453398\t51.4969214\t\t
2164 2003-02-11T23:36:31Z\t-0.1455514\t51.4969816\t\t
2165 2003-02-11T23:36:43Z\t-0.1457489\t51.4970224\t1000\t
2166 2003-02-11T23:36:50Z\t-0.1457804\t51.4970452\t\t
2167 \t\t\t\t
2168 2003-02-11T23:37:05Z\t-0.1458608\t51.4970680\t\t
2169 2003-02-11T23:37:22Z\t-0.1460047\t51.4971658\t\t
2170 2003-02-11T23:37:36Z\t-0.1461614\t51.4972469\t\t
2171 \t\t\t\t
2172 2003-02-11T23:37:43Z\t-0.1462394\t51.4972731\t\t
2173 2003-02-11T23:38:04Z\t-0.1463232\t51.4973437\t\t
2174 2003-02-11T23:38:28Z\t-0.1462949\t51.4973337\t\t
2175 2003-02-11T23:38:34Z\t-0.1462825\t51.4973218\t\t
2176 2003-02-11T23:38:35Z\t-0.1462732\t51.4973145\t\t
2179 "Output csv format from multitrack.gpx",
2182 # }}}
2183 testcmd("../gpst -o csv pause.gpx", # {{{
2184 <<END,
2185 2006-05-21T16:49:11Z\t5.299534\t60.425494\t25.260\t
2186 2006-05-21T16:49:46Z\t5.299610\t60.425464\t24.931\t
2187 2006-05-21T16:52:04Z\t5.299694\t60.425314\t27.975\t
2188 2006-05-21T16:56:36Z\t5.299741\t60.425384\t31.017\t
2189 2006-05-21T16:56:47Z\t5.299958\t60.425339\t30.980\t
2190 2006-05-21T16:56:56Z\t5.299640\t60.425238\t30.538\t
2191 2006-05-21T16:57:03Z\t5.299686\t60.425246\t30.515\t
2192 2006-05-21T16:59:08Z\t5.299773\t60.425345\t31.936\t
2193 2006-05-21T17:00:54Z\t5.299419\t60.425457\t31.794\t
2196 "Output csv format from pause.gpx",
2199 # }}}
2200 testcmd("../gpst -e -o csv pause.gpx", # {{{
2201 <<END,
2202 1148230151\t5.299534\t60.425494\t25.260\t
2203 1148230186\t5.299610\t60.425464\t24.931\t
2204 1148230324\t5.299694\t60.425314\t27.975\t
2205 1148230596\t5.299741\t60.425384\t31.017\t
2206 1148230607\t5.299958\t60.425339\t30.980\t
2207 1148230616\t5.299640\t60.425238\t30.538\t
2208 1148230623\t5.299686\t60.425246\t30.515\t
2209 1148230748\t5.299773\t60.425345\t31.936\t
2210 1148230854\t5.299419\t60.425457\t31.794\t
2213 "csv format with epoch seconds from gpx",
2216 # }}}
2217 $TODO = "Tweak output";
2218 testcmd("../gpst -o gpx multitrack-pause.gpsml", # {{{
2219 file_data("multitrack-pause.gpx"),
2221 "Should be equal to multitrack-pause.gpx",
2224 # }}}
2225 $TODO = 'Fix it.';
2226 # list_nearest_waypoints() {{{
2228 like(list_nearest_waypoints(60.42541, 5.29959, 3),
2229 qr/^\(.*,.*,.*\)$/,
2230 "list_nearest_waypoints()"
2233 # }}}
2235 # TODO tests }}}
2238 diag("Testing finished.");
2240 sub testcmd {
2241 # {{{
2242 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2243 my $stderr_cmd = "";
2244 my $deb_str = $Opt{'debug'} ? " --debug" : "";
2245 my $Txt = join("",
2246 "\"$Cmd\"",
2247 defined($Desc)
2248 ? " - $Desc"
2249 : ""
2251 my $TMP_STDERR = "gpst-stderr.tmp";
2253 if (defined($Exp_stderr) && !length($deb_str)) {
2254 $stderr_cmd = " 2>$TMP_STDERR";
2256 is(`$Cmd$deb_str$stderr_cmd`, $Exp_stdout, $Txt);
2257 if (defined($Exp_stderr)) {
2258 if (!length($deb_str)) {
2259 is(file_data($TMP_STDERR), $Exp_stderr, "$Txt (stderr)");
2260 unlink($TMP_STDERR);
2262 } else {
2263 diag("Warning: stderr not defined for '$Txt'");
2265 # }}}
2268 sub likecmd {
2269 # {{{
2270 my ($Cmd, $Exp_stdout, $Exp_stderr, $Desc) = @_;
2271 my $stderr_cmd = "";
2272 my $deb_str = $Opt{'debug'} ? " --debug" : "";
2273 my $Txt = join("",
2274 "\"$Cmd\"",
2275 defined($Desc)
2276 ? " - $Desc"
2277 : ""
2279 my $TMP_STDERR = "gpst-stderr.tmp";
2281 if (defined($Exp_stderr) && !length($deb_str)) {
2282 $stderr_cmd = " 2>$TMP_STDERR";
2284 like(`$Cmd$deb_str$stderr_cmd`, "$Exp_stdout", $Txt);
2285 if (defined($Exp_stderr)) {
2286 if (!length($deb_str)) {
2287 like(file_data($TMP_STDERR), "$Exp_stderr", "$Txt (stderr)");
2288 unlink($TMP_STDERR);
2290 } else {
2291 diag("Warning: stderr not defined for '$Txt'");
2293 # }}}
2296 sub file_data {
2297 # Return file content as a string {{{
2298 my $File = shift;
2299 my $Txt;
2300 if (open(FP, "<", $File)) {
2301 $Txt = join("", <FP>);
2302 close(FP);
2303 return($Txt);
2304 } else {
2305 return undef;
2307 # }}}
2310 sub print_version {
2311 # Print program version {{{
2312 for (@main::version_array) {
2313 print("$_\n");
2315 # }}}
2316 } # print_version()
2318 sub usage {
2319 # Send the help message to stdout {{{
2320 my $Retval = shift;
2322 if ($Opt{'verbose'}) {
2323 print("\n");
2324 print_version();
2326 print(<<END);
2328 Usage: $progname [options] [file [files [...]]]
2330 Contains tests for the gpst(1) program.
2332 Options:
2334 -a, --all
2335 Run all tests, also TODOs.
2336 -h, --help
2337 Show this help.
2338 -t, --todo
2339 Run only the TODO tests.
2340 -v, --verbose
2341 Increase level of verbosity. Can be repeated.
2342 --version
2343 Print version information.
2344 --debug
2345 Print debugging messages.
2348 exit($Retval);
2349 # }}}
2350 } # usage()
2352 sub msg {
2353 # Print a status message to stderr based on verbosity level {{{
2354 my ($verbose_level, $Txt) = @_;
2356 if ($Opt{'verbose'} >= $verbose_level) {
2357 print(STDERR "$progname: $Txt\n");
2359 # }}}
2360 } # msg()
2362 __END__
2364 # Plain Old Documentation (POD) {{{
2366 =pod
2368 =head1 NAME
2370 run-tests.pl
2372 =head1 REVISION
2374 $Id$
2376 =head1 SYNOPSIS
2378 run-tests.pl [options] [file [files [...]]]
2380 =head1 DESCRIPTION
2382 Contains tests for the gpst(1) program.
2384 =head1 OPTIONS
2386 =over 4
2388 =item B<-a>, B<--all>
2390 Run all tests, also TODOs.
2392 =item B<-h>, B<--help>
2394 Print a brief help summary.
2396 =item B<-t>, B<--todo>
2398 Run only the TODO tests.
2400 =item B<-v>, B<--verbose>
2402 Increase level of verbosity. Can be repeated.
2404 =item B<--version>
2406 Print version information.
2408 =item B<--debug>
2410 Print debugging messages.
2412 =back
2414 =head1 AUTHOR
2416 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
2418 =head1 COPYRIGHT
2420 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
2421 This is free software; see the file F<COPYING> for legalese stuff.
2423 =head1 LICENCE
2425 This program is free software; you can redistribute it and/or modify it
2426 under the terms of the GNU General Public License as published by the
2427 Free Software Foundation; either version 2 of the License, or (at your
2428 option) any later version.
2430 This program is distributed in the hope that it will be useful, but
2431 WITHOUT ANY WARRANTY; without even the implied warranty of
2432 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2433 See the GNU General Public License for more details.
2435 You should have received a copy of the GNU General Public License along
2436 with this program; if not, write to the Free Software Foundation, Inc.,
2437 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2439 =head1 SEE ALSO
2441 gpst(1)
2443 =cut
2445 # }}}
2447 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
2448 # End of file $Id$