diff options
Diffstat (limited to 't/35-result-wings.t')
-rw-r--r-- | t/35-result-wings.t | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/t/35-result-wings.t b/t/35-result-wings.t new file mode 100644 index 0000000..2e36603 --- /dev/null +++ b/t/35-result-wings.t @@ -0,0 +1,53 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.014; +use utf8; + +use Data::Dumper; +use DateTime; +use Test::More tests => 17; +use Test::Fatal; + +use Travel::Status::DE::IRIS; + +my $status = Travel::Status::DE::IRIS->new( + iris_base => 'file:t/in', + station => 'EBO', + datetime => DateTime->new( + year => 2015, + month => 5, + day => 20, + hour => 17, + minute => 1, + time_zone => 'Europe/Berlin' + ) +); + +my @results = $status->results; + +my $abr89476 = $results[22]; +my $abr89536 = $results[21]; +my $abr89473 = $results[33]; +my $abr89533 = $results[34]; + +is($abr89476->train_no, 89476, 'train_no'); +is($abr89536->train_no, 89536, 'train_no'); + +is($abr89536->is_wing, 1, 'is_wing'); +is($abr89476->is_wing, 0, 'is_wing'); +is(scalar $abr89536->arrival_wings, undef, 'wing has no wings'); +is(scalar $abr89536->departure_wings, undef, 'wing has no wings'); +is(scalar $abr89476->arrival_wings, 1, 'num arrival_wings'); +is(scalar $abr89476->departure_wings, 1, 'num departure_wings'); +is(($abr89476->departure_wings)[0]->train_no, 89536, 'departure_wings[0]'); + +is($abr89533->train_no, 89533, 'train_no'); +is($abr89473->train_no, 89473, 'train_no'); + +is($abr89473->is_wing, 1, 'is_wing'); +is(scalar $abr89473->arrival_wings, undef, 'wing has no wings'); +is(scalar $abr89473->departure_wings, undef, 'wing has no wings'); +is(scalar $abr89533->arrival_wings, 1, 'num arrival_wings'); +is(scalar $abr89533->departure_wings, 1, 'num departure_wings'); +is(($abr89533->departure_wings)[0]->train_no, 89473, 'departure_wings[0]'); |