Add MFHD tests for compressing and combining
authorDan Wells <dbw2@calvin.edu>
Wed, 8 May 2013 19:06:17 +0000 (15:06 -0400)
committerDan Wells <dbw2@calvin.edu>
Tue, 2 Jul 2013 15:11:20 +0000 (11:11 -0400)
First, add a test for the new get_combined_holdings() method.

Second, add a known problem case for get_compressed_holdings().
The fix will come in a subsequent commit.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhd.t
Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/test/mfhddata2.txt

index 29ee865..97e64fd 100644 (file)
@@ -89,6 +89,18 @@ $rec2 = MFHD->new(testlib::load_MARC_rec($testdata, $testno));
 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++;
 
@@ -126,5 +138,17 @@ foreach my $holding (@holdings_a) {
 
 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;
index a450bb4..65a6fe8 100644 (file)
 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-