Skip to content

Conversation

@WayneBuschmeyer
Copy link
Owner

Refactored App.cpp to improve modularity and readability:

  • Replaced getValidatedInput with readValidatedInteger
  • Added writeOutput, readInput, and formatRollResults
  • Refactored handleTargetRoll and handleOpposedRoll
  • Added showManual function
  • Updated runCoreRoller for cleaner user choice handling

Updated test_dice.cpp to include tests for new functions:

  • Added setInput and captureOutput helpers
  • Added tests for readValidatedInteger, handleOpposedRoll, and handleTargetRoll
  • Enhanced tests for rollDice, opposedRoll, and targetRoll

Created App.h to declare functions used in App.cpp.

Wayne Buschmeyer added 2 commits December 28, 2024 19:31
Refactored App.cpp to improve modularity and readability:
- Replaced `getValidatedInput` with `readValidatedInteger`
- Added `writeOutput`, `readInput`, and `formatRollResults`
- Refactored `handleTargetRoll` and `handleOpposedRoll`
- Added `showManual` function
- Updated `runCoreRoller` for cleaner user choice handling

Updated test_dice.cpp to include tests for new functions:
- Added `setInput` and `captureOutput` helpers
- Added tests for `readValidatedInteger`, `handleOpposedRoll`, and `handleTargetRoll`
- Enhanced tests for `rollDice`, `opposedRoll`, and `targetRoll`

Created App.h to declare functions used in App.cpp.
- Added a static library target named `Core` in the `CMakeLists.txt` file.
- Included the `Core/Source` directory in the public include directories for the `Core` library.
- Added an executable target named `App` with source files `App/Source/App.cpp` and `App/Source/App.h`.
- Ensured that the `App` target includes the `Core/Source` directory in its private include directories.
- Linked the `App` target with the `Core` library.
- Enabled testing in the `CMakeLists.txt` file.
- Added an executable target named `tests` with the source file `tests/test_dice.cpp`.
- Updated the include directories for the `tests` target to include both `Core/Source` and `App/Source` directories.
- Linked the `tests` target with the `Core` library and `gtest_main`.
- Added the `tests` executable to CTest with the name `CoreTests`.
- Modified the `test_dice.cpp` file to include the correct path for the `App.h` header file by changing `#include "App.h"` to `#include "Source/App.h"`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants