#!/usr/bin/perl
use
5.012;
my
%tests
= (
'good-map.xml'
=>
undef
,
'station-names-prefix.xml'
=>
'Incomplete name? :Station:Station A1:'
,
'map-unconnected.xml'
=>
undef
,
);
my
@localdir
= File::Spec->splitdir($0);
pop
(
@localdir
);
for
my
$name
(
sort
keys
%tests
) {
my
$dataname
= File::Spec->catfile(
@localdir
,
$name
);
my
$map
= Sample->new(
xml
=>
$dataname
);
my
(
$ok
,
@messages
) = ok_map(
$map
,
{
name
=>
$name
,
ok_station_names_complete
=> 1,
ok_map_connected
=>
undef
,
},
);
if
(
$tests
{
$name
} ) {
if
(
$ok
) {
diag(
'Test passed although it should not, expected '
.
$tests
{
$name
} );
ok( !
$ok
,
$name
);
}
else
{
is(
$messages
[1],
$tests
{
$name
},
$name
);
}
}
else
{
diag(
$_
)
for
@messages
;
ok(
$ok
,
$name
);
}
}
my
$name
=
'station-names-prefix.xml'
;
my
$dataname
= File::Spec->catfile(
@localdir
,
$name
);
my
$map
= Sample->new(
xml
=>
$dataname
);
my
(
$ok
,
@messages
) = ok_map(
$map
,
{
name
=>
$name
,
ok_station_names_complete
=> {
max_allowed
=> 1 },
ok_map_connected
=>
undef
,
},
);
diag(
$_
)
for
@messages
;
ok(
$ok
,
$name
);