|
Lines 82-88
is( $testmatcher->description(), 'match on ISSN', 'testing code accessor' );
Link Here
|
| 82 |
|
82 |
|
| 83 |
subtest '_get_match_keys() tests' => sub { |
83 |
subtest '_get_match_keys() tests' => sub { |
| 84 |
|
84 |
|
| 85 |
plan tests => 17; |
85 |
plan tests => 20; |
| 86 |
|
86 |
|
| 87 |
my $matchpoint = get_title_matchpoint({ |
87 |
my $matchpoint = get_title_matchpoint({ |
| 88 |
length => 0, |
88 |
length => 0, |
|
Lines 92-97
subtest '_get_match_keys() tests' => sub {
Link Here
|
| 92 |
|
92 |
|
| 93 |
my $record = MARC::Record->new(); |
93 |
my $record = MARC::Record->new(); |
| 94 |
$record->append_fields( |
94 |
$record->append_fields( |
|
|
95 |
MARC::Field->new('020', '1', ' ', |
| 96 |
a => '978-1451697216 (alk. paper)'), |
| 97 |
MARC::Field->new('020', '1', ' ', |
| 98 |
a => '145169721X (alk. paper)'), |
| 99 |
MARC::Field->new('020', '1', ' ', |
| 100 |
a => '1NOTISBN3'), |
| 95 |
MARC::Field->new('100', '1', ' ', |
101 |
MARC::Field->new('100', '1', ' ', |
| 96 |
a => 'King, Stephen', |
102 |
a => 'King, Stephen', |
| 97 |
d => 'd1947-'), |
103 |
d => 'd1947-'), |
|
Lines 242-247
subtest '_get_match_keys() tests' => sub {
Link Here
|
| 242 |
|
248 |
|
| 243 |
is( $keys[0], ' .; THE T[]:,ALIS(M)/AN\'" STEPHEN KING, PETER STRAUB.', |
249 |
is( $keys[0], ' .; THE T[]:,ALIS(M)/AN\'" STEPHEN KING, PETER STRAUB.', |
| 244 |
'Match key correctly normalized if invalid normalization routine specified' ); |
250 |
'Match key correctly normalized if invalid normalization routine specified' ); |
|
|
251 |
|
| 252 |
$matchpoint = get_isbn_matchpoint({ |
| 253 |
length => 0, |
| 254 |
norms => [ 'ISBN' ], |
| 255 |
offset => 0 |
| 256 |
}); |
| 257 |
@keys = C4::Matcher::_get_match_keys( $record, $matchpoint ); |
| 258 |
is( $keys[0], '9781451697216', |
| 259 |
'Match key correctly calculated as ISBN13 when ISBN normalizer used'); |
| 260 |
is( $keys[1], '9781451697216', |
| 261 |
'Match key correctly calculated as ISBN13 when ISBN normalizer used'); |
| 262 |
is( $keys[2], '1NOTISBN3', |
| 263 |
'Match key passed through if not an isbn when ISBN normalizer used'); |
| 264 |
|
| 245 |
}; |
265 |
}; |
| 246 |
|
266 |
|
| 247 |
sub get_title_matchpoint { |
267 |
sub get_title_matchpoint { |
|
Lines 311-313
sub get_authors_matchpoint {
Link Here
|
| 311 |
return $matchpoint; |
331 |
return $matchpoint; |
| 312 |
} |
332 |
} |
| 313 |
|
333 |
|
| 314 |
- |
334 |
sub get_isbn_matchpoint { |
|
|
335 |
|
| 336 |
my $params = shift; |
| 337 |
|
| 338 |
my $length = $params->{length} // 0; |
| 339 |
my $norms = $params->{norms} // []; |
| 340 |
my $offset = $params->{offset} // 0; |
| 341 |
|
| 342 |
my $matchpoint = { |
| 343 |
components => [ |
| 344 |
{ |
| 345 |
length => $length, |
| 346 |
norms => $norms, |
| 347 |
offset => $offset, |
| 348 |
subfields => |
| 349 |
{ |
| 350 |
a => 1 |
| 351 |
}, |
| 352 |
tag => '020' |
| 353 |
}, |
| 354 |
], |
| 355 |
index => "isbn", |
| 356 |
score => 1000 |
| 357 |
}; |
| 358 |
|
| 359 |
return $matchpoint; |
| 360 |
} |
| 361 |
|