-
Notifications
You must be signed in to change notification settings - Fork 18
/
board_bishop_test.go
30 lines (26 loc) · 967 Bytes
/
board_bishop_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package pgn
import (
. "gopkg.in/check.v1"
)
func (s *BoardSuite) TestBoardMoveFromAlgebraicBlackBishop(c *C) {
b, err := NewBoardFEN("rnbqkbnr/ppp1pppp/8/3p4/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 2")
c.Assert(err, IsNil)
move, err := b.MoveFromAlgebraic("Bg4", Black)
c.Assert(err, IsNil)
c.Assert(move.From, Equals, C8)
c.Assert(move.To, Equals, G4)
}
func (s *BoardSuite) TestBoardMoveFromAlgebraicBlackBishopBad(c *C) {
b, err := NewBoardFEN("rnbqkbnr/ppp1pppp/8/3p4/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 2")
c.Assert(err, IsNil)
move, err := b.MoveFromAlgebraic("Bg5", Black)
c.Assert(err, Equals, ErrAttackerNotFound)
c.Assert(move, Equals, NilMove)
}
func (s *BoardSuite) TestBoardMoveFromAlgebraicBlackBishopAmbiguous(c *C) {
b, err := NewBoardFEN("r5nr/p2k2pp/5p2/3b4/P7/b1B5/5PPP/2b2K1R b - - 6 26")
c.Assert(err, IsNil)
move, err := b.MoveFromAlgebraic("Bb2", Black)
c.Assert(err, Equals, ErrAmbiguousMove)
c.Assert(move, Equals, NilMove)
}