Branch Coverage

blib/lib/MARC/Lint.pm
Criterion Covered Total %
branch 150 188 79.7


line true false branch
112 64 0 wantarray ? :
160 0 13 unless ref $marc and $marc->isa('MARC::Record')
165 1 12 if ($n1xx > 1)
169 0 13 unless ($marc->field(245))
182 1 205 if ($tagno eq '880') { }
184 1 0 if ($field->subfield('6')) { }
188 0 1 unless $tagrules = $rules->{$tagno}
190 0 1 if ($tagrules->{'repeatable'} and $tagrules->{'repeatable'} eq 'NR' and $field_seen{'880.' . $tagno})
199 1 204 unless $tagrules = $rules->{$tagno}
201 0 110 if ($tagrules->{'repeatable'} and $tagrules->{'repeatable'} eq 'NR' and $field_seen{$tagno})
206 158 47 if ($tagno >= 10) { }
47 0 elsif ($tagno < 10) { }
209 4 312 unless ($indvalue =~ /$$tagrules{"ind$ind" . '_regex'}/)
223 2 260 if (not defined $rule) { }
1 259 elsif ($rule eq 'NR' and $sub_seen{$code}) { }
229 0 262 if ($data =~ /[\t\r\n]/)
239 1 46 if ($field->data =~ /\x1F/)
246 25 180 if ($self->can($checker))
250 1 204 if ($is_880) { }
304 21 1 if ($code eq 'a') { }
1 0 elsif ($code eq 'z') { }
305 2 19 if (substr($data, 0, length $isbnno) ne $isbnno)
310 8 13 if ($data =~ /\(/)
311 2 6 unless $data =~ /[X0-9] \(/
315 3 18 if (not $isbnno =~ /(?:^\d{10}$)|(?:^\d{13}$)|(?:^\d{9}X$)/) { }
320 16 2 if (length $isbnno == 10) { }
2 0 elsif (length $isbnno == 13) { }
322 16 0 if ($Business::ISBN::VERSION gt '2.02_01' or $Business::ISBN::VERSION gt '2.009') { }
0 0 elsif ($Business::ISBN::VERSION lt '2') { }
323 4 12 if Business::ISBN::valid_isbn_checksum($isbnno) != 1
326 0 0 if Business::ISBN::is_valid_checksum($isbnno) != 1
339 1 1 unless $is_valid_13 == 1
346 0 1 if ($data =~ /^ISBN/ or $data =~ /^\d*\-\d+/)
350 0 0 if length $isbnno == 10 and Business::ISBN::is_valid_checksum($isbnno) == 1
385 1 1 $check_digit == $valid_check_digit ? :
420 3 0 unless ($field->indicator(2) eq '7')
422 3 4 if (length($newsubfields[$index + 1]) % 3 != 0) { }
445 0 6 $MARC::Lint::LanguageCodes{$code041} ? :
447 1 5 $MARC::Lint::ObsoleteLanguageCodes{$code041} ? :
450 6 0 unless ($validlang)
452 1 5 if ($obsoletelang) { }
492 2 3 if ($newsubfields[$index] eq 'a' and length $newsubfields[$index + 1] != 7) { }
3 0 elsif ($newsubfields[$index] eq 'a') { }
499 0 3 $MARC::Lint::GeogAreaCodes{$newsubfields[$index + 1]} ? :
501 1 2 $MARC::Lint::ObsoleteGeogAreaCodes{$newsubfields[$index + 1]} ? :
504 3 0 unless ($validgac)
506 1 2 if ($obsoletegac) { }
545 1 48 unless ($field->subfield('a'))
558 2 88 if $code eq '6'
564 1 48 if (not $newsubfields[$#newsubfields] =~ /[.?!]$/) { }
2 46 elsif ($newsubfields[$#newsubfields] =~ /[?!]$/) { }
573 2 47 if ($has_sub_6) { }
575 0 2 if ($#newsubfields < 3) { }
579 0 2 if ($newsubfields[0] ne '6')
582 0 2 if ($newsubfields[2] ne 'a')
589 1 46 if ($newsubfields[0] ne 'a')
597 14 35 if ($field->subfield('c'))
601 14 3 if ($newsubfields[$index] eq 'c')
602 2 12 unless $newsubfields[$index - 1] =~ m[\s/$]
604 1 13 if $newsubfields[$index + 1] =~ /\b\w\. \b\w\./ and not $newsubfields[$index + 1] =~ /\[\bi\.e\. \b\w\..*\]/
612 13 36 if ($field->subfield('b'))
617 4 12 if ($newsubfields[$index] eq 'b' and not $newsubfields[$index - 1] =~ / [:;=]$/)
625 4 45 if ($field->subfield('h'))
630 1 5 if ($newsubfields[$index] eq 'h' and not $newsubfields[$index - 1] =~ /(\S$)|(\-\- $)/)
635 1 5 if ($newsubfields[$index] eq 'h' and not $newsubfields[$index + 1] =~ /^\[\w*\s*\w*\]/)
642 4 45 if ($field->subfield('n'))
647 1 5 if ($newsubfields[$index] eq 'n' and not $newsubfields[$index - 1] =~ /(\S\.$)|(\-\- \.$)/)
654 4 45 if ($field->subfield('p'))
659 4 2 if ($newsubfields[$index] eq 'p')
661 1 3 if ($newsubfields[$index - 2] eq 'n' and not $newsubfields[$index - 1] =~ /(\S,$)|(\-\- ,$)/) { }
1 3 elsif ($newsubfields[$index - 2] ne 'n' and not $newsubfields[$index - 1] =~ /(\S\.$)|(\-\- \.$)/) { }
771 1 48 if ($tagno eq '880')
772 1 0 if ($field->subfield('6'))
782 0 49 if (not $tagno =~ /^(?:130|240|245|440|630|730|830)$/) { }
0 49 elsif ($tagno =~ /^(?:130|630|730)$/) { }
49 0 elsif ($tagno =~ /^(?:240|245|440|830)$/) { }
799 0 49 unless $ind =~ /^[0-9]$/
813 1 48 unless defined $firstword
814 1 48 unless defined $separator
815 1 48 unless defined $etc
830 9 40 if $article{$firstword} and not $isan_exception
833 9 40 if ($isan_article) { }
836 4 5 if ($separator and $etc =~ /^[ \(\)\[\]'"\-]+/)
843 0 9 if ($firstword eq 'en') { }
3 6 elsif ($nonfilingchars ne $ind) { }
844 0 0 unless $ind eq '3' or $ind eq '0'
852 1 39 unless ($ind eq '0')
929 102 1326 unless @lines >= 4
958 2652 13164 if ($key =~ /^ind/) { }
964 1620 1032 if ($val eq 'blank') { }
977 18 13146 if ($key =~ /(.)-(.)/) { }
991 66 966 if ($str =~ s/(\d)-(\d)/$1 thru $2/)
996 492 474 if $digits[0] eq 'b'
1004 0 0 if $str eq 'blank'