summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-23 14:42:04 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-23 14:42:04 +0100
commit975ad849d1d1474e601ad2f4bf48ea0e4405251c (patch)
treeb5afec4c9ba5bf22697f84670270ce1c056cd196
parent8b499044fd3b8ac60d356b7947680fcb011bfd80 (diff)
Debug SANParser
-rw-r--r--src/ChessArbiter.cpp6
-rw-r--r--tests/chessarbiter.cpp5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp
index 0103b2a..57f280f 100644
--- a/src/ChessArbiter.cpp
+++ b/src/ChessArbiter.cpp
@@ -430,11 +430,7 @@ std::string ChessArbiter::ParseSAN(std::string SANMove) {
if (SANMove.size() > 0) {
// Pawn moves
if (std::islower(SANMove[0])) {
- if (fen.player) {
- piece = 'p';
- } else {
- piece = 'P';
- }
+ piece = 'P';
// Not a capture
if (SANMove[1] != 'x') {
dst = SANMove.substr(0, 2);
diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp
index 8687d4e..354f3f1 100644
--- a/tests/chessarbiter.cpp
+++ b/tests/chessarbiter.cpp
@@ -445,4 +445,9 @@ TEST_CASE("ParseSAN", "[ParseSAN]") {
CHECK(a.ParseSAN("O-O") == "e8g8");
a.Setup("r3kb1r/pppppppp/2qnbn2/8/8/2NBQ3/PPPPPPPP/R3KBNR b KQkq - 0 1");
CHECK(a.ParseSAN("O-O-O") == "e8c8");
+
+ // Random tests
+ a.Setup(
+ "r1bq1rk1/p4ppp/2p2n2/1pbPp3/3n4/P1NB3P/1PPP1PPN/R1BQ1RK1 b - - 0 10");
+ CHECK(a.ParseSAN("exd5") == "c6d5");
}