Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MC/DC coverage tools for C/C++ [closed]

I have recently took the CS258 free online course, and it mentioned a code coverage called the MC/DC coverage, which is used in embedded software, such as computers on cars, planes, etc...

but I couldn't find a free tool to show me MC/DC coverage for my program, are there any recommendations?

like image 371
shengy Avatar asked Aug 03 '12 06:08

shengy


1 Answers

I believe that Project Coverage (now called Project Couverture) will probably be the first good answer to the question of non-invasive AND open-source coverage analysis. Their latest code release is currently here and a mile-high kind of project presentation can be seen here.

As to how SQLite claims MC/DC coverage using just gcov, they base this on the fact that in C, the logic AND and OR follow short-circuit evaluation; meaning that in any boolean expression comparisons...

if (((A == B) || (C != D)) && (E != F)) ...

...C will, by definition, stop evaluating at the first expression that 'decides' the whole; so if A is equal to B, the decision-making is already done - if not, it continues to the next expression, and so on. This means that the MC/DC requirement...

Each condition in a decision must be shown to *independently*
          affect the outcome of the decision

...is sort of "covered by default".

There is an exception to that, though - read their explanation here.

like image 59
ttsiodras Avatar answered Sep 21 '22 10:09

ttsiodras