foreach my $scap_field (@scap_fields_ordered) { #TODO: use generic MFHD "summarize" method, once available
my @updated_holdings;
eval {
- @updated_holdings = $mfhd->get_compressed_holdings($scap_field);
+ @updated_holdings = $mfhd->get_combined_holdings($scap_field);
};
if ($@) {
- my $msg = "get_compressed_holdings(): $@ ; using sdist ID #" .
+ my $msg = "get_combined_holdings(): $@ ; using sdist ID #" .
($sdist ? $sdist->id : "<NONE>") . " and " .
scalar(@$issuances) . " issuances, of which one has ID #" .
$issuances->[0]->id;
is_deeply($holdings_a[0]->compressed_to_last, $holdings_b[0], 'compressed to last, normal');
is($holdings_a[1]->compressed_to_last, undef, 'compressed to last, open ended');
+# test: get compressed holdings
+$testno++;
+
+$rec = MFHD->new(testlib::load_MARC_rec($testdata, $testno));
+$rec2 = MFHD->new(testlib::load_MARC_rec($testdata, $testno));
+
+@holdings_a = $rec->get_compressed_holdings(($rec->captions('853'))[0]);
+@holdings_b = $rec2->holdings_by_caption(($rec2->captions('853'))[0]);
+
+is_deeply(\@holdings_a, \@holdings_b, 'get compressed holdings');
+
+
# test: get compressed holdings, open ended member
$testno++;
is_deeply(\@holdings_a, \@holdings_b, 'comparison testing via sort');
+# test: get combined holdings
+$testno++;
+
+$rec = MFHD->new(testlib::load_MARC_rec($testdata, $testno));
+$rec2 = MFHD->new(testlib::load_MARC_rec($testdata, $testno));
+
+@holdings_a = $rec->get_combined_holdings(($rec->captions('853'))[0]);
+@holdings_b = $rec2->holdings_by_caption(($rec2->captions('853'))[0]);
+
+is_deeply(\@holdings_a, \@holdings_b, 'get combined holdings');
+
+
close $testdata;
1;
853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
863 41 $81.1$a1$b8$i1990$j08
+245 00 $aGet compressed holdings
+853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
+863 40 $81.1$a1$b1-4$i1990$j01-04
+863 40 $81.2$a1$b2-3$i1990$j02-03
+863 40 $81.3$a1$b6-7$i1990$j06-07
+863 41 $81.4$a1$b8$i1990$j08
+863 41 $81.5$a1$b10$i1990$j10
+863 40 $81.6$a1-$b10-$i1990-$j10-
+863 41 $81.7$a1$b12$i1990$j12
+
+245 00 $aGet compressed holdings, result
+853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
+863 40 $81.1$a1$b1-4$i1990$j01-04
+863 40 $81.2$a1$b6-8$i1990$j06-08
+863 40 $81.3$a1-$b10-$i1990-$j10-
+
245 00 $aGet compressed holdings, open ended member
853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
863 41 $81.1$a1$b4$i1990$j04
863 40 $81.8$a1$b4-7$i1990$j04-07
863 40 $81.9$a1$b4-7$i1990$j04-07
+245 00 $aGet combined holdings
+853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
+863 40 $81.1$a1$b1-4$i1990$j01-04
+863 40 $81.2$a1$b2-3$i1990$j02-03
+863 40 $81.3$a1$b6-7$i1990$j06-07
+863 41 $81.4$a1$b8$i1990$j08
+863 41 $81.5$a1$b10$i1990$j10
+863 40 $81.6$a1-$b10-$i1990-$j10-
+863 41 $81.7$a1$b12$i1990$j12
+
+245 00 $aGet combined holdings, result
+853 20 $81$av.$bno.$u12$vr$i(year)$j(month)$wm$x01
+863 40 $81.1$a1$b1-4$i1990$j01-04
+863 40 $81.2$a1$b6-8$i1990$j06-08
+863 40 $81.3$a1-$b10-$i1990-$j10-