- cd ~/
- wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz
- tar zxvf release-1.8.0.tar.gz
- mkdir ~/ST2017-hw2-coverage
- cd ~/ST2017-hw2-coverage
- cp -r ~/googletest-release-1.8.0/googletest ~/ST2017-hw2-coverage/gtest
- cd ~/ST2017-hw2-coverage/gtest/make
- make
- mv gtest_main.a libgtest.a
- mkdir ~/ST2017-hw2-coverage/[hw]
- cd ~/ST2017-hw2-coverage/[hw]
- Add files
- g++ -ftest-coverage -fprofile-arcs triangle.cpp test.cpp -I ../gtest/include -L ../gtest/make -lgtest -lpthread -o test
- ./test
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from TriangleTest
[ RUN ] TriangleTest.CodeCoverageC0
[ OK ] TriangleTest.CodeCoverageC0 (0 ms)
[ RUN ] TriangleTest.CodeCoverageC1
[ OK ] TriangleTest.CodeCoverageC1 (0 ms)
[ RUN ] TriangleTest.CodeCoverageC2
[ OK ] TriangleTest.CodeCoverageC2 (0 ms)
[----------] 3 tests from TriangleTest (0 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (0 ms total)
[ PASSED ] 3 tests.
- gcov triangle.cpp
File 'triangle.cpp'
Lines executed:100.00% of 10
Creating 'triangle.cpp.gcov'
- cat triangle.cpp.gcov
Triangle problems
- C0, C1, C2
- MCDC
NextDate problems
- C0, C1, C2
- MCDC
Commission problems
- C0, C1, C2
- MCDC