summaryrefslogtreecommitdiff
path: root/t/35-result-wings.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-21 11:20:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-21 11:20:17 +0200
commit2d5a4e996cb6bcf94e2ebaeab1c5804657a04428 (patch)
tree032870482dcc1787a5cf7af02bede5902d210032 /t/35-result-wings.t
parent15ed51aeae1eda806442fb0fc43e9a89c7aeaaf3 (diff)
add tests for wings
Diffstat (limited to 't/35-result-wings.t')
-rw-r--r--t/35-result-wings.t53
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]');