From 9370341ffbfa7cb1eae628ee4ea69acd38dd0e73 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 23 Jan 2014 12:09:15 +0100 Subject: aseag.t: Make sure results are ordered by departure time --- t/20-aseag.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/20-aseag.t b/t/20-aseag.t index 55923eb..d53f6c0 100644 --- a/t/20-aseag.t +++ b/t/20-aseag.t @@ -6,7 +6,7 @@ use utf8; use Encode qw(decode); use List::Util qw(first); -use Test::More tests => 13; +use Test::More tests => 14; BEGIN { use_ok('Travel::Status::DE::URA'); @@ -38,6 +38,18 @@ my @results = $s->results; is( @results, 16208, 'All departures parsed and returned' ); +# results are sorted by time +my $prev = $results[0]; +my $ok = 1; +for my $i (1 .. $#results) { + my $cur = $results[$i]; + if ($prev->datetime->epoch > $cur->datetime->epoch) { + $ok = 0; + last; + } +} +ok($ok, 'Results are ordered by departure'); + # hide_past => 1 should return nothing @results = $s->results( hide_past => 1 ); -- cgit v1.2.3