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 716 if @{$self->{'cell'};} != $number_of_cells
1756 0 716 unless my $rslt = $self->$method
1757 346 370 unless @$rslt
1759 1155 0 if (ref $constr) { }
1763 0 0 unless my $rslt = $self->_constraint_remove
1769 18 352 unless $self->{'cells_unassigned'}
1798 37577 31870 if $cell->{'content'}
1799 0 31870 unless @{$cell->{'membership'};}
1801 113821 290302 unless $_
1802 31017 853 if ($pos > 1) { }
853 0 elsif ($pos == 1) { }
1806 3988 853 if $cell->{'possible'}{$_}
1810 0 853 if $self->_try($cell, $val)
1815 0 853 if $self->{'debug'}
1818 18 835 unless ($self->{'cells_unassigned'})
1820 0 0 if $self->{'debug'}
1823 0 0 if ($self->{'debug'} > 1)
1846 25990 26229 if $cell->{'content'}
1850 252003 102896 if $count
1857 43357 266 unless $suppliers[$val] and @{$suppliers[$val];} == 1
1859 0 0 $self->{'debug'} ? :
0 266 if $self->_try($inx, $val)
1869 0 266 if $self->{'debug'}
1890 4100 2089 unless @$cells > 1
1894 3647 4254 if $self->{'cell'}[$inx]{'content'}
1900 17340 46242 unless $imposs
1910 8508 51974 if $int_cells{$inx}
1911 27417 24557 if $self->{'cell'}[$inx]{'content'}
1915 52243 47368 if not $imposs and $int_supplies[$val]
1921 13343 9989 unless $int_supplies[$val]
1923 9961 28 unless @occurs_in and @occurs_in < @set_names
1927 79 72 if $self->{'cell'}[$inx]{'possible'}{$val}
1933 0 28 unless $done
1936 0 28 if $self->{'debug'}
1974 21 281 unless my(@open) = grep({not $_->{'content'};} map({$self->{'cell'}[$_];} @{$$set{'membership'};}))
1980 21922 7685 if $cell->{'possible'}{$val}
1985 1789 2025 unless $_
1992 19 60 unless $tuple[$inx]
1997 0 60 unless @{$tuple[$inx];}
2013 0 87 unless $tuple[@$open]
2021 27213 10581 if $cell->{'possible'}{$val}
2025 10396 8238 unless $_
2042 22 1310 if ($discrete == $order) { }
1310 0 elsif ($discrete > $order) { }
2044 157 5 unless $tcontr[$val] and $contributed->[$val] > $tcontr[$val]
2050 3 2 unless @tuple_member
2054 16 7 if $tuple_member[$inx] or $open->[$inx]{'possible'}{$val}
2059 5 0 if @ccl
2072 108 17032 if $tcontr[$val] and $contributed->[$val] == $tcontr[$val]
2075 1305 5 unless $within >= $order
2079 40 14 unless $tcontr[$val] and $contributed->[$val] > $tcontr[$val]
2084 81 16 unless $tuple_member[$inx] and not $open->[$inx]{'possible'}{$val}
2092 14 0 if @ccl
2096 19 8 unless $constraint
2098 0 8 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 1962 853 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)