mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
test(game): add test cases for CardTile
This commit is contained in:
@@ -5,7 +5,9 @@ set(CMAKE_CXX_STANDARD 26)
|
||||
|
||||
project(uno-game-test)
|
||||
|
||||
add_executable(uno-game-test unit/game/CardTest.cpp)
|
||||
add_executable(uno-game-test unit/game/CardTest.cpp
|
||||
unit/game/CardTileTest.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(uno-game-test
|
||||
PUBLIC uno-game-lib
|
||||
|
||||
35
test/unit/game/CardTileTest.cpp
Normal file
35
test/unit/game/CardTileTest.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @file CardTileTest.cpp
|
||||
*
|
||||
* @author Yuzhe Guo
|
||||
* @date 2025.11.16
|
||||
*/
|
||||
|
||||
#include "../../../src/game/CardTile.h"
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(card_tile_test, card_tile_test_1)
|
||||
{
|
||||
const UNO::GAME::CardTile cardTile;
|
||||
ASSERT_EQ(cardTile.isEmpty(), true);
|
||||
}
|
||||
|
||||
TEST(card_tile_test, card_tile_test_2)
|
||||
{
|
||||
UNO::GAME::DiscardPile discardTile;
|
||||
ASSERT_EQ(discardTile.isEmpty(), true);
|
||||
discardTile.add(UNO::GAME::Card(UNO::GAME::CardColor::BLUE, UNO::GAME::CardType::NUM0));
|
||||
ASSERT_EQ(discardTile.isEmpty(), false);
|
||||
}
|
||||
|
||||
TEST(card_tile_test, card_tile_test_3)
|
||||
{
|
||||
UNO::GAME::Deck deck;
|
||||
ASSERT_EQ(deck.isEmpty(), false);
|
||||
deck.draw(108);
|
||||
ASSERT_EQ(deck.isEmpty(), true);
|
||||
deck.draw(107);
|
||||
ASSERT_EQ(deck.isEmpty(), false);
|
||||
}
|
||||
Reference in New Issue
Block a user