blob: 48cd3a7cf2f64f8f2d12c6f5c98d62ad215bb5fc (
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
|
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use utf8;
use Encode qw(decode);
use List::Util qw(first);
use Test::More tests => 5;
BEGIN {
use_ok('Travel::Status::DE::URA');
}
require_ok('Travel::Status::DE::URA');
my $s = Travel::Status::DE::URA->new(
ura_base => 'file:t/in',
ura_version => 1,
hide_past => 0
);
# fuzzy matching: bushof should return Aachen Bushof, Eschweiler Bushof,
# Eupon Bushof
my @fuzzy = $s->get_stop_by_name('bushof');
is_deeply(\@fuzzy, ['Aachen Bushof', 'Eschweiler Bushof', 'Eupen Bushof'],
'fuzzy match for "bushof" works');
# fuzzy matching: whitespaces work
@fuzzy = $s->get_stop_by_name('Aachen Bushof');
is_deeply(\@fuzzy, ['Aachen Bushof'],
'fuzzy match with exact name "Aachen Bushof" works');
# fuzzy matching: exact name only matches one, even though longer alternatives
# exist
@fuzzy = $s->get_stop_by_name('brand');
is_deeply(\@fuzzy, ['Brand'],
'fuzzy match with exact name "brand" works');
|