Branch Coverage

lib/Locale/Unicode/Data.pm
Criterion Covered Total %
branch 247 654 37.7


line true false branch
36 5 0 'version'->parse($DBD::SQLite::VERSION) >= 1.48 ? :
0 5 'version'->parse($DBD::SQLite::VERSION) < 1.68 ? :
66 0 4 if (scalar @args == 1 and defined $args[0] and ref $args[0] eq 'HASH') { }
0 4 elsif (scalar(@args) % 2) { }
80 1 0 if ($args[$i] eq "fatal")
93 0 1 if (not defined $meth) { }
0 1 elsif (not defined &$meth($self, $val)) { }
99 0 0 if (defined $val and $self->error)
262 0 0 unless $opts->{'calendar'}
263 0 0 unless ($opts->{'calendar'} =~ /^[a-zA-Z]+(?:\-[a-zA-Z]+)*$/)
270 0 0 if ($opts->{'sequence'}) { }
0 0 elsif ($opts->{'code'}) { }
272 0 0 if (defined $opts->{'sequence'} and not $opts->{'sequence'} =~ /^\d+$/)
277 0 0 unless ($sth = $self->_get_cached_statement("calendar_era_with_sequence"))
287 0 0 unless eval {
293 0 0 if (defined $opts->{'code'} and not $opts->{'code'} =~ /^[a-zA-Z]+(?:\-[a-zA-Z]+)*$/)
298 0 0 unless ($sth = $self->_get_cached_statement("calendar_era_with_code"))
308 0 0 unless eval {
318 0 0 if $self->{'decode_sql_arrays'}
329 0 0 if ($opts->{'calendar'}) { }
331 0 0 unless ($sth = $self->_get_cached_statement("calendar_eras_with_calendar"))
343 0 0 unless ($sth = $self->_get_cached_statement("calendar_eras"))
356 0 0 length($opts->{'calendar'} // '') ? :
357 0 0 $opts->{'calendar'} ? :
0 0 unless eval {
360 0 0 if $self->{'decode_sql_arrays'}
533 1 0 builtin::blessed($_[0]) ? :
584 1 2 if (@_)
586 0 1 ref $_ eq 'CODE' ? :
591 1 0 if ($self->fatal) { }
597 0 0 if warnings::enabled()
598 0 0 if want("OBJECT")
602 2 0 ref $self ? :
753 0 19 unless (exists $type_to_table->{$type})
760 0 19 if (exists $opts->{'key'}) { }
19 0 elsif (exists $opts->{$field}) { }
768 0 19 unless defined $key and length($key // "")
771 9 10 exists $type_to_table->{$type}{'requires'} ? :
774 0 30 unless (exists $opts->{$_} and defined $opts->{$_} and length($opts->{$_} // ""))
783 19 0 scalar @$requires ? :
784 19 0 unless ($sth = $self->_get_cached_statement($sth_id))
796 0 19 unless eval {
799 1 0 if (exists $type_to_table->{$type}{'has_array'} and $self->{'decode_sql_arrays'})
909 9 433 if ($ref = $self->locale("locale", $locale) and $ref->{'parent'})
918 0 6 if ($locale->territory and $locale->script || $locale->variant)
924 0 0 if ($ref = $self->locale("locale", $clone) and $ref->{'parent'})
936 0 435 if (scalar @$variants)
938 0 0 if (scalar @$variants > 1)
948 0 0 if $n <= 1
964 0 0 if (scalar keys %$seen)
967 0 0 if (exists $$seen{join $", @$ref})
982 0 0 if ($ref = $self->locale("locale", $locale) and $ref->{'parent'})
991 6 429 if ($locale->territory)
995 0 6 if ($ref = $self->locale("locale", $locale) and $ref->{'parent'})
1004 0 435 if ($locale->script)
1008 0 0 if ($ref = $self->locale("locale", $locale) and $ref->{'parent'})
1018 0 435 unless (scalar grep(($_ eq $locale), @$tree))
1021 0 0 if ($ref = $self->locale("locale", $locale) and $ref->{'parent'})
1029 431 4 unless $tree->[-1] eq "und"
1068 11 1 unless (builtin::blessed($orig) and $orig->isa("Locale::Unicode"))
1073 0 11 unless (defined $orig)
1075 0 0 if ($ref = $self->alias('alias', $backup, 'type', 'language') and ref($ref->{'replacement'} // '') eq 'ARRAY' and scalar @{$ref->{'replacement'};}) { }
1096 1 11 if (my $privateuse = $locale->privateuse) { }
1 10 elsif (my $grandfathered = $locale->grandfathered) { }
0 10 elsif (not $locale->language_id) { }
1 9 elsif ($ref = $self->alias('alias', "$locale", 'type', 'language') and ref($ref->{'replacement'} // '') eq 'ARRAY' and scalar @{$ref->{'replacement'};}) { }
4 5 elsif ($ref = $self->alias('alias', $locale->language_extended, 'type', 'language') and ref($ref->{'replacement'} // '') eq 'ARRAY' and scalar @{$ref->{'replacement'};}) { }
1103 1 0 if ($ref = $self->alias("alias", $grandfathered, "type", "language") and ref($ref->{'replacement'} // "") eq "ARRAY" and scalar @{$ref->{'replacement'};})
1113 0 1 unless $locale->private
1155 3 0 if ($locale->territory and $ref = $self->alias("alias", $locale->territory, "type", "territory") and ref($ref->{'replacement'} // "") eq "ARRAY" and scalar @{$ref->{'replacement'};})
1160 2 1 if (scalar @{$ref->{'replacement'};} > 1) { }
1168 2 0 if $likely and $likely->{'target'}
1171 2 0 if (defined $likely) { }
1176 0 2 unless ($cc)
1180 2 0 if (scalar grep(/^$cc$/i, @{$$ref{'replacement'};})) { }
1200 1 11 if ($locale->variant)
1207 9 5 if $n <= 1
1224 2 0 if scalar @$variants
1228 1 0 if ($ref = $self->alias("alias", "und-@$combo", "type", "language") and ref $ref->{'replacement'} eq "ARRAY" and scalar @{$ref->{'replacement'};})
1236 2 2 if ($combo->[$i] eq $variants->[$j])
1244 1 0 if (scalar @$variants) { }
1254 1 0 if $tmp->language_id eq "und"
1264 0 1 unless ($found)
1268 0 0 if exists $seen->{$variant}
1269 0 0 if ($ref = $self->alias("alias", 'und-' . $variant, "type", "language") and ref $ref->{'replacement'} eq "ARRAY" and scalar @{$ref->{'replacement'};})
1281 0 1 unless ($found)
1285 0 0 if ($ref = $self->alias("alias", $variant, "type", "variant") and ref $ref->{'replacement'} eq "ARRAY" and scalar @{$ref->{'replacement'};})
1298 0 0 if ($script = $locale->script and $ref = $self->alias("alias", $script, "type", "script") and ref $ref->{'replacement'} eq "ARRAY" and scalar @{$ref->{'replacement'};})
1376 0 0 if (scalar @_)
1380 0 0 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
1386 0 0 if (scalar @_ > 1 and ref $_[-1] eq "HASH")
1393 0 0 if not defined $err and exists $opts->{'error'} and defined $opts->{'error'} and length $opts->{'error'}
1395 0 0 if exists $opts->{'class'} and defined $opts->{'class'} and length $opts->{'class'}
1396 0 0 if exists $opts->{'code'} and defined $opts->{'code'} and length $opts->{'code'}
1401 0 0 if (not defined $err and !scalar(@_) || defined $class) { }
0 0 elsif (defined $err and builtin::blessed($err) and scalar @_ == 1 || scalar @_ == 2 && defined $class) { }
1404 0 0 length ${$pack . '::ERROR';} ? :
0 0 ref $self ? :
1405 0 0 if (not defined $error) { }
1411 0 0 defined $class ? :
1412 0 0 if defined $code
1421 0 0 defined $class ? :
1422 0 0 if defined $code and $self->{'error'}->can("code")
1424 0 0 if ($self->{'fatal'} or defined ${"${class}::FATAL_EXCEPTIONS";} and ${"${class}::FATAL_EXCEPTIONS";})
1435 0 0 if (want("OBJECT"))
2462 0 246 if (not length($number // '')) { }
0 246 elsif (not length $locale) { }
2478 246 0 if (exists $plural_rules->{$loc})
2486 0 246 unless (defined $rules)
2492 245 708 if (exists $rules->{$category} and $rules->{$category}->($number))
2513 1 221 unless (defined $plural_forms)
2562 0 1 if ($@)
2568 40 182 if (exists $plural_forms->{$locale}) { }
2581 0 182 if (exists $plural_forms->{$loc})
2588 182 0 if ($all and scalar @$all)
2590 182 0 if ($all->[0]{'aliases'} and ref $all->[0]{'aliases'} eq "ARRAY")
2594 182 0 if (exists $plural_forms->{$l})
2698 0 0 if ($pat =~ /^(?<p1>\{\d\})(?<sep>[^\{]+)(?<p2>\{\d\})$/)
2705 0 0 if (index($pat, "'") != -1)
2712 0 0 unless (exists $literals->{$1})
2749 0 0 if $check =~ /^[^a-zA-Z]$/
2751 0 0 if (exists $equivalent->{$check} and $pos == -1)
2755 0 0 if $pos != -1
2757 0 0 if ($pos != -1)
2764 0 0 unless (scalar keys %$matches)
2766 0 0 if warnings::enabled()
2772 0 0 if (scalar @bests > 1 and length $bests[1] == $max_len) { }
2777 0 0 if (index($this, $greatest_diff) != -1)
2784 0 0 if (not defined $found) { }
2802 0 0 if (scalar @$spaces)
2811 0 0 if (scalar keys %$literals)
2929 1 3 unless ($sth = $self->_get_cached_statement($sth_id))
2943 0 4 unless eval {
2945 0 4 unless $ref
2948 1 3 if ($ref->{'is_canonical'}) { }
3 0 elsif ($ref->{'alias'} and ref $ref->{'alias'} eq 'ARRAY' and scalar @{$ref->{'alias'};}) { }
2957 2 1 unless ($sth = $self->_get_cached_statement($sth_id))
2970 0 3 unless eval {
2974 3 0 if $this->{'is_canonical'}
2984 1 0 $is_extended ? :
2997 1 0 $is_extended ? :
3177 242 0 if ($Locale::Unicode::Data::DBH and ref $Locale::Unicode::Data::DBH eq "HASH" and exists $Locale::Unicode::Data::DBH->{$file} and $Locale::Unicode::Data::DBH->{$file} and builtin::blessed($Locale::Unicode::Data::DBH->{$file}) and $Locale::Unicode::Data::DBH->{$file}->isa("DBI::db") and $Locale::Unicode::Data::DBH->{$file}->ping)
3189 0 4 if (not -e $file) { }
0 4 elsif (not -f $file) { }
0 4 elsif (-z $file) { }
0 4 elsif (not -r $file) { }
0 4 elsif ('version'->parse($DBD::SQLite::sqlite_version) < 'version'->parse('3.6.19')) { }
3234 0 272848 if @_ != 2
3236 0 272848 if (ref $where ne 'ARRAY') { }
0 545479 elsif (ref($ref // '') ne 'HASH' and builtin::reftype($ref // '') ne 'ARRAY') { }
3247 272631 217 if (ref $ref eq 'HASH') { }
217 0 elsif (builtin::reftype($ref) eq 'ARRAY') { }
3251 254466 28330 if (exists $ref->{$field} and defined $ref->{$field} and length $ref->{$field})
3259 0 254466 if ($@) { }
3275 0 272154 if (ref $ref->[$i] ne "HASH")
3290 0 0 if (ref $this eq 'HASH') { }
0 0 elsif (ref $this eq 'ARRAY') { }
0 0 elsif (not ref $this) { }
3294 0 0 unless defined $this->{$k}
3295 0 0 if (ref $this->{$k} eq "ARRAY" or not ref $this->{$k})
3306 0 0 unless defined $this->[$i]
3307 0 0 if (ref $this->[$i] eq "HASH" or not ref $this->[$i])
3320 0 0 if ($@) { }
3322 0 0 if warnings::enabled()
3337 0 345 if ref $def ne "HASH"
3341 6 339 exists $def->{'order'} ? :
3346 0 18 $def->{'has_status'} =~ /[a-zA-Z]/ ? :
18 327 $def->{'has_status'} ? :
3348 335 10 exists $def->{'by'} && ref $def->{'by'} eq 'ARRAY' ? :
3350 0 345 if (exists $opts->{'order_by_value'} and defined $opts->{'order_by_value'})
3353 0 0 if (ref $opts->{'order_by_value'} eq 'ARRAY') { }
3363 0 345 if (scalar @$order_by_value)
3365 0 0 if (scalar @$order_by_value != 2) { }
0 0 elsif (ref $order_by_value->[1] ne 'ARRAY') { }
0 0 elsif (not scalar @{$order_by_value->[1];}) { }
3387 0 345 if (exists $opts->{'order'})
3390 0 0 if (ref $opts->{'order'} eq 'HASH') { }
0 0 elsif (ref $opts->{'order'} eq 'ARRAY') { }
3393 0 0 if (scalar @keys != 1)
3402 0 0 if (scalar @{$opts->{'order'};} != 2)
3413 0 0 if (defined $field and defined $datatype) { }
0 0 elsif (defined $field) { }
3415 0 0 if (not length($field // '')) { }
0 0 elsif (not length($datatype // '')) { }
0 0 elsif (not $field =~ /^[a-zA-Z0-9\_]+$/) { }
0 0 elsif (not $datatype =~ /^[a-zA-Z0-9]+$/) { }
3435 0 0 unless length($field // "")
3436 0 0 unless ($field =~ /^[a-zA-Z0-9\_]+$/)
3442 216 129 exists $def->{'has_array'} && ref $def->{'has_array'} eq 'ARRAY' ? :
3452 334 11 if (scalar @$by)
3456 0 1213 unless $_ =~ /^[a-z][a-z0-9]+(?:\_[a-z][a-z0-9]+)*$/
3457 895 318 unless exists $opts->{$_}
3458 0 318 if (ref($opts->{$_} // '') eq 'ARRAY') { }
3465 0 0 if (defined $val and $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{'val'}/) { }
0 0 elsif (defined $val and ref $val eq 'Regexp') { }
3477 0 0 if exists $op_map->{$op}
3478 0 0 if ($op eq '~') { }
3488 0 0 builtin::blessed($val) && overload::Method($val, '""') ? :
0 0 defined $val ? :
3496 0 318 if (defined $val and $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{'val'}/) { }
1 324 elsif (defined $val and ref $val eq 'Regexp') { }
3508 317 1 if exists $op_map->{$op}
3509 1 317 if ($op eq '~') { }
3519 0 311 builtin::blessed($val) && overload::Method($val, '""') ? :
311 7 defined $val ? :
3523 0 18 if (defined $status and exists $opts->{$status})
3533 0 0 if ($opts->{'has'} and scalar @$sql_arrays_in)
3536 0 0 if (ref $opts->{'has'} eq 'HASH') { }
0 0 elsif (ref $opts->{'has'} eq 'ARRAY') { }
0 0 elsif (scalar @$sql_arrays_in == 1) { }
3558 0 0 unless ($f =~ /^[a-zA-z][a-zA-z0-9]+$/)
3568 284 61 scalar @$by_keys ? :
3569 0 284 defined $has ? :
0 61 defined $has ? :
284 61 $by_key ? :
3576 284 61 if ($by_key or defined $has) { }
3578 95 189 unless ($sth = $self->_get_cached_statement($sth_id))
3590 58 3 unless ($sth = $self->_get_cached_statement($sth_id))
3603 284 61 scalar @$by_values ? :
0 345 defined $has_values ? :
3604 0 0 $by_key ? :
0 345 unless eval {
3607 216 129 if ($all and scalar @$sql_arrays_in)
3609 216 0 if $self->{'decode_sql_arrays'}
3611 0 345 if (not $all and want("ARRAY"))
3622 0 571 if ref $def ne "HASH"
3628 0 571 unless exists $opts->{$field}
3629 1 570 ref $opts->{$field} eq 'ARRAY' ? :
3630 509 62 exists $def->{'has_array'} && ref $def->{'has_array'} eq 'ARRAY' ? :
3633 89 482 exists $def->{'requires'} && ref $def->{'requires'} eq 'ARRAY' ? :
3647 0 150 unless $_ =~ /^[a-z][a-z0-9]+(?:\_[a-z][a-z0-9]+)*$/
3648 24 1 if not exists $opts->{$_} and exists $defaults->{$_}
3649 1 149 unless (exists $opts->{$_})
3654 1 148 if (ref($opts->{$_} // '') eq 'ARRAY') { }
3661 2 0 if (defined $val and $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{'val'}/) { }
0 0 elsif (defined $val and ref $val eq 'Regexp') { }
3674 0 2 if exists $op_map->{$op}
3675 0 2 if ($op eq '~') { }
3685 0 2 builtin::blessed($val) && overload::Method($val, '""') ? :
2 0 defined $val ? :
3693 0 148 if (defined $val and $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{'val'}/) { }
0 172 elsif (defined $val and ref $val eq 'Regexp') { }
3706 148 0 if exists $op_map->{$op}
3707 0 148 if ($op eq '~') { }
3717 0 124 builtin::blessed($val) && overload::Method($val, '""') ? :
124 24 defined $val ? :
3720 88 482 scalar @$required_keys ? :
3727 1 570 if (defined $_ and s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{'val'}/) { }
0 570 elsif (defined $_ and ref $_ eq 'Regexp') { }
3739 570 1 if exists $op_map->{$op}
3740 1 570 if ($op eq '~') { }
3750 450 121 builtin::blessed($_) && overload::Method($_, '""') ? :
571 0 defined $_ ? :
3752 568 2 $def->{'id'} ? :
3753 88 482 if $requires_key
3756 65 505 unless ($sth = $self->_get_cached_statement($sth_id))
3768 88 482 scalar @$required_val ? :
3769 0 570 unless eval {
3770 1 569 $def->{'multi'} || scalar @$id > 1 ? :
3772 473 58 if ($ref and scalar @$sql_arrays_in)
3774 473 0 if $self->{'decode_sql_arrays'}
3776 0 570 if (not $ref and want("HASH"))
3787 0 942 unless length($id // "")
3790 701 0 if (exists $Locale::Unicode::Data::STHS->{$file}{$id} and defined $Locale::Unicode::Data::STHS->{$file}{$id} and builtin::blessed($Locale::Unicode::Data::STHS->{$file}{$id}) and $Locale::Unicode::Data::STHS->{$file}{$id}->isa("DBI::st"))
3806 1 0 unless ($sth = $self->_get_cached_statement("cldr_metadata"))
3817 0 1 unless eval {
3822 0 1 unless $ref
3831 1314 2 unless (builtin::blessed($locale) and $locale->isa("Locale::Unicode"))
3844 0 241 unless length($id // "")
3845 0 241 if (not $sth) { }
0 241 elsif (not builtin::blessed($sth) && $sth->isa('DBI::st')) { }
3866 2 1432 if (ref $field eq "HASH")
3870 0 2 if (exists $def->{'regexp'} and defined $def->{'regexp'} and ref $def->{'regexp'} eq 'Regexp') { }
2 0 elsif (exists $def->{'type'} and defined $def->{'type'} and length $def->{'type'}) { }
3882 0 0 if (exists $def->{'isa'} and defined $def->{'isa'} and length $def->{'isa'})
3889 1 1433 if (@_)
3892 1 0 if (defined $val and length $val)
3895 0 1 if (defined $re and not $val =~ /^$re$/) { }
0 1 elsif (defined $type and $type eq 'boolean') { }
0 1 elsif (defined $isa) { }
3904 0 0 if ($val =~ /^(?:yes|no)$/i) { }
0 0 elsif ($val =~ /^(?:true|false)$/i) { }
0 0 elsif ($val =~ /^(?:1|0)$/) { }
3907 0 0 $val eq 'yes' ? :
3912 0 0 $val eq 'true' ? :
3917 0 0 $val ? :
3921 0 0 if warnings::enabled()
3922 0 0 $val ? :
3927 0 0 if (not builtin::blessed($val) or builtin::blessed($val) and not $val->isa($isa))
3937 0 1434 if want("OBJECT")
3939 0 1434 unless defined $self->{$field}
3947 0 1181 if (scalar @_ == 1 and defined $_[0] and (ref $_[0] || '') eq 'HASH') { }
1181 0 elsif (not scalar(@_) % 2) { }
3967 5 0 if (defined $Locale::Unicode::Data::STHS and ref $Locale::Unicode::Data::STHS eq "HASH")
3973 0 241 if (defined $sth and builtin::blessed($sth))
3993 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
4007 0 0 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
4008 0 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
4009 0 0 ref $ref eq 'ARRAY' ? :
4012 0 0 if (ref $self) { }
4058 0 0 $_[0] ? :
4064 0 0 unless (ref $self)
4077 0 0 if $_[0]
4079 0 0 if not $_[0]
4090 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
4105 0 0 if (scalar @args == 1 and ref $args[0] eq 'ARRAY') { }
4115 0 0 if (ref $self) { }
4131 0 0 $_[0] ? :
4159 1 0 if (scalar @_ == 1) { }
4161 1 0 if ((ref $_[0] || '') eq 'HASH') { }
0 0 elsif (ref $_[0] and $_[0]->isa('Locale::Unicode::Data::Exception')) { }
4164 1 0 if ($args->{'skip_frames'})
4172 1 6 if exists $args->{$k}
4190 0 0 ref $_ eq 'CODE' ? :
4201 0 0 if $self->{'_cache_value'} and not length $self->{'_reset'}
4230 0 0 if (defined $file and defined $line)
4243 0 0 if (not length $self->{'_reset'} and scalar @_)
4253 0 0 unless ref $self
4263 0 0 if (@_) { }
4284 0 0 if @_
4296 0 0 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
4310 0 0 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
4311 0 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
4312 0 0 ref $ref eq 'ARRAY' ? :
4315 0 0 if (ref $self) { }
4352 0 0 @_ ? :
4360 0 0 if (want("OBJECT"))