Merge branch 'pr/321'

This commit is contained in:
Sebastian Lague 2023-07-25 17:37:22 +02:00
commit c5f13b9001

View file

@ -323,6 +323,25 @@ namespace ChessChallenge.Application
Assert(boardAPI.GameMoveHistory[1].CapturePieceType is PieceType.Pawn, "Wrong game move history");
Assert(boardAPI.GameStartFenString == startPos, "Wrong game start fen");
Assert(boardAPI.GetFenString() == "r1bqkbnr/pppppppp/8/4n3/8/8/PPPP1PPP/RNBQKBNR w KQkq - 0 3", "Wrong game fen");
// Invalid target piece in capture when en passant is available
string[] invalidCaptureFens =
{
"r1b1r1k1/ppp2pp1/7p/2Pp4/4q3/PQ6/4PPPP/3RKB1R w K d6 0 16", // c5d6
"8/8/4k3/8/5PpP/6P1/7K/8 b - f3 0 73" // g4f3
};
foreach (var fen in invalidCaptureFens)
{
Console.WriteLine($"Checking captures for FEN: {fen}");
board.LoadPosition(fen);
boardAPI = new(board);
captures = boardAPI.GetLegalMoves(true);
foreach (var c in captures)
{
Assert(c.MovePieceType != PieceType.None, $"Move piece type wrong for move {c}");
Assert(c.CapturePieceType != PieceType.None, $"Capture piece type wrong for move {c}");
}
}
}
static void MoveGenTest()