From 0433cc641ba0846a2bc6a021badbe19d7d5a8aca Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Tue, 21 Apr 2026 19:05:16 +0200 Subject: [PATCH] update comments Co-authored-by: ebbit1q --- .../network/server/remote/game/server_abstract_player.cpp | 3 ++- tests/movecard_tests/reverse_card_move_test.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp index cbbfc676f..7c0437bf0 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp +++ b/libcockatrice_network/libcockatrice/network/server/remote/game/server_abstract_player.cpp @@ -244,10 +244,11 @@ static bool shouldBeFromTheBottom(const Server_CardZone *startZone, const std::s int movedCount = static_cast(cardsToMove.size()); int tailStart = startZone->getCards().size() - movedCount; - if (tailStart <= 0) { // if the move includes the start of the deck, it should not be considered from the bottom + if (tailStart <= 0) { // if the entire deck is moved it should not be considered from the bottom return false; } + // check if the move is a contiguous block at the end of the deck, fail fast when not int expectedPosition = tailStart; for (const auto &card : cardsToMove) { if (card.position != expectedPosition) { diff --git a/tests/movecard_tests/reverse_card_move_test.cpp b/tests/movecard_tests/reverse_card_move_test.cpp index f0fab71db..2231a7e3b 100644 --- a/tests/movecard_tests/reverse_card_move_test.cpp +++ b/tests/movecard_tests/reverse_card_move_test.cpp @@ -19,7 +19,7 @@ TEST(ReverseCardMoveTest, MoveCardFromBottomTest) ServerInfo_User user; user.set_name("test-user"); - // instatiate necessary dependencies of the library + // instantiate a fake server instance FakeServer server; Server_Room room(0, 0, "", "", "", "", false, "", {}, &server); Server_Game game(user, 1, "", "", 2, QList(), false, false, false, false, false, false, 20, false, &room); @@ -65,19 +65,19 @@ TEST(ReverseCardMoveTest, MoveCardFromBottomTest) int positionB; int positionC; int positionD; - // check if they are on the destination zone + // find the cards in the destination zone and check they are the right card EXPECT_EQ(exileZone.getCard(cardA->getId(), &positionA), cardA); EXPECT_EQ(exileZone.getCard(cardB->getId(), &positionB), cardB); EXPECT_EQ(exileZone.getCard(cardC->getId(), &positionC), cardC); EXPECT_EQ(exileZone.getCard(cardD->getId(), &positionD), cardD); - // check if they are with the expected coordinates + // check that they are at the expected index EXPECT_EQ(cardA->getX(), 3); EXPECT_EQ(cardB->getX(), 2); EXPECT_EQ(cardC->getX(), 1); EXPECT_EQ(cardD->getX(), 0); - // check if they are with the expected positions + // also check if the given positions are correct EXPECT_EQ(positionA, 3); EXPECT_EQ(positionB, 2); EXPECT_EQ(positionC, 1);