Skip to content

Commit b506dd0

Browse files
committed
Updated gcov
1 parent abd0e68 commit b506dd0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

unittest/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ Compile and run as follows to use `gprof` to profile the library:
4545
cd ../unittest
4646
gcc -g -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
4747

48+
## Using `gcov` to Show Test Coverage
49+
50+
Compile and run as follows to use `gcov` to show test coverage for the libray:
51+
52+
cd ../mapcodelib
53+
gcc -fprofile-arcs -ftest-coverage -O0 -c mapcoder.c
54+
cd ../unittest
55+
gcc -fprofile-arcs -ftest-coverage -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
56+
./unittest
57+
cd ../mapcodelib
58+
gcov mapcoder.c
59+
cd ../unittest
60+
gcov unittest.c
61+
62+
The test coverage reports are the `*.gcov` text files.
63+
4864
## Using Microsoft Visual C++
4965

5066
If you use **Microsoft Visual C++**, you may need to add the following defines to your preprocessor

0 commit comments

Comments
 (0)