summaryrefslogtreecommitdiff
path: root/t/32-result-messages.t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-19 22:41:30 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-19 22:41:30 +0100
commitd47a165b3463fd3d52e5a05a821b7a8fd16f45ec (patch)
treed9afa174707cdd338040811f6a2d06070f297eac /t/32-result-messages.t
parentf8b052ab7c8dffc9aa873a6c35744c33ded4996a (diff)
add some ::Result tests (todo: detailed message and route tests)
Diffstat (limited to 't/32-result-messages.t')
-rw-r--r--t/32-result-messages.t56
1 files changed, 56 insertions, 0 deletions
diff --git a/t/32-result-messages.t b/t/32-result-messages.t
new file mode 100644
index 0000000..4e30355
--- /dev/null
+++ b/t/32-result-messages.t
@@ -0,0 +1,56 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.014;
+use utf8;
+
+use DateTime;
+use Test::More tests => 4;
+use Test::Fatal;
+
+use Travel::Status::DE::IRIS;
+
+my $status = Travel::Status::DE::IRIS->new(
+ iris_base => 'file:t/in',
+ station => 'EE',
+ datetime => DateTime->new(
+ year => 2014,
+ month => 1,
+ day => 3,
+ hour => 20,
+ minute => 1,
+ time_zone => 'Europe/Berlin'
+ )
+);
+
+my @results = $status->results;
+
+my $ice645 = $results[0];
+my $s1 = $results[1];
+my $s9 = $results[8];
+my $hkx = $results[10];
+my $abr = $results[13];
+
+is_deeply([$ice645->info],
+['Witterungsbedingte Störung', 'Unwetter', 'Abweichende Wagenreihung'],
+'info: no dups, sorted, msg+qos');
+
+is_deeply([$ice645->messages], [
+['2014-01-03T19:03:00', 'Witterungsbedingte Störung'],
+['2014-01-03T19:15:00', 'Witterungsbedingte Störung'],
+['2014-01-03T19:48:00', 'Witterungsbedingte Störung'],
+['2014-01-03T19:58:00', 'Witterungsbedingte Störung'],
+['2014-01-03T19:59:00', 'Witterungsbedingte Störung'],
+['2014-01-03T20:00:00', 'Witterungsbedingte Störung'],
+['2014-01-03T20:01:00', 'Unwetter'],
+['2014-01-03T20:02:00', 'Abweichende Wagenreihung']], 'messages: with dups');
+
+is_deeply([$ice645->qos_messages], [
+['2014-01-03T20:02:00', 'Abweichende Wagenreihung']], 'qos_messages');
+
+TODO: {
+ local $TODO = 'no duplicate finding yet';
+ is_deeply([$ice645->delay_messages], [
+['2014-01-03T19:03:00', 'Witterungsbedingte Störung'],
+['2014-01-03T20:01:00', 'Unwetter']], 'delay_messages: no dups');
+}