mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
update comments
Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
6b72b15027
commit
0433cc641b
2 changed files with 6 additions and 5 deletions
|
|
@ -244,10 +244,11 @@ static bool shouldBeFromTheBottom(const Server_CardZone *startZone, const std::s
|
|||
|
||||
int movedCount = static_cast<int>(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) {
|
||||
|
|
|
|||
|
|
@ -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<int>(), 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue