diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-01-23 12:09:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-01-23 12:09:15 +0100 |
commit | 9370341ffbfa7cb1eae628ee4ea69acd38dd0e73 (patch) | |
tree | 363274196c330aad7d6176b5260cf871a23651d0 | |
parent | 3c07f032152ee4c6411ae7cf0fb55e74d8ead508 (diff) |
aseag.t: Make sure results are ordered by departure time
-rw-r--r-- | t/20-aseag.t | 14 |
1 files changed, 13 insertions, 1 deletions
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 ); |