Add test for pins
This commit is contained in:
parent
908cc1cfda
commit
be247e1f46
|
@ -294,7 +294,6 @@ func (b *Board) Move(move string) error {
|
|||
// TODO: parse ambiguous captures for all pieces
|
||||
// TODO: parse checkmates e.g. e5#
|
||||
// TODO: parse O-O as kingside castle and O-O-O as queenside castle
|
||||
// TODO: make sure pinned pieces cannot move
|
||||
|
||||
move_ := func() error {
|
||||
|
||||
|
|
|
@ -472,6 +472,16 @@ func TestBoardCheck(t *testing.T) {
|
|||
assertParse(t, b, "Kxf7")
|
||||
}
|
||||
|
||||
func TestBoardPin(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
b := chess.NewBoard()
|
||||
|
||||
assertParse(t, b, "d4 e5 Nc3 Bb4")
|
||||
|
||||
assertMoveError(t, b, "Ne4", "invalid move Ne4: king is in check")
|
||||
}
|
||||
|
||||
func assertParse(t *testing.T, b *chess.Board, moves string) {
|
||||
assert.NoError(t, b.Parse(moves))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue