3 # for context, see http://bugs.koha.org
8 use Test::More tests => 82;
13 ok(defined C4::Labels::split_ddcn, 'C4::Labels::split_ddcn defined');
16 'BIO JP2 R5c.1' => [qw(BIO JP2 R5 c.1 )],
17 'FIC GIR J5c.1' => [qw(FIC GIR J5 c.1 )],
18 'J DAR G7c.11' => [qw( J DAR G7 c.11)],
19 'R220.3 H2793Z H32 c.2' => [qw(R 220.3 H2793Z H32 c.2)],
20 'CD-ROM 787.87 EAS' => [qw(CD-ROM 787.87 EAS)],
21 'MP3-CD F PARKER' => [qw(MP3-CD F PARKER)],
22 '252.051 T147 v.1-2' => [qw(252.051 T147 v.1-2)],
25 foreach my $ddcn (sort keys %$ddcns) {
26 my (@parts, @expected);
27 ok($ddcn, "ddcn: $ddcn");
28 ok(@expected = @{$ddcns->{$ddcn}}, "split expected to produce " . scalar(@expected) . " pieces");
29 ok(@parts = C4::Labels::split_ddcn($ddcn), "C4::Labels::split_ddcn($ddcn)");
30 ok(scalar(@expected) == scalar(@parts), sprintf("%d of %d pieces produced", scalar(@parts), scalar(@expected)));
32 foreach my $unit (@expected) {
34 ok($part = $parts[$i], "($ddcn)[$i] populated: " . (defined($part) ? $part : 'UNDEF'));
35 ok((defined($part) and $part eq $unit), "($ddcn)[$i] matches: $unit");