Branch Coverage

blib/lib/Chess4p/Board.pm
Criterion Covered Total %
branch 339 380 89.2


line true false branch
126 187 1477 if ($bb & $mask) { }
132 208 1456 if ($mask & $bb_file_h) { }
136 182 26 unless $sqr == 7
149 833 44036 if $done
152 833 43203 if $subset == 0
174 32376 222858 unless $s >= 0 and $s < 64
175 23400 199458 if _square_distance($s, $s - $delta) > 2
177 81570 117888 if $occupied & ~$bb_squares[$s]
250 2800 17680 if ($BB_DIAG_ATTACKS->[$a]{'0'} & $bb_b) { }
2240 15440 elsif ($BB_RANK_ATTACKS->[$a]{'0'} & $bb_b) { }
2240 13200 elsif ($BB_FILE_ATTACKS->[$a]{'0'} & $bb_b) { }
285 27 277 if $x == 0
288 127 150 if $x >> 32
289 120 157 if $x >> 16
290 126 151 if $x >> 8
291 199 78 if $x >> 4
292 105 172 if $x >> 2
293 88 189 if $x >> 1
323 14 46 unless ($pos->{'bb'}{'6'} & ~$bb_squares[4])
326 14 46 unless ($pos->{'bb'}{'12'} & ~$bb_squares[60])
337 10 2 unless $pos->{'ep_square'}
342 1 1 if ($pos->{'to_move'} eq 'w') { }
353 0 2 if (_square_rank($pos->{'ep_square'}) != $ep_rank)
357 0 2 if ($pos->{'to_move'} eq "w" and not $pos->{'bb'}{'7'} & $pawn_mask)
360 0 2 if ($pos->{'to_move'} eq "b" and not $pos->{'bb'}{'1'} & $pawn_mask)
364 2 0 if ($pos->{'bb'}{'all'} & $bb_squares[$pos->{'ep_square'}])
368 0 0 if ($pos->{'bb'}{'all'} & $seventh_rank_mask)
384 1619 877 if $pc == 0
402 0 3212 if $bb == 0
424 3 86 if $bb == 0
431 15 71 if ($lsb % 2 != 0)
435 532 2448 if ($lsb % 2 != 0)
444 3 0 $pos->{'to_move'} eq 'w' ? :
448 6 1 $_[0]{'to_move'} eq 'w' ? :
462 821 27595 if ($pcs == $pos->{'table'}[$i])
478 0 37 if ($bb_size != $tb_size)
486 0 821 if (not exists $h_bb{$key}) { }
0 821 elsif ($h_table{$key} != $h_bb{$key}) { }
502 78 144 $side eq 'w' ? :
503 78 144 $side eq 'w' ? :
504 78 144 if $side eq "w"
505 144 78 if $side eq "b"
513 78 144 $side eq 'w' ? :
514 78 144 $side eq 'w' ? :
529 42 33 $pos->{'to_move'} eq 'w' ? :
530 5 70 if ($pos->_get_attackers($side, $sq, $occupied))
544 38 19 $side eq 'w' ? :
545 38 19 $side eq 'w' ? :
548 12 45 unless $king
560 30 30 $q_side ? :
561 30 30 $q_side ? :
565 21 3 unless (($king ^ $rook ^ $pos->{'bb'}{'all'}) & ($king_path | $rook_path | $king_to | $rook_to) or $pos->_attacked_for_king($king_path | $king, $king ^ $pos->{'bb'}{'all'}) or $pos->_attacked_for_king($king_to, $king ^ $rook ^ $rook_to ^ $pos->{'bb'}{'all'}))
569 11 10 if ($from == 4 and $pos->{'bb'}{'6'} & $bb_e1) { }
10 0 elsif ($from == 60 and $pos->{'bb'}{'12'} & $bb_e8) { }
570 7 4 if $candi == 7
571 4 7 if $candi == 0
574 7 3 if $candi == 63
575 3 7 if $candi == 56
588 0 7 unless $pos->{'ep_square'}
590 6 1 $pos->{'to_move'} eq 'w' ? :
596 6 1 if ($pos->{'to_move'} eq 'w') { }
602 2 5 if $BB_RANK_ATTACKS->[$king]{$occupancy & $BB_RANK_MASKS->[$king]} & $horizontal_attackers
608 4 1 if ($pos->{'to_move'} eq 'w') { }
614 0 5 if $BB_DIAG_ATTACKS->[$king]{$occupancy & $BB_DIAG_MASKS->[$king]} & $diagonal_attackers
622 719 116 unless $pos->{'ep_square'}
637 7 1 $side eq 'w' ? :
639 0 8 unless $king
642 7 1 $side eq 'w' ? :
643 7 1 $side eq 'w' ? :
652 8 14 if ($rays & $square_mask)
653 7 1 $side eq 'w' ? :
658 1 2 if $mask == $square_mask
670 117 834 if ($from == $king) { }
7 827 elsif ($pos->_is_ep_move('Chess4p::Move'->new($from, $to))) { }
672 83 34 $pos->{'to_move'} eq 'w' ? :
673 16 101 if _square_distance($from, $to) > 1
674 88 13 if $pos->_get_attackers($opponent, $to) == $bb_empty
682 786 41 unless $blockers & ~$bb_squares[$from]
683 7 34 if _ray($from, $to) & ~$bb_squares[$king]
692 4 1 $pos->{'to_move'} eq 'w' ? :
693 2 3 unless $touched & $pawns
700 74 6 defined $_ ? :
716 5 5 if $pos->{'stack'}
719 5 5 if $pos->{'move_stack'}
754 1 37 if (not defined $fen) { }
771 1 36 if ($#rows != 7)
781 36 1 if (defined $parts[2])
782 24 12 if $parts[2] =~ /K/u
783 24 12 if $parts[2] =~ /Q/u
784 23 13 if $parts[2] =~ /k/u
785 25 11 if $parts[2] =~ /q/u
788 36 1 if (defined $parts[2])
789 29 7 if ($parts[3] eq '-') { }
803 384 845 if ($items[$col] =~ /(\d+)/u) { }
833 10 10 if ($_[1] eq 'w') { }
842 10 10 if ($_[1] eq 'w') { }
870 1258 662 if ($pos->{'table'}[$i] == 0) { }
875 1680 240 if ($col < 7)
879 210 30 if ($row > 0)
892 268 116 if ($pcs eq '.') { }
896 5 111 if ($empties)
902 48 336 if (~$bb_squares[$sqr] & $bb_file_h)
903 34 14 if ($empties)
907 42 6 unless $sqr == 7
911 4 2 $pos->kingside_castling_right('w') ? :
4 2 $pos->queenside_castling_right('w') ? :
4 2 $pos->kingside_castling_right('b') ? :
4 2 $pos->queenside_castling_right('b') ? :
917 2 4 unless $castling
920 1 5 unless $ep eq "-"
940 6 1 if ($pcs <= 6) { }
953 8 11 if $pcs == 0
963 8 3 if ($pcs <= 6) { }
978 2 17 if ($pos->{'bb'}{'6'} == 0)
981 0 17 if ($pos->{'bb'}{'12'} == 0)
984 1 16 if ($pos->_bb_count_1s(6) > 1)
987 1 15 if ($pos->_bb_count_1s(12) > 1)
990 1 14 if ($pos->_bb_count_1s(1) > 8)
993 0 14 if ($pos->_bb_count_1s(7) > 8)
996 1 13 if ($pos->_bb_count_1s("White") > 16)
999 0 13 if ($pos->_bb_count_1s("Black") > 16)
1002 1 12 if (($pos->{'bb'}{'1'} | $pos->{'bb'}{'7'}) & ($bb_rank_1 | $bb_rank_8))
1009 2 10 if ($pos->{'ep_square'})
1010 2 0 if (not defined $valid_ep_sqr or $valid_ep_sqr != $pos->{'ep_square'})
1015 2 8 if ($pos->{'castling_rights'} != $pos->_clean_castling_rights)
1033 12 45 if ($pos->{'ep_square'})
1034 12 0 if ($bb_squares[$pos->{'ep_square'}] & ~$pos->{'bb'}{'all'})
1037 10 2 $pos->{'to_move'} eq 'w' ? :
1040 38 19 $pos->{'to_move'} eq 'w' ? :
1043 52 5 if ($pawn_capturers)
1045 33 19 $pos->{'to_move'} eq 'w' ? :
1054 38 19 if ($pos->{'to_move'} eq 'w') { }
1070 38 19 $pos->{'to_move'} eq 'w' ? :
1077 42 1213 if ($promo_index > 0 and $promo_index < 4)
1079 14 28 if $promo_index == 4
1082 9 1204 if ($ep_capturers)
1090 128 103 $pos->{'to_move'} eq 'w' ? :
1094 28 1176 if ($pawn_capturers or $targets)
1097 10 18 if ($rk == 0 or $rk == 7) { }
1106 173 1003 if ($single_moves)
1108 94 79 $pos->{'to_move'} eq 'w' ? :
1110 4 169 if ($rk == 0 or $rk == 7) { }
1118 130 873 if ($double_moves)
1120 73 57 $pos->{'to_move'} eq 'w' ? :
1125 289 669 unless ($attack_bits)
1128 72 217 if ($pcs == 2 or $pcs == 8) { }
35 182 elsif ($pcs == 6 or $pcs == 12) { }
68 114 elsif ($pcs == 3 or $pcs == 9) { }
77 37 elsif ($pcs == 4 or $pcs == 10) { }
37 0 elsif ($pcs == 5 or $pcs == 11) { }
1146 287 249 $pos->{'to_move'} eq 'w' ? :
805 477 if ($pos->{'table'}[$to] == 0 or $pos->{'to_move'} eq "w" ? $pos->{'table'}[$to] >= 7 : $pos->{'table'}[$to] < 7)
1153 21 47 if (my $any = pop @castling_moves)
1167 11 26 if (~$bb_squares[$one_checker] == $checkers)
1173 11 26 if ($target)
1181 24 13 $pos->{'to_move'} eq 'w' ? :
1190 32 0 if ($target)
1201 25 12 $pos->{'to_move'} eq 'w' ? :
1202 12 25 $opponent eq 'w' ? :
1203 12 25 $opponent eq 'w' ? :
1204 12 25 $opponent eq 'w' ? :
1205 12 25 $opponent eq 'w' ? :
1215 9 12 if ($bb and ~$bb_squares[_msb($bb)] == $bb)
1228 24 12 $side eq 'w' ? :
1229 24 12 $side eq 'w' ? :
1236 55 883 if ($checkers) { }
1238 45 6 if ($pos->_is_safe($king, $blockers, $m->{'from'}, $m->{'to'}))
1245 857 42 if ($pos->_is_safe($king, $blockers, $m->{'from'}, $m->{'to'}))
1269 0 0 if length $move > 4
1310 1 4 if $pos->{'to_move'} eq "b"
1311 0 5 unless ($move)
1313 0 0 $pos->{'to_move'} eq 'w' ? :
1317 5 0 if $pos->_is_zeroing($move)
1322 0 5 unless $pcs
1330 2 3 if ($pcs == 6 or $pcs == 12)
1331 2 0 if $pos->{'to_move'} eq "w"
1332 0 2 if $pos->{'to_move'} eq "b"
1335 3 2 if ($pcs == 1 or $pcs == 7)
1337 0 3 if ($diff == 16 and _square_rank($move->from) == 1) { }
0 3 elsif ($diff == -16 and _square_rank($move->from) == 6) { }
1 2 elsif (defined $ep_square and $move->to == $ep_square and $captured_pcs eq '.' and abs $diff == 7 || abs $diff == 9) { }
1345 1 0 $pos->{'to_move'} eq 'w' ? :
1350 2 3 if ($move->promotion)
1352 1 1 if ($pos->{'to_move'} eq 'w') { }
1361 1 4 if ($castling) { }
1369 0 1 if ($a_side) { }
1370 0 0 if $pos->{'to_move'} eq "w"
1371 0 0 if $pos->{'to_move'} eq "b"
1374 1 0 if $pos->{'to_move'} eq "w"
1375 0 1 if $pos->{'to_move'} eq "b"