Branch Coverage

blib/lib/Chess/Rep.pm
Criterion Covered Total %
branch 129 238 54.2


line true false branch
270 74 69 if ($id) { }
69 0 elsif ($p =~ /[1-8]/) { }
280 1 6 if index($castle, 'K') >= 0
281 1 6 if index($castle, 'Q') >= 0
282 1 6 if index($castle, 'k') >= 0
283 1 6 if index($castle, 'q') >= 0
285 1 6 if (lc $to_move eq 'w') { }
6 0 elsif (lc $to_move eq 'b') { }
292 0 7 $enpa ne '-' ? :
312 0 0 if ($p) { }
313 0 0 $p & 128 ? :
314 0 0 if $empty
322 0 0 if $empty
328 0 0 $$self{'to_move'} ? :
331 0 0 if $castle & 1
332 0 0 if $castle & 2
333 0 0 if $castle & 4
334 0 0 if $castle & 8
336 0 0 $$self{'enpa'} ? :
337 0 0 unless ($short)
445 0 0 if ($p =~ /^[pnbrqk]$/i)
448 0 0 if ($index =~ /^[a-h]/io)
496 0 6 if (defined $col) { }
6 0 elsif ($index =~ /^[a-h]/io) { }
502 6 0 if wantarray
533 0 0 if (@_)
534 0 0 $_[0] ? :
587 0 6 if (index($move, 'O-O-O') == 0) { }
0 6 elsif (index($move, 'O-O') == 0) { }
588 0 0 $color ? :
590 0 0 $color ? :
593 0 6 if ($move =~ s/^([PNBRQK])//)
597 6 0 if ($move =~ s/^([a-h][1-8])[:x-]?([a-h][1-8])//i) { }
0 0 elsif ($move =~ s/^([a-h])[:x-]?([a-h][1-8])//i) { }
0 0 elsif ($move =~ s/^([1-8])[:x-]?([a-h][1-8])//i) { }
0 0 elsif ($move =~ s/^[:x-]?([a-h][1-8])//i) { }
621 0 6 if ($move =~ s/^=?([RNBQ])//i)
625 0 6 if ($piece) { }
628 0 6 if (not $from) { }
632 0 6 unless ($piece)
640 0 6 unless ($to)
649 0 6 unless ($tpmove and @$tpmove)
653 0 6 if (not $from) { }
655 0 0 if (@$tpmove == 1) { }
661 0 0 if (defined $row and $row == $t_row) { }
0 0 elsif (defined $col and $col == $t_col) { }
670 0 0 if (defined $from_index) { }
676 0 6 unless defined $from_index and grep(($_ == $from_index), @$tpmove)
680 0 6 unless (defined $from_index)
701 0 6 if ($piece & 4)
702 0 0 if ($from_index == 4 and $to_index == 6) { }
0 0 elsif ($from_index == 116 and $to_index == 118) { }
0 0 elsif ($from_index == 4 and $to_index == 2) { }
0 0 elsif ($from_index == 116 and $to_index == 114) { }
726 2 4 if ($is_pawn)
727 0 2 if ($from_col != $to_col and $prev_enpa and $prev_enpa == $to_index)
732 0 2 if (abs $from_row - $to_row == 2)
740 0 6 if ($promote)
748 6 0 if ($$self{'to_move'})
752 4 2 if (not $is_pawn || $is_capture) { }
760 6 0 unless ($san)
761 2 4 $is_pawn ? :
762 2 4 if $is_pawn and $is_capture
766 6 6 if ($origin != $from_index)
773 4 2 if ($ambiguous and not $is_pawn && $is_capture)
774 1 3 if ($rank_ambiguous and $file_ambiguous) { }
777 1 2 if ($file_ambiguous) { }
784 2 4 if ($is_capture)
788 0 6 if $promote
792 0 6 if ($$status{'mate'}) { }
0 6 elsif ($$status{'check'}) { }
818 0 6 if ($p & 4)
819 0 0 if ($p & 128) { }
827 0 6 if ($from == 0 or $to == 0)
830 0 6 if ($from == 112 or $to == 112)
833 0 6 if ($from == 7 or $to == 7)
836 0 6 if ($from == 119 or $to == 119)
862 114 718 if ($p)
863 56 58 if (($p & 128) == $$self{'to_move'})
868 13 43 if ($p & 4)
877 13 0 if (defined $king)
890 56 0 if (defined $king) { }
896 28 266 $is_king ? :
951 43 307 unless defined $opponent_color
956 5498 8015 if $i & 136
960 6564 1451 if ($try_move) { }
962 155 6409 if ($i == $from) { }
106 6303 elsif ($i == $to) { }
0 6303 elsif ($$self{'enpa'} and $piece & 1 and $to == $$self{'enpa'} and $i == ($from & 112 | $to & 7)) { }
979 5 1356 if ($p and $p & $type and ($p & 128) == $opponent_color)
989 239 111 if ($opponent_color) { }
1026 5 345 $@ ? :
1040 162 385 if $to & 136
1047 5 380 if ($p & 4 and $self->is_attacked($to))
1051 316 64 unless ($what)
1052 62 254 if ($p & 1)
1053 29 33 if (abs(($from & 7) - ($to & 7)) == 1)
1054 0 29 if ($$self{'enpa'} and $to == $$self{'enpa'})
1065 7 57 if (($what & 128) != $color)
1066 0 7 if ($p & 1 and ($from & 7) == ($to & 7))
1081 13 7 $color ? :
1082 13 7 $color ? :
1083 14 6 if (defined $self->_add_if_valid($moves, $index, $index + $step) and $not_moved)
1086 13 7 $color ? :
1087 13 7 $color ? :
1107 3 121 if $self->get_piece_at_index($i)
1119 1 96 if $self->get_piece_at_index($i)
1139 28 76 if (defined $self->_add_if_valid($moves, $index, $index + $step))
1140 0 28 if ($step == 1 and not $$self{'in_check'} and $self->can_castle($color, 0) and not $self->get_piece_at_index($index + 1) and not $self->get_piece_at_index($index + 2)) { }
0 28 elsif ($step == -1 and not $$self{'in_check'} and $self->can_castle($color, 1) and not $self->get_piece_at_index($index - 1) and not $self->get_piece_at_index($index - 2) and not $self->get_piece_at_index($index - 3)) { }
1169 6 5 if ($color) { }
1170 0 6 $ooo ? :
1172 0 5 $ooo ? :
1187 0 0 if (defined $$self{'has_castled'})
1188 0 0 if ($color) { }
1214 0 0 if ref $p
1235 12 0 unless defined $col
1265 0 0 unless defined $col
1282 12 12 if ($id =~ /^[a-h]/io) { }