Branch Coverage

blib/lib/Validate/CodiceFiscale.pm
Criterion Covered Total %
branch 47 62 75.8


line true false branch
16 0 0 unless my $errors = validate_cf($cf, "all_errors", 0, %options)
19 0 0 unless defined(my $ecb = $options{'on_error'})
44 14 3 scalar @errors ? :
52 0 0 unless @args
56 0 0 if (my $errors = validate_cf($cf)) { }
65 0 0 $n ? :
86 2 32 if length $cf != 16
91 2 2 unless substr($cf, 0, 3) =~ /\A$namish\z/msux or &$cb("invalid surname")
95 1 1 unless substr($cf, 3, 3) =~ /\A$namish\z/msux or &$cb("invalid name")
99 2 2 unless _is_valid_cf_date(substr($cf, 6, 5)) or &$cb("invalid birth date")
103 1 1 unless substr($cf, 11, 4) =~ /\A [A-Z] ${digitish}{3} \z/msux or &$cb("invalid birth place")
108 2 24 if $checksum ne substr($cf, -1, 1) and not &$cb("invalid checksum (should be: $checksum)")
111 10 14 unless $data
113 4 10 if (defined(my $surname = $data->{'surname'}))
115 1 3 if substr($cf, 0, 3) ne _compact_surname($surname) and not &$cb("surname mismatch")
118 4 9 if (defined(my $name = $data->{'name'}))
120 1 3 if substr($cf, 3, 3) ne _compact_name($name) and not &$cb("name mismatch")
123 4 8 if (defined(my $birthdate = $data->{'birthdate'}))
127 1 3 if $got ne $male and $got ne $female and not &$cb("birth date mismatch")
131 6 5 if (defined(my $sex = $data->{'sex'}))
135 1 5 if lc $sex eq 'm' && $day > 31 || lc $sex eq 'f' && $day < 41 and not &$cb("sex mismatch")
139 4 6 if (defined(my $place = $data->{'birthplace'}))
143 1 3 if fc $got ne fc $place and not &$cb("birth place mismatch")
239 0 180 if exists $digit_for->{$current}
255 18 11 if $d > 40
259 25 4 if $m != 1 || $y % 100 || $d < 29 and eval { do { timegm(30, 30, 12, $d, $m, $y + 1900); 1 } }
265 4 0 if $d != 29
272 0 0 if eval { do { timegm(30, 30, 12, $d, $m, $century * 100); 1 } }
281 0 4 if $d > 31
295 2 2 if @$cs > 3
303 20 22 if ($char =~ /[AEIOU]/msux) { }