22 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
41936b3525 test(network): expand NetworkClientTest with connection and send tests
- Added `onConnect` callback to test constructor.
- Introduced thread-based tests for connection and message sending.
2025-12-09 19:42:45 +08:00
Kieran Kihn
f968b4d3f2 test(network): add empty player list to InitGamePayload serialization tests
- Updated `InitGamePayload` to include an empty `players` array.
- Adjusted related serialization and deserialization test cases in `MessageSerializerTest`.
2025-12-07 19:33:43 +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
0e9f5bc924 test(network): simplify and consolidate NetworkClientTest
- Removed redundant tests and merged similar cases in `NetworkClientTest`.
- Updated `Connect` and `Send` tests to streamline functionality.
- Enhanced `MessageSerializerTest` to validate `playerId` in `InitGamePayload`.
2025-12-04 16:39:47 +08:00
Kieran Kihn
5f3a4083fd chore: update CMake library visibility for dependencies
- Changed `uno-game-lib` dependencies to `PUBLIC` visibility for `ftxui` components, `nlohmann_json`, and `asio`.
- Modified `uno-game-test` to use `PRIVATE` visibility for `uno-game-lib`.
2025-12-02 12:31:01 +08:00
Kieran Kihn
4b498e3b4a test(network): update tests to reflect InitGamePayload changes
- Modified `MessageSerializerTest` to pass `handCard.getCards()` instead of `handCard` in `InitGamePayload` construction.
2025-12-02 12:28:12 +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
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
6393a5b311 chore: update CMakeList.txt
- link `uno-game-lib` to `uno-game` instead of add sources to `uno-game`
- styled `CMakedList.txt` and `test/CMakeList.txt`
2025-11-20 13:32:15 +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