summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Travel/Status/DE/VRR.pm4
-rw-r--r--t/20-vrr.t26
2 files changed, 22 insertions, 8 deletions
diff --git a/lib/Travel/Status/DE/VRR.pm b/lib/Travel/Status/DE/VRR.pm
index 4f8ff77..f976c1e 100644
--- a/lib/Travel/Status/DE/VRR.pm
+++ b/lib/Travel/Status/DE/VRR.pm
@@ -204,6 +204,10 @@ sub results {
);
}
+ @results = map { $_->[0] }
+ sort { $a->[1] <=> $b->[1] }
+ map { [ $_, $_->countdown ] } @results;
+
return @results;
}
diff --git a/t/20-vrr.t b/t/20-vrr.t
index 4f02c32..1789e4d 100644
--- a/t/20-vrr.t
+++ b/t/20-vrr.t
@@ -6,7 +6,7 @@ use utf8;
use Encode qw(decode);
use File::Slurp qw(slurp);
-use Test::More tests => 102;
+use Test::More tests => 111;
BEGIN {
use_ok('Travel::Status::DE::VRR');
@@ -37,12 +37,22 @@ is($results[0]->sched_date, '16.11.2011', 'first result: scheduled date ok');
is($results[0]->sched_time, '09:36', 'first result: scheduled time ok');
is($results[0]->platform, '#1', 'first result: platform ok');
-is($results[-1]->destination, 'Essen Dellwig Bahnhof', 'last result: destination ok');
-is($results[-1]->info, q{}, 'last result: no info');
-is($results[-1]->delay, 0, 'lest result: no delay');
-is($results[-1]->line, '166', 'last result: line ok');
+is($results[3]->destination, decode('UTF-8', 'Mülheim Heißen Kirche'), 'fourth result: destination ok');
+is($results[3]->info, decode('UTF-8', 'Ab (H) Heißen Kirche, Umstieg in den SEV Ri. Mülheim Hbf.'), 'fourth result: no info');
+is($results[3]->line, '18', 'fourth result: line ok');
+is($results[3]->date, '16.11.2011', 'fourth result: real date ok');
+is($results[3]->time, '09:39', 'fourth result: real time ok');
+is($results[3]->delay, 0, 'fourth result: delay 0');
+is($results[3]->sched_date, '16.11.2011', 'fourth result: scheduled date ok');
+is($results[3]->sched_time, '09:39', 'fourth result: scheduled time ok');
+is($results[3]->platform, '2', 'fourth result: platform ok');
+
+is($results[-1]->destination, 'Hamm (Westf)', 'last result: destination ok');
+is($results[-1]->info, decode('UTF-8', 'Fahrradmitnahme begrenzt möglich'), 'last result: info ok');
+is($results[-1]->delay, 12, 'last result: delay 12');
+is($results[-1]->line, 'RE1', 'last result: line ok');
is($results[-1]->date, '16.11.2011', 'last result: date ok');
-is($results[-1]->time, '09:54', 'last result: time ok');
+is($results[-1]->time, '10:05', 'last result: time ok');
is($results[-1]->sched_date, '16.11.2011', 'first result: scheduled date ok');
-is($results[-1]->sched_time, '09:54', 'first result: scheduled time ok');
-is($results[-1]->platform, '9', 'last result: platform ok');
+is($results[-1]->sched_time, '09:53', 'first result: scheduled time ok');
+is($results[-1]->platform, '#6', 'last result: platform ok');