Branch Coverage

blib/lib/Perinci/Sub/Gen/AccessTable.pm
Criterion Covered Total %
branch 347 440 78.8


line true false branch
34 211 4 if ref $data eq "ARRAY"
39 133 4 if ref $data eq "ARRAY"
45 0 12 unless $args and $args->{$arg}
47 0 12 unless $tags
49 0 12 unless ref $tag eq "HASH"
50 12 0 if $tag->{'name'} =~ /^category:filtering/
63 0 1888 if $func_meta->{'args'}{$arg_name}
67 465 1423 ref $args{'type'} eq 'ARRAY' ? :
69 105 1783 if defined $args{'default'}
75 66 1822 if ($args{'aliases'})
79 32 1856 if (defined $args{'pos'})
83 66 1822 if ($args{'extra_props'})
95 1787 1989 unless defined $args{$prop}
98 1989 0 unless setlocale(6, $lang)
100 1989 0 $isdeflang ? :
107 1888 0 unless setlocale(6, $lang)
109 1888 0 $isdeflang ? :
192 33 1 if $opts->{'enable_field_selection'}
207 33 1 if $opts->{'enable_field_selection'}
226 33 1 if $opts->{'enable_ordering'}
237 32 1 if $opts->{'enable_ordering'} and $opts->{'enable_random_ordering'}
248 33 1 if $opts->{'enable_paging'}
259 33 1 if $opts->{'enable_paging'}
270 32 1 if $opts->{'enable_filtering'} and $opts->{'enable_search'}
280 8 241 unless $opts->{'enable_filtering'}
281 29 212 if defined $fspec->{'filterable'} and not $fspec->{'filterable'}
283 1 211 unless ($fspec->{'include_by_default'} // 1)
306 212 0 unless ($func_args->{$fname})
325 153 59 unless ($ftype ~~ ["array", "bool"])
347 30 182 if ($ftype eq "array")
371 153 59 if ($ftype =~ /^(?:int|float|str|date)$/)
417 64 148 if ($ftype eq "str")
440 30 34 if ($fspec->{'filterable_regex'})
468 33 1 if ($opts->{'enable_filtering'})
471 0 2 if $func_args->{$cfn}
503 9 169 if ($args->{'detail'} or $args->{'exclude_fields'}) { }
6 163 elsif ($args->{'fields'}) { }
506 2 60 unless $fspecs->{$_}{'include_by_default'} // 1
508 2 7 if ($args->{'exclude_fields'})
511 10 6 if grep {$field eq $_;} @{$$args{"exclude_fields"};}
516 5 0 $args->{'detail'} ? :
527 1 224 unless $_ ~~ \@fields
545 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)) { }
555 8 162 if $exists and not $f ~~ \@filter_fields
562 2 170 if (defined $$args{"$f.has"})
566 2 170 if (defined $$args{"$f.lacks"})
570 4 168 if $exists and not $f ~~ \@filter_fields
577 3 1032 if (defined $$args{"$f.in"})
581 3 1032 if (defined $$args{"$f.not_in"})
592 2 1033 if (defined $$args{"$f.is"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
600 2 1033 if (defined $$args{"$f.isnt"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
608 7 1028 if (defined $$args{"$f.min"})
612 4 1031 if (defined $$args{"$f.max"})
616 2 1033 if (defined $$args{"$f.xmin"})
620 2 1033 if (defined $$args{"$f.xmax"})
624 22 1013 if $exists and not $f ~~ \@filter_fields
631 1 520 if (defined $$args{"$f.contains"})
635 1 520 if (defined $$args{"$f.not_contains"})
639 1 520 if (defined $$args{"$f.matches"})
643 1 520 if (defined $$args{"$f.not_matches"})
647 4 517 if $exists and not $f ~~ \@filter_fields
654 2 4 unless defined $args->{$cfn}
657 4 0 unless $_ ~~ \@filter_fields
663 2 1375 unless not defined $fspecs->{$_}{'searchable'}
668 11 166 if (defined $q)
669 2 9 if ($opts->{'word_search'}) { }
670 2 0 $cis ? :
672 7 2 $cis ? :
677 176 1 unless ($opts->{'custom_search'})
690 8 169 if (defined $args->{'sort'})
693 1 8 unless $f ~~ \@fields
698 1 0 unless not defined $fspec->{'sortable'} or $fspec->{'sortable'}
699 0 7 $ftype =~ /^(int|float)$/ ? :
701 2 5 $desc ? :
734 549 11387 if (ref $av->{'schema'} and ref $av->{'schema'}[1] and defined $av->{'schema'}[1]{'default'})
739 9 11927 if ($ak =~ /\A(exclude_fields|fields)\z/ and defined $args{$ak})
741 7 2 unless ref $args{$ak} eq "ARRAY"
746 177 2 unless $hooks->{$_}
749 1 1 if ref $hres
756 177 1 unless $hooks->{$_}
759 0 1 if ref $hres
761 3 175 unless $res->[0] == 200
770 174 1 unless $hooks->{$_}
773 0 1 if ref $hres
775 173 2 if (__is_aoa($table_data) or __is_aoh($table_data)) { }
2 0 elsif (ref $table_data eq 'CODE') { }
780 0 2 unless eval {
781 0 2 unless ref $res eq "HASH"
784 0 2 unless __is_aoa($data) or __is_aoh($data)
796 174 1 unless $hooks->{$_}
799 0 1 if ref $hres
811 7 168 if (grep {$_->[1] eq "date";} @{$$query{"filters"};})
816 175 0 if %Data::Sah::Util::Type::Date::
822 218 471 if (ref $r0 eq 'ARRAY') { }
471 0 elsif (ref $r0 eq 'HASH') { }
837 4 685 if $metadata->{'filtered'}
842 0 187 if $ftype eq "cistr"
843 28 159 if ($op eq 'truth') { }
8 151 elsif ($op eq '~~') { }
8 143 elsif ($op eq '!~~') { }
12 131 elsif ($op eq 'in') { }
12 119 elsif ($op eq 'not_in') { }
3 116 elsif ($op eq '==' and $stringy and $cic) { }
5 111 elsif ($op eq '==' and $stringy) { }
4 107 elsif ($op eq '==' and $ftype eq 'date') { }
10 97 elsif ($op eq '==') { }
0 97 elsif ($op eq '!=' and $stringy and $cic) { }
0 97 elsif ($op eq '!=' and $stringy) { }
8 89 elsif ($op eq '!=' and $ftype eq 'date') { }
0 89 elsif ($op eq '!=') { }
0 89 elsif ($op eq '>=' and $stringy and $cic) { }
4 85 elsif ($op eq '>=' and $stringy) { }
4 81 elsif ($op eq '>=' and $ftype eq 'date') { }
18 63 elsif ($op eq '>=') { }
0 63 elsif ($op eq '>' and $stringy and $cic) { }
4 59 elsif ($op eq '>' and $stringy) { }
4 55 elsif ($op eq '>' and $ftype eq 'date') { }
0 55 elsif ($op eq '>') { }
0 55 elsif ($op eq '<=' and $stringy and $cic) { }
4 51 elsif ($op eq '<=' and $stringy) { }
4 47 elsif ($op eq '<=' and $ftype eq 'date') { }
8 39 elsif ($op eq '<=') { }
4 35 elsif ($op eq '<' and $stringy) { }
0 35 elsif ($op eq '<' and $stringy) { }
4 31 elsif ($op eq '<' and $ftype eq 'date') { }
0 31 elsif ($op eq '<') { }
4 27 elsif ($op eq '=~') { }
4 23 elsif ($op eq '!~') { }
0 23 elsif ($op eq 'pos' and $cic) { }
4 19 elsif ($op eq 'pos') { }
0 19 elsif ($op eq '!pos' and $cic) { }
4 15 elsif ($op eq '!pos') { }
15 0 elsif ($op eq 'call') { }
844 14 14 if $r_h->{$f} xor $opn
846 0 8 if ($stringy and $cic) { }
849 0 0 unless lc $_ ~~ \@vals
853 5 5 unless $_ ~~ \@{$$r_h{$f};}
857 0 8 if ($stringy and $cic) { }
860 0 0 if lc $_ ~~ \@vals
864 5 5 if $_ ~~ \@{$$r_h{$f};}
868 0 12 if ($stringy and $cic) { }
870 0 0 unless lc $r_h->{$f} ~~ \@vals
872 5 7 unless $r_h->{$f} ~~ \@$opn
875 0 12 if ($stringy and $cic) { }
877 0 0 if $r_h->{$f} ~~ \@vals
879 6 6 if $r_h->{$f} ~~ \@$opn
882 1 2 unless lc $r_h->{$f} eq lc $opn
884 3 2 unless $r_h->{$f} eq $opn
888 0 4 unless $dopn and $d
889 3 1 unless $d->compare($dopn) == 0
891 6 4 unless $r_h->{$f} == $opn
894 0 0 unless lc $r_h->{$f} ne lc $opn
896 0 0 unless $r_h->{$f} ne $opn
900 4 4 unless $dopn and $d
901 1 3 unless $d->compare($dopn) != 0
903 0 0 unless $r_h->{$f} != $opn
906 0 0 unless lc $r_h->{$f} ge lc $opn
908 1 3 unless $r_h->{$f} ge $opn
912 0 4 unless $dopn and $d
913 2 2 unless $d->compare($dopn) >= 0
915 7 11 unless $r_h->{$f} >= $opn
918 0 0 unless lc $r_h->{$f} gt lc $opn
920 2 2 unless $r_h->{$f} gt $opn
924 0 4 unless $dopn and $d
925 3 1 unless $d->compare($dopn) > 0
927 0 0 unless $r_h->{$f} > $opn
930 0 0 unless lc $r_h->{$f} le lc $opn
932 2 2 unless $r_h->{$f} le $opn
936 0 4 unless $dopn and $d
937 1 3 unless $d->compare($dopn) <= 0
939 3 5 unless $r_h->{$f} <= $opn
942 3 1 unless lc $r_h->{$f} lt lc $opn
944 0 0 unless $r_h->{$f} lt $opn
948 0 4 unless $dopn and $d
949 2 2 unless $d->compare($dopn) < 0
951 0 0 unless $r_h->{$f} < $opn
955 1 3 unless $r_h->{$f} =~ /$opn/
959 3 1 if $r_h->{$f} =~ /$opn/
962 0 0 unless index(lc $r_h->{$f}, lc $opn) >= 0
964 1 3 unless index($r_h->{$f}, $opn) >= 0
967 0 0 if index(lc $r_h->{$f}, lc $opn) >= 0
969 3 1 if index($r_h->{$f}, $opn) >= 0
972 6 9 unless $opn->[0]->($r_h, $opn->[1])
979 40 552 if (defined $q)
980 4 36 if ($opts->{'custom_search'}) { }
982 2 2 unless $opts->{'custom_search'}->($r_h, $q, $query->{'search_opts'})
986 6 66 if ($r_h->{$f} =~ /$search_re/i)
993 3 27 if ($el =~ /$search_re/i)
998 27 9 unless $match
1008 0 175 if ($metadata->{'sorted'}) { }
100 75 elsif ($query->{'random'}) { }
6 69 elsif (@{$query->{'sorts'};}) { }
1017 31 0 if ($op eq 'cmp') { }
1023 29 2 if $x != 0
1035 175 0 unless ($metadata->{'paged'})
1036 1 174 if ($query->{'result_start'} > 1)
1039 4 171 if (defined $query->{'result_limit'})
1047 0 175 if $metadata->{'fields_selected'}
1050 510 4 unless ($args{'detail'} or $args{'fields'} or $args{'exclude_fields'})
1054 36 14 if ($args{'with_field_names'}) { }
1058 92 196 unless $_ ~~ \@{$$query{"requested_fields"};}
1073 174 1 unless $hooks->{$_}
1076 0 1 if ref $hres
1478 0 38 unless $fqname
1480 0 38 if ($fqname =~ /(.+)::(.+)/) { }
1489 0 38 unless my $table_data = $args{'table_data'}
1490 0 16 unless __is_aoa($table_data) or __is_aoh($table_data) or ref $table_data eq "CODE"
1494 0 38 unless my $table_spec = $args{'table_spec'}
1495 0 38 unless ref $table_spec eq "HASH"
1498 1 37 unless $table_spec->{'fields'}
1499 0 37 unless ref $table_spec->{'fields'} eq "HASH"
1502 2 35 unless $table_spec->{'pk'}
1503 1 34 unless exists $table_spec->{'fields'}{$table_spec->{'pk'}}
1567 0 34 unless $res->[0] == 200
1571 0 34 unless $res->[0] == 200
1574 0 34 if ($args{'install'} // 1)