summaryrefslogtreecommitdiff
path: root/t/33-result-route.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-02-09 20:17:00 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-02-09 20:17:00 +0100
commit7272bae61c46a0877d26a57543041e6b3fc11713 (patch)
treeb8d2284b2f8842918a972a3d6422b9c68923ebaa /t/33-result-route.t
parent92bb44d33958777a502001d54e32d20a17db71ee (diff)
fix test name (33-, not 33_)
Diffstat (limited to 't/33-result-route.t')
-rw-r--r--t/33-result-route.t103
1 files changed, 103 insertions, 0 deletions
diff --git a/t/33-result-route.t b/t/33-result-route.t
new file mode 100644
index 0000000..3cc4ea2
--- /dev/null
+++ b/t/33-result-route.t
@@ -0,0 +1,103 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.014;
+use utf8;
+
+use DateTime;
+use Test::More tests => 10;
+use Test::Fatal;
+
+use Travel::Status::DE::IRIS;
+
+my $status = Travel::Status::DE::IRIS->new(
+ iris_base => 'file:t/in',
+ station => 'EE',
+ datetime => DateTime->new(
+ year => 2014,
+ month => 1,
+ day => 3,
+ hour => 20,
+ minute => 1,
+ time_zone => 'Europe/Berlin'
+ )
+);
+
+my @results = $status->results;
+
+my $ice645 = $results[0];
+my $s1 = $results[1];
+my $s9 = $results[8];
+my $hkx = $results[10];
+my $abr = $results[13];
+
+is_deeply(
+ [ $ice645->route ],
+ [ $ice645->sched_route ],
+ 'route == sched_route'
+);
+is_deeply(
+ [ $ice645->route_pre ],
+ [ $ice645->sched_route_pre ],
+ 'route_pre == sched_route_pre'
+);
+is_deeply(
+ [ $ice645->route_post ],
+ [ $ice645->sched_route_post ],
+ 'route_post == sched_route_post'
+);
+
+is_deeply(
+ [ $ice645->route ],
+ [
+ 'Köln/Bonn Flughafen',
+ 'Köln Messe/Deutz Gl.11-12',
+ 'Düsseldorf Hbf',
+ 'Düsseldorf Flughafen',
+ 'Duisburg Hbf',
+ 'Essen Hbf',
+ 'Bochum Hbf',
+ 'Dortmund Hbf',
+ 'Hamm(Westf)',
+ 'Bielefeld Hbf',
+ 'Hannover Hbf',
+ 'Berlin-Spandau',
+ 'Berlin Hbf',
+ 'Berlin Ostbahnhof'
+ ],
+ 'route'
+);
+is_deeply(
+ [ $ice645->route_pre ],
+ [
+ 'Köln/Bonn Flughafen',
+ 'Köln Messe/Deutz Gl.11-12',
+ 'Düsseldorf Hbf',
+ 'Düsseldorf Flughafen',
+ 'Duisburg Hbf'
+ ],
+ 'route_pre'
+);
+is_deeply(
+ [ $ice645->route_post ],
+ [
+ 'Bochum Hbf',
+ 'Dortmund Hbf',
+ 'Hamm(Westf)',
+ 'Bielefeld Hbf',
+ 'Hannover Hbf',
+ 'Berlin-Spandau',
+ 'Berlin Hbf',
+ 'Berlin Ostbahnhof'
+ ],
+ 'route_post'
+);
+
+is_deeply([$ice645->route_interesting],
+ ['Bochum', 'Dortmund', 'Bielefeld'], 'route_interesting with just major');
+is_deeply([$s1->route_interesting],
+ [], 'route_interesting with realtime');
+is_deeply([$s9->route_interesting],
+ [], 'route_interesting, train ends here');
+is_deeply([$abr->route_interesting],
+ ['Essen-Kray Süd', 'Bochum', 'Witten'], 'route_interesting with minor');