Branch Coverage

blib/lib/Validate/CodiceFiscale.pm
Criterion Covered Total %
branch 63 76 82.8


line true false branch
17 3 14 unless my $errors = validate_cf($cf, "all_errors", 0, %options)
20 14 0 unless defined(my $ecb = $options{'on_error'})
39 28 6 scalar @$errors ? :
47 0 0 unless @args
51 0 0 if (my $errors = validate_cf($cf)) { }
60 0 0 $n ? :
96 3 49 if (length $cf != 16)
112 2 1 unless $portions{'name'} =~ /\A$namish\z/msux or &$cb("invalid name")
116 4 2 unless $portions{'surname'} =~ /\A$namish\z/msux or &$cb("invalid surname")
121 4 2 unless _is_valid_cf_date($y, $m, $d) or &$cb("invalid birth date")
126 38 1 if defined $y
129 36 3 if (defined(my $p = _place_name_for($portions{'place'}, $date))) { }
133 2 1 unless &$cb("invalid birth place")
137 4 33 if $checksum ne substr($cf, -1, 1) and not &$cb("invalid checksum (should be: $checksum)")
141 13 20 unless $data
143 6 14 if (defined(my $surname = $data->{'surname'}))
144 2 4 if substr($cf, 0, 3) ne _compact_surname($surname) and not &$cb("surname mismatch")
148 6 12 if (defined(my $name = $data->{'name'}))
149 2 4 if substr($cf, 3, 3) ne _compact_name($name) and not &$cb("name mismatch")
153 6 10 if (defined(my $birthdate = $data->{'date'}))
156 2 4 if $got ne $male and $got ne $female and not &$cb("birth date mismatch")
161 8 6 if (defined(my $sex = $data->{'sex'}))
164 2 6 if lc $sex eq 'm' && $day > 31 || lc $sex eq 'f' && $day < 41 and not &$cb("sex mismatch")
169 6 6 if (defined(my $place = $data->{'place'}))
172 2 4 if fc $got ne fc $place and not &$cb("birth place mismatch")
269 0 345 if exists $digit_for->{$current}
282 3 40 unless my($y, $mc, $d) = $date =~ /\A(\d\d)([ABCDEHLMPRST])(\d\d)\z/msux
286 27 13 $d > 40 ? :
287 27 13 if $d > 40
290 0 40 if (defined(my $years_baseline = +($opts // {})->{'years_baseline'})) { }
296 40 0 if $y > $this_year
309 0 6 if $d > 31
323 3 3 if @$cs > 3
331 30 33 if ($char =~ /[AEIOU]/msux) { }
348 0 39 unless my $record = $$place_for{_normalized_birthplace($place)}
349 1 38 unless defined $birthdate
351 34 35 if $birthdate gt $candidate->{'end'}
352 0 35 if $birthdate lt $candidate->{'start'}