Branch Coverage

blib/lib/Games/Sudoku/General.pm
Criterion Covered Total %
branch 224 428 52.3


line true false branch
633 0 2 if ref $class
640 0 2 if @args
641 2 0 unless $self->{'cell'}
643 0 2 unless $self->{'symbol_list'}
645 0 2 unless defined $self->{'columns'}
647 2 0 unless defined $self->{'status_value'}
649 2 0 unless defined $self->{'max_tuple'}
666 0 21 if $self->{'set'}{$name}
670 0 184 unless $self->{'cell'}[$inx]
676 0 184 unless @{$cell->{'membership'};}
713 0 6 unless $self->{'constraints_used'} and defined wantarray
714 0 6 if wantarray
736 0 1 unless $copier ||= eval { do { require Clipboard; "Clipboard"->import; sub { "Clipboard"->copy(join("", @_)); return; } } }
761 0 1 unless $self->{'set'}{$name}
768 8 4 if ($other ne $name)
774 4 0 if (@mbr) { }
870 0 0 if ref $const and "HASH" ne ref $const
874 0 0 if ($_)
0 0 unless "HASH" eq ref $const
878 0 0 if ($self->{'debug'})
885 0 0 if $min > $size
894 0 0 $self->{'cells_unused'} ? :
904 0 0 unless my(@pos) = grep({not $cell->{'possible'}{$_};} 1 .. $syms)
906 0 0 unless defined $val
911 0 0 if $self->_try($cell, $val)
916 0 0 unless $self->solution
920 0 0 if $self->{'autocopy'}
962 21 0 unless wantarray
964 0 21 unless exists $accessor{$name}
969 0 21 wantarray ? :
980 27 27 if $self->{'allowed_symbols'}{$_}[$val]
997 0 583 unless join ",", @{$_->{'membership'};}
999 522 61 if (--$col > 0) { }
1004 8 53 if (--$row <= 0)
1033 0 1 unless $paster ||= eval { do { require Clipboard; "Clipboard"->import; return sub { return "Clipboard"->paste; } } }
1084 0 19 unless $val =~ /\S/
1085 17 2 unless $self->{'biggest_spec'} > 1
1088 0 19 if $self->{'debug'}
1093 0 19 if $self->{'largest_set'} >= @{$self->{'symbol_list'};}
1114 2 17 $self->{'biggest_spec'} > 1 ? :
1115 0 1651 if $inx >= $max
1118 0 1651 unless defined $_
1121 0 1651 if ($self->{'cells_unused'} and not @{$self->{'cell'}[$inx]{'membership'};})
1122 195 1456 if ($self->{'allowed_symbols'}{$_})
1123 0 195 if $self->{'debug'} > 1
1127 0 195 unless @{$cell->{'membership'};}
1131 943 749 if $self->{'allowed_symbols'}{$_}[$val]
1135 365 1286 unless defined $hash->{$_}
1137 0 1651 unless @{$self->{'cell'}[$inx]{'membership'};} or $_ eq $self->{'symbol_list'}[0]
1141 0 1651 if $self->{'debug'} > 1
1144 0 1651 if $self->_try($inx, $hash->{$_})
1149 480 1171 $hash->{$_} ? :
1154 0 19 unless ($inx == $max)
1156 0 0 if ($self->{'cells_unused'})
1168 0 19 if $self->{'debug'}
1176 0 19 if $self->{'debug'} > 1
1229 0 90 unless exists $mutator{$name}
1240 0 4 unless defined $value
1242 0 4 if $self->{'debug'}
1245 4 0 if ($value) { }
1248 0 22 if $self->{'symbol_hash'}{$name}
1252 2 20 unless ($value)
1254 0 20 if $self->{'debug'} > 1
1260 0 93 if $self->{'debug'} > 1
1263 0 93 unless $self->{'symbol_hash'}{$_}
1272 1 3 if $maxlen > $self->{'biggest_spec'}
1278 5 1 ref $value ? :
1279 0 6 if defined $size
1282 0 6 if $size % $horiz or $size % $vert
1364 2 0 if ($type =~ /\D/) { }
1365 0 2 unless $cube{$type}
1417 0 0 ref $value ? :
1428 0 0 if defined $columns
1429 0 0 if defined $rows
1435 0 23 unless _looks_like_number($value)
1445 0 0 ref $value ? :
1446 0 0 if $order =~ /\D/
1449 0 0 if (defined $gap) { }
1450 0 0 if $gap =~ /\D/
1453 0 0 if $gap > $order - 2
1456 0 0 unless $gap % 2 == $order % 2
1500 0 0 unless $sqgened[$o1]++
1509 0 21 unless _looks_like_number($value)
1512 0 21 if $value < 0 or $value >= @status_values
1548 0 142 unless defined $_
1549 0 142 if /,/
1552 0 142 if exists $hsh{$_}
1591 0 938 unless @{$cell->{'membership'};}
1621 0 19 unless $self->{'backtrack_stack'}
1626 0 19 if $self->{'debug'}
1686 1 0 defined wantarray ? :
0 1 wantarray ? :
1728 0 19 if $self->{'iteration_limit'} > 0
1731 0 19 if $self->{'no_more_solutions'}
1733 1 18 if (@{$self->{'backtrack_stack'};})
1734 1 0 if $self->_constraint_remove
1738 0 18 unless ($self->{'cells_unassigned'})
1749 0 693 if @{$self->{'cell'};} != $number_of_cells
1756 0 693 unless my $rslt = $self->$method
1757 332 361 unless @$rslt
1759 1151 0 if (ref $constr) { }
1763 0 0 unless my $rslt = $self->_constraint_remove
1769 18 343 unless $self->{'cells_unassigned'}
1798 35865 30695 if $cell->{'content'}
1799 0 30695 unless @{$cell->{'membership'};}
1801 110294 276989 unless $_
1802 29838 857 if ($pos > 1) { }
857 0 elsif ($pos == 1) { }
1806 3966 857 if $cell->{'possible'}{$_}
1810 0 857 if $self->_try($cell, $val)
1815 0 857 if $self->{'debug'}
1818 18 839 unless ($self->{'cells_unassigned'})
1820 0 0 if $self->{'debug'}
1823 0 0 if ($self->{'debug'} > 1)
1846 25726 25529 if $cell->{'content'}
1850 245121 101572 if $count
1857 43051 262 unless $suppliers[$val] and @{$suppliers[$val];} == 1
1859 0 0 $self->{'debug'} ? :
0 262 if $self->_try($inx, $val)
1869 0 262 if $self->{'debug'}
1890 2634 1414 unless @$cells > 1
1894 2376 2942 if $self->{'cell'}[$inx]{'content'}
1900 12059 31699 unless $imposs
1910 5884 34672 if $int_cells{$inx}
1911 17939 16733 if $self->{'cell'}[$inx]{'content'}
1915 36785 32972 if not $imposs and $int_supplies[$val]
1921 9067 6896 unless $int_supplies[$val]
1923 6870 26 unless @occurs_in and @occurs_in < @set_names
1927 73 68 if $self->{'cell'}[$inx]{'possible'}{$val}
1933 0 26 unless $done
1936 0 26 if $self->{'debug'}
1974 19 187 unless my(@open) = grep({not $_->{'content'};} map({$self->{'cell'}[$_];} @{$$set{"membership"};}))
1980 12142 4457 if $cell->{'possible'}{$val}
1985 1079 1212 unless $_
1992 12 40 unless $tuple[$inx]
1997 0 40 unless @{$tuple[$inx];}
2013 0 38 unless $tuple[@$open]
2021 27499 10775 if $cell->{'possible'}{$val}
2025 10394 8620 unless $_
2042 7 1221 if ($discrete == $order) { }
1221 0 elsif ($discrete > $order) { }
2044 49 4 unless $tcontr[$val] and $contributed->[$val] > $tcontr[$val]
2050 2 2 unless @tuple_member
2054 12 6 if $tuple_member[$inx] or $open->[$inx]{'possible'}{$val}
2059 4 0 if @ccl
2072 45 17688 if $tcontr[$val] and $contributed->[$val] == $tcontr[$val]
2075 1217 4 unless $within >= $order
2079 36 11 unless $tcontr[$val] and $contributed->[$val] > $tcontr[$val]
2084 65 13 unless $tuple_member[$inx] and not $open->[$inx]{'possible'}{$val}
2092 11 0 if @ccl
2096 5 6 unless $constraint
2098 0 6 if $self->{'debug'}
2116 0 0 if $cell->{'content'}
2117 0 0 unless @{$cell->{'membership'};}
2120 0 0 unless $cell->{'possible'}{$val}
2122 0 0 unless $possible
2126 0 0 unless $Games::Sudoku::General::a->[1] <=> $Games::Sudoku::General::b->[1]
2129 0 0 if $cell->{'possible'}{$val}
2130 0 0 if $self->_try($cell, $val)
2136 0 0 if $self->{'debug'}
2163 0 1 if $min
2164 0 1 if $max
2165 0 1 if $self->{'no_more_solutions'}
2166 0 1 unless my $stack = $self->{'backtrack_stack'}
2170 0 1 if $self->{'debug'} and $inx
2175 0 45 if ($min and $self->{'cells_unassigned'} >= $min)
2176 0 0 if $self->{'debug'}
2182 0 45 if ($removal_ok) { }
2185 0 0 if $max and $self->{'cells_unassigned'} <= $max and not exists $removal_ok->{$constraint}
2187 0 0 if (not exists $removal_ok->{$constraint}) { }
0 0 elsif (defined $removal_ok->{$constraint} and --$removal_ok->{$constraint}) { }
2188 0 0 if $self->{'debug'}
2194 0 0 if $self->{'debug'}
2200 0 0 if $max and $self->{'cells_unassigned'} <= $max and $constraint eq "?"
2205 45 0 if ($constraint eq 'F' or $constraint eq 'N') { }
0 0 elsif ($constraint eq 'B' or $constraint eq 'T') { }
0 0 elsif ($constraint eq '?') { }
2207 45 45 if ref $ref
2211 0 0 unless ref $ref
2221 0 0 if $removal_ok
2223 0 0 if $cell->{'possible'}{$val}
2224 0 0 if $self->_try($cell, $val)
2231 0 0 if ($self->{'debug'})
2249 0 1 if $self->{'debug'}
2277 0 0 unless my $info = $deprecate{$name}
2280 0 0 unless $info->{'level'}
2282 0 0 if $info->{'level'} >= 3
2284 0 0 if warnings::enabled("deprecated")
2286 0 0 if $info->{'level'} == 1
2300 0 104 unless $_
2306 0 52 ref $_->[0] ? :
0 52 ref $_->[1] ? :
52 52 ref $_ ? :
2323 0 44 if not defined $_ or ref $_
2324 44 0 if /^[+-]?\d+$/
2341 1958 857 unless ref $cell
2342 0 2815 unless defined $new
2345 0 2815 unless defined(my $old = $cell->{'content'})
2348 1171 1644 if $old == $new
2349 1599 45 if ($new)
2351 0 4833 if $self->{'set'}{$set}{'content'}[$new]
2355 45 1599 if $old
2356 1599 45 if $new
2360 135 4833 if ($old)
2367 4833 135 if ($new)
2376 0 2815 if $@
2390 5 18 unless defined $prefix
2391 19 4 if (@args)
2393 1 18 if $args[0]
2400 220 1674 if $col == $self->{'columns'}
2404 0 1894 $self->{'cells_unused'} && !@{$_->{'membership'};} ? :
2405 1674 220 if (--$col > 0) { }
2409 0 220 if $self->{'cells_unused'}
2412 29 191 if (--$row <= 0)