In this project, I will show you how to use GTest for C++. I am using CMake to build the project.
mkdir build
cd build
cmake ..
cmake --build .
# Run the test
./Debug/mytest.exe
In this project there is a C++ called program.cpp which contains a function for calculating factorial of a number. The test for this function is written in test.cpp.