summaryrefslogtreecommitdiff
path: root/t/35-result-wings.t
blob: 0d3c4c7b99ba370d4097693331aa51439c70ac14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;
use utf8;

use Data::Dumper;
use DateTime;
use Test::More tests => 18;
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');

ok($abr89536->is_wing, 'is_wing');
ok(! $abr89476->is_wing, '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');

ok($abr89473->is_wing, 'is_wing');
ok(! $abr89533->is_wing, '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]');