Unit test demo using Google Test.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
cmake mv googletest*.cmake under cmake/ Mar 14, 2018
src more local scope Mar 13, 2018
test use GNUInstallDirs Mar 13, 2018
.gitignore initial layout Nov 14, 2014
.travis.yml update install instructions Mar 13, 2018
CMakeLists.txt mv googletest*.cmake under cmake/ Mar 14, 2018
LICENSE update year Mar 13, 2018
README.md use GNUInstallDirs Mar 13, 2018

README.md

Build Status Coverage Status License

gtest-demo

C/C++ unit test demo using Google Test deployed to Travis-CI with test coverage deployed to Coveralls.

This demo uses the approach presented by Craig Scott in https://crascit.com/2015/07/25/cmake-gtest/.

How to build this demo

git clone https://github.com/bast/gtest-demo.git
cd gtest-demo
cmake -H. -Bbuild
cd build
cmake --build .

Running the tests

Either using ctest:

$ ctest

Running tests...
Test project /home/user/gtest-demo/build
    Start 1: unit
1/1 Test #1: unit .............................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.00 sec

Or directly using unit_tests:

$ ./bin/unit_tests

[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from example
[ RUN      ] example.add
[       OK ] example.add (0 ms)
[ RUN      ] example.subtract
[       OK ] example.subtract (0 ms)
[----------] 2 tests from example (1 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[  PASSED  ] 2 tests.

Acknowledgments

References