Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

code coverage: what type of coverage is actually done?

Peter_L_6
Beginner
132 Views

I'm using the codecov tool. One question: what kind of coverage is actually computed on block level?

We would like to state that we have 100% branch coverage (C1 in the literature). My question is how codecov handles the situation where an if statement does not have an else clause? E.g.,

if (decision)
{
    SOME CODE STATEMENTS
}

Will the block coverage reported for this block be 100% if we just test the case with decision = true, or is both true and false required for 100% block coverage?

0 Kudos
1 Reply
Kittur_G_Intel
Employee
132 Views

Good question. If it's necessary for codecov to assume that all blocks generated at the source position (like at if statement) are covered when at least one of the blocks is covered, then you can configure that using the -nopartial  option. If you do, then the decision coverage is disabled for the if statement and the coverage adjusted accordingly. This way, you can get the codecov utility to treat partially covered code as covered fully. Hope that helps.

_Kittur

Reply