summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-17 11:42:48 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-17 11:42:48 +0100
commit0a1dc4ca722dc6713081c9de9b0c76c67438973d (patch)
tree7e7ed07422eec5bfec5c6120c586cd73f15a3715
parent0c49e2bd3a1d51afd1be678e579451c929a42529 (diff)
add ::Stations test
-rw-r--r--t/21-iris-stations.t60
1 files changed, 60 insertions, 0 deletions
diff --git a/t/21-iris-stations.t b/t/21-iris-stations.t
new file mode 100644
index 0000000..178fa23
--- /dev/null
+++ b/t/21-iris-stations.t
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.014;
+
+use DateTime;
+use Test::More tests => 10;
+
+BEGIN {
+ use_ok('Travel::Status::DE::IRIS::Stations');
+}
+require_ok('Travel::Status::DE::IRIS::Stations');
+
+is_deeply(
+ [],
+ [ Travel::Status::DE::IRIS::Stations::get_station('doesnotexist') ],
+ 'get_station: returns empty list for no match'
+);
+
+is_deeply(
+ [ [ 'EE', 'Essen Hbf' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('EE') ],
+ 'get_station: exact match by DS100 works'
+);
+
+is_deeply(
+ [ [ 'EE', 'Essen Hbf' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('Essen Hbf') ],
+ 'get_station: exact match by name works'
+);
+
+is_deeply(
+ [ [ 'EE', 'Essen Hbf' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('essen hbf') ],
+ 'get_station: exact match by name is case insensitive'
+);
+
+is_deeply(
+ [ [ 'EEST', 'Essen-Steele' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('Essen-Steele') ],
+ 'get_station: exact match by name works by shortest prefix'
+);
+
+is_deeply(
+ [ [ 'EEST', 'Essen-Steele' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('essen-steele') ],
+ 'get_station: exact match by name (shortest prefix) is case insensitive'
+);
+
+is_deeply(
+ [ [ 'EG', 'Gelsenk Hbf' ], [ 'EGZO', 'Gelsenk Zoo' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('Gelsenk') ],
+ 'get_station: partial match by name works'
+);
+
+is_deeply(
+ [ [ 'EG', 'Gelsenk Hbf' ], [ 'EGZO', 'Gelsenk Zoo' ] ],
+ [ Travel::Status::DE::IRIS::Stations::get_station('gelsenk') ],
+ 'get_station: partial match by name is case insensitive'
+);