test: add field-level assertions to black pawn PromotionRequired test
This commit is contained in:
@@ -312,6 +312,12 @@ class GameControllerTest extends AnyFunSuite with Matchers:
|
||||
val board = FenParser.parseBoard("8/8/8/8/4K3/8/4p3/8").get
|
||||
val result = GameController.processMove(board, GameHistory.empty, Color.Black, "e2e1")
|
||||
result should matchPattern { case _: MoveResult.PromotionRequired => }
|
||||
result match
|
||||
case MoveResult.PromotionRequired(from, to, _, _, _, turn) =>
|
||||
from should be (sq(File.E, Rank.R2))
|
||||
to should be (sq(File.E, Rank.R1))
|
||||
turn should be (Color.Black)
|
||||
case _ => fail("Expected PromotionRequired")
|
||||
|
||||
test("processMove detects pawn capturing to back rank as PromotionRequired with captured piece"):
|
||||
val board = FenParser.parseBoard("3q4/4P3/8/8/8/8/8/8").get
|
||||
|
||||
Reference in New Issue
Block a user