Commit Graph

13 Commits

Author SHA1 Message Date
Kieran Kihn
e5304b8c6c refactor(game): simplify GameState construction and initialization
- Removed `GameStatus` dependency from `GameState` constructors.
- Adjusted `ClientGameState` and `ServerGameState` constructors accordingly.
- Simplified `ServerGameState::init()` to handle card initialization and player actions.
- Updated tests to reflect these changes.
2025-12-02 11:08:42 +08:00
Kieran Kihn
a10674fbd3 test(network): add unit tests for NetworkClient and NetworkServer
- Introduced comprehensive test cases for `NetworkClient` and `NetworkServer` functionality.
- Added tests for constructor, `connect`, `send`, `read`, and round-trip scenarios in `NetworkClientTest`.
- Added tests for player management, message sending, and concurrent access in `NetworkServerTest`.
- Updated `CMakeLists.txt` to include `NetworkClientTest` and `NetworkServerTest` in the build configuration.
2025-11-29 18:52:08 +08:00
Kieran Kihn
def62a18c6 test(network): enhance MessageSerializerTest with MessageStatus coverage
- Added `status_code` expectations in serialization and deserialization tests.
- Introduced tests for invalid `status_code` handling in `MessageSerializer`.
- Updated test cases to include `MessageStatus::OK` for payload validation and round-trip scenarios.
2025-11-23 15:03:09 +08:00
Kieran Kihn
a341b7330b test(game): fix CardTest expectations for colorToString output
- Updated `colorToString` expectations in `CardTest` to match corrected behavior for Red cards.
2025-11-23 15:02:49 +08:00
Kieran Kihn
6757f559ea test(network): add MessageSerializerTest for serialization and deserialization coverage
- Added comprehensive unit tests for `MessageSerializer` in `MessageSerializerTest.cpp`.
- Included `MessageSerializerTest.cpp` in `test/CMakeLists.txt`.
2025-11-21 22:53:35 +08:00
Kieran Kihn
e78741bd9d refactor(game): encapsulate Player and ClientGameState state management
- Replaced public `Player::handCard` pointer with private `HandCard` member.
- Introduced `draw`, `play`, and `getCards` methods in `Player` and `ClientGameState`.
- Modified `ClientGameState` constructor to accept player name instead of `Player` object.
- Updated tests to reflect new `Player` and `ClientGameState` structure.
2025-11-18 17:15:07 +08:00
Kieran Kihn
23cd94e656 test(game): refine GameStateTest while-loop logic and assertions
- Adjusted while-loop conditions to streamline test execution.
- Enhanced `canBePlayedOn` validation by passing `drawCount`.
- Added assertion to validate card count consistency during gameplay.
2025-11-17 22:11:14 +08:00
Kieran Kihn
b7dcaabc28 test(game): add GameStateTest for client and server game state validation
- Added new unit tests in `GameStateTest.cpp` to validate `ClientGameState` and `ServerGameState` behavior.
- Updated `CMakeLists.txt` to include the new test file.
2025-11-17 21:17:56 +08:00
Kieran Kihn
e5f9666ff0 test(game): refactor PlayerTest to use HandCard::draw method instead of array constructor 2025-11-17 21:17:37 +08:00
Kieran Kihn
f8666b18b1 test(game): update tests to reflect removal of CardColor::WILD and adjust deck drawing logic 2025-11-17 14:40:22 +08:00
Kieran Kihn
d658a38790 test(game): add test cases for Player 2025-11-16 21:29:43 +08:00
Kieran Kihn
44120f1393 test(game): add test cases for CardTile 2025-11-16 20:54:01 +08:00
Kieran Kihn
1e49f5ffbb test(game): add test cases for Card 2025-11-16 11:47:26 +08:00