summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-12-26 21:15:12 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-12-26 21:15:12 +0100
commitdd4574691a862548a7b7341a529bded347718068 (patch)
tree547afba6b7f4647c317663bd045e29b08d5b4b6c
parent9025383477acf5f9a6360877c502232eaec24e02 (diff)
Debug Play mmethod (wrong if statement)
-rw-r--r--src/ChessArbiter.cpp4
-rw-r--r--tests/chessarbiter.cpp9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/ChessArbiter.cpp b/src/ChessArbiter.cpp
index db1830c..d64ac83 100644
--- a/src/ChessArbiter.cpp
+++ b/src/ChessArbiter.cpp
@@ -57,8 +57,8 @@ bool ChessArbiter::Play(std::string move) {
}
// Perform the move
- if ((moved.piece == 'k' || moved.piece == 'K') && move == "e8g8" ||
- move == "e8c8" || move == "e1g1" || move == "e1c1") {
+ if ((moved.piece == 'k' || moved.piece == 'K') && (move == "e8g8" ||
+ move == "e8c8" || move == "e1g1" || move == "e1c1")) {
if (move == "e8g8") {
board.Move("e8g8");
board.Move("h8f8");
diff --git a/tests/chessarbiter.cpp b/tests/chessarbiter.cpp
index c5f34ea..2e65ae5 100644
--- a/tests/chessarbiter.cpp
+++ b/tests/chessarbiter.cpp
@@ -470,3 +470,12 @@ TEST_CASE("ParseSAN", "[ParseSAN]") {
a.Setup("1r4k1/4pp1p/6pb/1p3b2/P1P5/5P2/2P3PP/1K1R3R w - - 0 23");
CHECK(a.ParseSAN("cxb5") == "c4b5");
}
+
+TEST_CASE("Specific bugs found on a game", "[BugFixes]") {
+ ChessArbiter a;
+
+ // BUG 1
+ a.Setup("1k3r1r/npqbbp2/4p1p1/p2pPnNp/1P3B1P/P1PB4/5PPQ/RN2R1K1 w - - 1 19");
+ a.Play("e1c1");
+ CHECK(a.GetFEN() == "1k3r1r/npqbbp2/4p1p1/p2pPnNp/1P3B1P/P1PB4/5PPQ/RNR3K1 b - - 2 19");
+} \ No newline at end of file