7 use Test
::More tests
=> 16;
10 use_ok
('C4::Circulation');
14 cuecat
=> ["26002315", '.C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.', ".C3nZC3nZC3nYD3b6ENnZCNnY.fHmc.C3D1Dxr2C3nZE3n7.\r\n",
15 'q.C3nZC3nZC3nWDNzYDxf2CNnY.fHmc.C3DWC3nZCNjXD3nW.', '.C3nZC3nZC3nWCxjWE3D1C3nX.cGf2.ENr7C3v7D3T3ENj3C3zYDNnZ.' ],
16 whitespace
=> [" 26002315", "26002315 ", "\n\t26002315\n"],
17 'T-prefix' => [qw(T0031472 T32)],
18 other
=> [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
21 cuecat
=> ["26002315", "046675000808", "046675000808", "043000112403", "978068484914051500"],
22 whitespace
=> [qw(26002315 26002315 26002315)],
23 'T-prefix' => [qw(T0031472 T0000002 )],
24 other
=> [qw(26002315 T0031472 T32 Alphanum123), "Alpha Num 345"],
27 my @filters = sort keys %inputs;
28 foreach my $filter (@filters) {
29 foreach my $datum (@
{$inputs{$filter}}) {
30 my $expect = shift @
{$outputs{$filter}} or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'";
31 my $output = C4
::Circulation
::barcodedecode
($datum, $filter);
32 ok
($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'"));
33 ($output eq $expect) or diag
"Bad output: '$output'";
39 =head2 C4::Circulation::barcodedecode()
41 This tests avoids being dependent on the database by using the optional
42 second argument to barcodedecode.
44 T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9". From:
45 www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf
48 ~ T, P or X followed by numeric characters