Commit Graph

7 Commits

Author SHA1 Message Date
Kieran Kihn
a161b55f35 test: update assertions to use player ID and standardize card serialization format 2025-12-10 21:45:44 +08:00
Kieran Kihn
c6342469df test(game): remove player name from ClientGameState constructor in test
- Simplified `ClientGameState` initialization in `GameStateTest`.
2025-12-09 20:03:37 +08:00
Kieran Kihn
9ae3b9cc89 test(game): simplify card play and player initialization in tests
- Updated `HandCard::play` usage to accept a dereferenced card.
- Replaced sequential `addPlayer` calls with `init` method in `GameStateTest`.
2025-12-07 19:33:29 +08:00
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
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