Home > User Support > CoverageMaster winAMS FAQ

CoverageMaster winAMS FAQ

Coverage Measurement

102_02: The C1 (branch) coverage result is 100%, but the C0 (statement) coverage is not 100%. Why?

Question:

I performed a C0/C1 coverage test. The C1 (branch) coverage result is 100% that means all branches have been executed, but the C0 (statement) coverage is not 100%. Why?

Answer:

One cause of such a result is when there is a return instruction or goto instruction in the code, or when there is code (dead code) that is never executed by the logic of the C source. You can see the relevant line in the coverage view.

Another cause is that it depends on the code structure generated by the compiler. In one example, the last line of the function (the line with '}') may not be executed and the result may be output. In this case, the compiler generates a constant area that is not executable code in the last line and associates this with the debug information (the code in the constant area is associated with the last line).

During the test execution, the constant area that is not the execution code is not executed, so CoverageMaster determines that the last line is not executed and outputs the result that C0 coverage is not 100%.

For such results, you can use the "Show Disassemble Code" feature in the Coverage view to evaluate the code of the non-executed lines.

<Workaround: When non-executable code is generated in the last line of the function>

There is an option to exclude the last line of the function from coverage measurement. This option is in the "Advanced Coverage Settings" dialog displayed by clicking the "Advanced..." button in the "Coverage" section of the "Test Settings" screen. The relevant setting is "Don't include end of function brace in C0 coverage".

<Workaround: Coverage measurement with hook code>

As a way to avoid this problem completely, there is a feature to measure C0 and C1 coverage using hook code. This method inserts coverage measurement hook code into a copy of the source code to measure C0/C1 coverage (the same kind of hook code used to measure MC/DC coverage.)

For details, please refer to the following FAQ.

013_04: How to setup CoverageMaster to perform coverage measurement using hook code?


 

Related Technical Tips Search

Other technical tips in GAIO's web site can be searched for using the links below.

Search key word link: C0 Measurement
Technical Tips Google Search


Information Links