6 use Test::More 'no_plan';
7 use File::Basename qw(dirname);
10 use OpenILS::Utils::MFHD;
20 foreach my $subfield (split(/\|/, $holding->subfield('x'))) {
21 next unless $subfield;
23 my ($key, $val) = unpack('aa*', $subfield);
24 $answer->{$key} = $val;
34 my $testfile = dirname(__FILE__) . "/mfhddata.txt";
35 open(my $testdata, "<", $testfile) or die("Cannot open '$testfile': $!");
37 while ($rec = testlib::load_MARC_rec($testdata, $testno++)) {
38 $rec = MFHD->new($rec);
40 foreach my $cap (sort { $a->tag <=> $b->tag } $rec->field('85.')) {
44 ($htag = $cap->tag) =~ s/^85/86/;
45 @holdings = $rec->holdings($htag, $cap->subfield('8'));
47 if (!ok(scalar @holdings, "holdings defined " . $cap->subfield('8'))) {
51 foreach my $field (@holdings) {
53 local $TODO = "unimplemented"
54 if ($field->subfield('z') =~ /^TODO/);
55 is_deeply($field->next, right_answer($field),
56 $field->subfield('8') . ': ' . $field->subfield('z'));
58 if ($field->subfield('y')) {
59 is($field->chron_to_date(), $field->subfield('y'), 'Chron-to-date test');