Sample project for GoogleTest
- Create a simple calculator with GoogleTest
- Continuous Integration with GitHub Actions
Status |
Build Type |
|
windows-latest, ubuntu-latest, macos-latest |
|
armv7 + ubuntu18.04, aarch64 + ubuntu18.04 |
|
ubuntu-latest |
- To test core logic and input/output, make
Arithmetic
and Prompt
module, respectively
Calculator
module contains these modules
- However,
Calculator
module doesn't create these modules. Instead, use dependency injection
- It's better to have a factory module, but in this project main function creates these modules to make it easy
- So that, I can use mock modules when running unit test for
Calculator
module
- main.cpp
- calculator/
- arithmetic/
- prompt/
- test/
- calculator/
- arithmetic/
- prompt/
mkdir -p build && cd build
cmake ..
make
ctest
./main
`>+ 1 2`
- Create Visual Studio project using cmake-gui
- Build the project
- Normal execution
- Set
main
as a startup project
- Run
>+ 1 2
- Test
- Open Test Explorer
- Run All Tests
- This project utilizes OSS (Open Source Software)