3 # for context, see http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=2691
8 use Test
::More tests
=> 44;
13 ok
(defined C4
::Labels
::split_lccn
, 'C4::Labels::split_lccn defined');
16 'HE8700.7 .P6T44 1983' => [qw(HE 8700.7 .P6 T44 1983)],
17 'BS2545.E8 H39 1996' => [qw(BS 2545 .E8 H39 1996)],
18 'NX512.S85 A4 2006' => [qw(NX 512 .S85 A4 2006)],
21 foreach my $lccn (sort keys %$lccns) {
22 my (@parts, @expected);
23 ok
($lccn, "lccn: $lccn");
24 ok
(@expected = @
{$lccns->{$lccn}}, "split expected to produce " . scalar(@expected) . " pieces");
25 ok
(@parts = C4
::Labels
::split_lccn
($lccn), "C4::Labels::split_lccn($lccn)");
26 ok
(scalar(@expected) == scalar(@parts), sprintf("%d of %d pieces produced", scalar(@parts), scalar(@expected)));
28 foreach my $unit (@expected) {
30 ok
($part = $parts[$i], "($lccn)[$i] populated: " . (defined($part) ?
$part : 'UNDEF'));
31 ok
((defined($part) and $part eq $unit), "($lccn)[$i] matches: $unit");