1

By condition coverage, I mean like in the definition here. I didn't find such option in the documentation here. An option that gives me relevant statistics which I can parse easily condition coverage is also fine - but I can't find one.

John
  • 861
  • 1
  • 7
  • 19
  • You need some external tool, gcov cannot do that AFAIK. CBMC (The C Bounded Model Checker) is capable of determining MC/DC coverage etc. – Morten Jensen Jan 15 '18 at 10:09
  • @MortenJensen , There isn't even an option of gcov which will give me information that I can parse from it the condition coverage? – John Jan 15 '18 at 10:12
  • I don't think gcov can do that. If you just want condition coverage, there are ways around that. You could implement macros for branch-statements `if`, `while` etc., and save the result - check this out: http://www.macroexpressions.com/dl/C%20code%20unit%20testing%20on%20a%20shoestring.pdf - I've used `pycparser` to do the instrumentation instead of the preprocessor - that works even better. – Morten Jensen Jan 15 '18 at 10:26
  • In the source code annotation produced by `gcov` you can see which code was never executed. – Maxim Egorushkin Jan 15 '18 at 10:35
  • `gcov -a` more or less handles it. Try it on a few examples to see if that's good enough for you. – Marc Glisse Jan 15 '18 at 11:10

0 Answers0