views:

71

answers:

1
  1. I'm on Linux.
  2. My code is written in C++.
  3. My program is non-interactive; it runs as "./prog input-file", processes the file, and exits.
  4. I have various unit tests "input-file0, input-file1, input-file2, ..."
  5. For designing new unit tests, I want to know what lines of code existing tests do not cover.

Question: Given that I control how "prog" is compiled/run; how can I get list of the lines of code that "./prog input-file" does not hit?

Thanks!

EDIT: I'm currently using g++; but perfeclty happy to switch to LLVM if it makes this possible.

+2  A: 

gcc comes with a code coverage testing tool (gcov):

http://gcc.gnu.org/onlinedocs/gcc/Gcov.html

KennyTM