/learn_gtest_fork

My example project with GoogleTest framework. Also, the project has automated cross-platform build via Github Actions.

Primary LanguageC++

Testing

App cli keys

--shape=[circle, rectangle, triangle] [int values]

example:
--shape=circle [radius_int_value]
--shape=rectangle [a_int_value] [b_int_value]
--shape=triangle [a_int_value] [h_int_value]

CMake build

  1. create build dir
  2. exec from build dir cmake ..
  3. cmake --build . or make
  4. from VSCode Command Palette CMake: Run Tests or from terminal CTest
  5. check compiled program ./my_program

Notes

Since gtest is intended for testing libraries (we cannot test code from an executable project). Then all the methods for the application were moved to the example_lib library.

gtest_force_shared_crt - googletest variable (check it in CMakeCache)

run one of tests (not working for me on mac):

./test/ExampleTests --gtest_filter=ExampleTests2*

Links