Branch Coverage

blib/lib/Perinci/Sub/Gen/AccessTable.pm
Criterion Covered Total %
branch 350 442 79.1


line true false branch
35 211 4 if ref $data eq "ARRAY"
40 133 4 if ref $data eq "ARRAY"
46 0 12 unless $args and $args->{$arg}
48 0 12 unless $tags
50 0 12 unless ref $tag eq "HASH"
51 12 0 if $tag->{'name'} =~ /^category:filtering/
64 0 1888 if $func_meta->{'args'}{$arg_name}
68 497 1391 ref $args{'type'} eq 'ARRAY' ? :
70 105 1783 if defined $args{'default'}
76 66 1822 if ($args{'aliases'})
80 32 1856 if (defined $args{'pos'})
84 32 1856 if (defined $args{'slurpy'})
88 66 1822 if ($args{'extra_props'})
100 1787 1989 unless defined $args{$prop}
103 1989 0 unless setlocale(6, $lang)
105 1989 0 $isdeflang ? :
112 1888 0 unless setlocale(6, $lang)
114 1888 0 $isdeflang ? :
197 33 1 if $opts->{'enable_field_selection'}
212 33 1 if $opts->{'enable_field_selection'}
231 33 1 if $opts->{'enable_ordering'}
242 32 1 if $opts->{'enable_ordering'} and $opts->{'enable_random_ordering'}
253 33 1 if $opts->{'enable_paging'}
264 33 1 if $opts->{'enable_paging'}
276 32 1 if $opts->{'enable_filtering'} and $opts->{'enable_search'}
286 8 241 unless $opts->{'enable_filtering'}
287 29 212 if defined $fspec->{'filterable'} and not $fspec->{'filterable'}
289 1 211 unless ($fspec->{'include_by_default'} // 1)
312 212 0 unless ($func_args->{$fname})
331 153 59 unless ($ftype ~~ ["array", "bool"])
353 30 182 if ($ftype eq "array")
377 153 59 if ($ftype =~ /^(?:int|float|str|date)$/)
423 64 148 if ($ftype eq "str")
446 30 34 if ($fspec->{'filterable_regex'})
474 33 1 if ($opts->{'enable_filtering'})
477 0 2 if $func_args->{$cfn}
509 9 169 if ($args->{'detail'} or $args->{'exclude_fields'}) { }
6 163 elsif ($args->{'fields'}) { }
512 2 60 unless $fspecs->{$_}{'include_by_default'} // 1
514 2 7 if ($args->{'exclude_fields'})
517 10 6 if grep {$field eq $_;} @{$$args{"exclude_fields"};}
522 5 0 $args->{'detail'} ? :
533 1 224 unless $_ ~~ \@fields
551 2 168 if (defined $$args{"$f.is"}) { }
0 168 elsif (defined $$args{"$f.isnt"}) { }
6 324 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
561 8 162 if $exists and not $f ~~ \@filter_fields
568 2 170 if (defined $$args{"$f.has"})
572 2 170 if (defined $$args{"$f.lacks"})
576 4 168 if $exists and not $f ~~ \@filter_fields
583 3 1032 if (defined $$args{"$f.in"})
587 3 1032 if (defined $$args{"$f.not_in"})
598 2 1033 if (defined $$args{"$f.is"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
606 2 1033 if (defined $$args{"$f.isnt"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
614 7 1028 if (defined $$args{"$f.min"})
618 4 1031 if (defined $$args{"$f.max"})
622 2 1033 if (defined $$args{"$f.xmin"})
626 2 1033 if (defined $$args{"$f.xmax"})
630 22 1013 if $exists and not $f ~~ \@filter_fields
637 1 520 if (defined $$args{"$f.contains"})
641 1 520 if (defined $$args{"$f.not_contains"})
645 1 520 if (defined $$args{"$f.matches"})
649 1 520 if (defined $$args{"$f.not_matches"})
653 4 517 if $exists and not $f ~~ \@filter_fields
660 2 4 unless defined $args->{$cfn}
663 4 0 unless $_ ~~ \@filter_fields
671 2 1375 unless not defined $fspecs->{$_}{'searchable'}
674 10 166 defined $q ? :
1 176 defined $qq && @$qq ? :
675 11 166 if (@qq)
685 11 166 @qq ? :
687 176 1 unless ($opts->{'custom_search'})
700 8 169 if (defined $args->{'sort'})
703 1 8 unless $f ~~ \@fields
708 1 0 unless not defined $fspec->{'sortable'} or $fspec->{'sortable'}
709 0 7 $ftype =~ /^(int|float)$/ ? :
711 2 5 $desc ? :
744 549 11387 if (ref $av->{'schema'} and ref $av->{'schema'}[1] and defined $av->{'schema'}[1]{'default'})
749 9 11927 if ($ak =~ /\A(exclude_fields|fields)\z/ and defined $args{$ak})
751 7 2 unless ref $args{$ak} eq "ARRAY"
756 177 2 unless $hooks->{$_}
759 1 1 if ref $hres
766 177 1 unless $hooks->{$_}
769 0 1 if ref $hres
771 3 175 unless $res->[0] == 200
780 174 1 unless $hooks->{$_}
783 0 1 if ref $hres
785 173 2 if (__is_aoa($table_data) or __is_aoh($table_data)) { }
2 0 elsif (ref $table_data eq 'CODE') { }
790 0 2 unless eval {
791 0 2 unless ref $res eq "HASH"
794 0 2 unless __is_aoa($data) or __is_aoh($data)
806 174 1 unless $hooks->{$_}
809 0 1 if ref $hres
821 7 168 if (grep {$_->[1] eq "date";} @{$$query{"filters"};})
826 175 0 if %Data::Sah::Util::Type::Date::
832 218 471 if (ref $r0 eq 'ARRAY') { }
471 0 elsif (ref $r0 eq 'HASH') { }
847 4 685 if $metadata->{'filtered'}
852 0 186 if $ftype eq "cistr"
853 28 158 if ($op eq 'truth') { }
8 150 elsif ($op eq '~~') { }
8 142 elsif ($op eq '!~~') { }
12 130 elsif ($op eq 'in') { }
12 118 elsif ($op eq 'not_in') { }
3 115 elsif ($op eq '==' and $stringy and $cic) { }
5 110 elsif ($op eq '==' and $stringy) { }
4 106 elsif ($op eq '==' and $ftype eq 'date') { }
10 96 elsif ($op eq '==') { }
0 96 elsif ($op eq '!=' and $stringy and $cic) { }
0 96 elsif ($op eq '!=' and $stringy) { }
8 88 elsif ($op eq '!=' and $ftype eq 'date') { }
0 88 elsif ($op eq '!=') { }
0 88 elsif ($op eq '>=' and $stringy and $cic) { }
4 84 elsif ($op eq '>=' and $stringy) { }
4 80 elsif ($op eq '>=' and $ftype eq 'date') { }
18 62 elsif ($op eq '>=') { }
0 62 elsif ($op eq '>' and $stringy and $cic) { }
4 58 elsif ($op eq '>' and $stringy) { }
4 54 elsif ($op eq '>' and $ftype eq 'date') { }
0 54 elsif ($op eq '>') { }
0 54 elsif ($op eq '<=' and $stringy and $cic) { }
4 50 elsif ($op eq '<=' and $stringy) { }
4 46 elsif ($op eq '<=' and $ftype eq 'date') { }
8 38 elsif ($op eq '<=') { }
4 34 elsif ($op eq '<' and $stringy) { }
0 34 elsif ($op eq '<' and $stringy) { }
4 30 elsif ($op eq '<' and $ftype eq 'date') { }
0 30 elsif ($op eq '<') { }
4 26 elsif ($op eq '=~') { }
4 22 elsif ($op eq '!~') { }
0 22 elsif ($op eq 'pos' and $cic) { }
4 18 elsif ($op eq 'pos') { }
0 18 elsif ($op eq '!pos' and $cic) { }
4 14 elsif ($op eq '!pos') { }
14 0 elsif ($op eq 'call') { }
854 14 14 if $r_h->{$f} xor $opn
856 0 8 if ($stringy and $cic) { }
859 0 0 unless lc $_ ~~ \@vals
863 5 5 unless $_ ~~ \@{$$r_h{$f};}
867 0 8 if ($stringy and $cic) { }
870 0 0 if lc $_ ~~ \@vals
874 5 5 if $_ ~~ \@{$$r_h{$f};}
878 0 12 if ($stringy and $cic) { }
880 0 0 unless lc $r_h->{$f} ~~ \@vals
882 5 7 unless $r_h->{$f} ~~ \@$opn
885 0 12 if ($stringy and $cic) { }
887 0 0 if $r_h->{$f} ~~ \@vals
889 6 6 if $r_h->{$f} ~~ \@$opn
892 1 2 unless lc $r_h->{$f} eq lc $opn
894 3 2 unless $r_h->{$f} eq $opn
898 0 4 unless $dopn and $d
899 3 1 unless $d->compare($dopn) == 0
901 6 4 unless $r_h->{$f} == $opn
904 0 0 unless lc $r_h->{$f} ne lc $opn
906 0 0 unless $r_h->{$f} ne $opn
910 4 4 unless $dopn and $d
911 1 3 unless $d->compare($dopn) != 0
913 0 0 unless $r_h->{$f} != $opn
916 0 0 unless lc $r_h->{$f} ge lc $opn
918 1 3 unless $r_h->{$f} ge $opn
922 0 4 unless $dopn and $d
923 2 2 unless $d->compare($dopn) >= 0
925 7 11 unless $r_h->{$f} >= $opn
928 0 0 unless lc $r_h->{$f} gt lc $opn
930 2 2 unless $r_h->{$f} gt $opn
934 0 4 unless $dopn and $d
935 3 1 unless $d->compare($dopn) > 0
937 0 0 unless $r_h->{$f} > $opn
940 0 0 unless lc $r_h->{$f} le lc $opn
942 2 2 unless $r_h->{$f} le $opn
946 0 4 unless $dopn and $d
947 1 3 unless $d->compare($dopn) <= 0
949 3 5 unless $r_h->{$f} <= $opn
952 3 1 unless lc $r_h->{$f} lt lc $opn
954 0 0 unless $r_h->{$f} lt $opn
958 0 4 unless $dopn and $d
959 2 2 unless $d->compare($dopn) < 0
961 0 0 unless $r_h->{$f} < $opn
965 1 3 unless $r_h->{$f} =~ /$opn/
969 3 1 if $r_h->{$f} =~ /$opn/
972 0 0 unless index(lc $r_h->{$f}, lc $opn) >= 0
974 1 3 unless index($r_h->{$f}, $opn) >= 0
977 0 0 if index(lc $r_h->{$f}, lc $opn) >= 0
979 3 1 if index($r_h->{$f}, $opn) >= 0
982 6 8 unless $opn->[0]->($r_h, $opn->[1])
989 40 552 if (defined $qq)
990 4 36 if ($opts->{'custom_search'}) { }
992 2 2 unless $opts->{'custom_search'}->($r_h, $qq, $query->{'search_opts'})
996 6 66 if ($r_h->{$f} =~ /$search_re/is)
1003 3 27 if ($el =~ /$search_re/is)
1008 27 9 unless $match
1018 0 175 if ($metadata->{'sorted'}) { }
100 75 elsif ($query->{'random'}) { }
6 69 elsif (@{$query->{'sorts'};}) { }
1027 31 0 if ($op eq 'cmp') { }
1033 29 2 if $x != 0
1045 175 0 unless ($metadata->{'paged'})
1046 1 174 if ($query->{'result_start'} > 1)
1049 4 171 if (defined $query->{'result_limit'})
1057 0 175 if $metadata->{'fields_selected'}
1060 510 4 unless ($args{'detail'} or $args{'fields'} or $args{'exclude_fields'})
1064 36 14 if ($args{'with_field_names'}) { }
1068 92 196 unless $_ ~~ \@{$$query{"requested_fields"};}
1083 174 1 unless $hooks->{$_}
1086 0 1 if ref $hres
1500 0 38 unless $fqname
1502 0 38 if ($fqname =~ /(.+)::(.+)/) { }
1511 0 38 unless my $table_data = $args{'table_data'}
1512 0 16 unless __is_aoa($table_data) or __is_aoh($table_data) or ref $table_data eq "CODE"
1516 0 38 unless my $table_spec = $args{'table_spec'}
1517 0 38 unless ref $table_spec eq "HASH"
1520 1 37 unless $table_spec->{'fields'}
1521 0 37 unless ref $table_spec->{'fields'} eq "HASH"
1524 2 35 unless $table_spec->{'pk'}
1525 1 34 unless exists $table_spec->{'fields'}{$table_spec->{'pk'}}
1593 0 34 unless $res->[0] == 200
1597 0 34 unless $res->[0] == 200
1600 0 34 if ($args{'install'} // 1)