Code Coverage Summary and Annotations

If you specify a code coverage tool for a SIL or PIL simulation, the software produces a code generation report that provides summary data and code annotations with coverage information. Each code annotation is associated with a code feature and indicates the nature of the feature coverage during code execution.

The code generation report also allows you to navigate easily between blocks in your model and the corresponding sections in the source code. You can also view coverage annotations and navigate to the corresponding model blocks in the Code view.

LDRA Testbed Coverage

The cumulative coverage data in a code generation report is derived from instrumented files associated with your latest top-model simulation and coverage data collected from simulations with other top models that share referenced models with your current top model.

The software provides LDRA Testbed® annotations in the code generation report and in the Code view to help you to review code coverage.

Note

Do not use the code generation report alone to verify that you have achieved your coverage goals. You must refer to the LDRA Testbed Report.

This example shows three kinds of annotations. On lines 134, 139, 140, and 141, the annotation indicates that statement coverage for each of these lines of code is not complete.

Placing the cursor over the annotation =>b produces a tooltip.

This tooltip indicates that only one branch destination is covered. The code within the curly brackets, which starts at column 45 of line 134, is not executed. As the if statement on line 139 lies within this code, the corresponding annotation => states that the branch is not covered.

In the Code view, the color of each bar and annotations shows the amount of coverage of the corresponding line of code or code feature. Green indicates full coverage, yellow indicates partial coverage, and red indicates no coverage.

Place your cursor over the annotation ^b to see a tooltip. the tooltip indicates which branch destinations are covered and which are not covered.

This table describes the LDRA Testbed code annotations that you might see in a code generation report produced by a SIL and PIL simulations.

Code featureAnnotation symbolWhat happened during simulation
FunctionFcnFunction name returned through this exit point.
=>Function name never returned through this exit point.
Branch/condition=>Condition not encountered.
=>tCondition evaluated true only.
=>fCondition evaluated false only.
tfCondition evaluated both true and false.
Branch/decision=>Branch never encountered.
=>bBranch to at least one destination covered and branch to at least one other destination not covered.
bBranch fully exercised.
Modified Condition/Decision Coverage (MC/DC)=>mcCondition did not independently affect outcome of decision.
mcCondition independently affected outcome of decision.
Statement Statements associated with line covered.
Not all statements associated with line covered.

Code that is reformatted by LDRA Testbed and does not match the original source code. For example, source code with #include statements to include other files, and source code with #define statements for macros.

For detailed coverage information, refer to the LDRA Testbed report.

=>ΣZero coverage — probes within source code line or files included by source code line not exercised.
=>ΣCoverage probes within source code line or any included file partially exercised.
ΣCoverage probes within source code line or included files fully exercised.

BullseyeCoverage Information

The cumulative coverage data in a code generation report is derived from instrumented files associated with your latest top-model simulation and coverage data collected from simulations with other top models that share referenced models with your current top model.

The software provides BullseyeCoverage annotations in the code generation report and in the Code view to help you to review code coverage.

This example shows two kinds of annotations. At line 41, TF indicates that the if decision had both true and false outcomes during the simulation. At line 52, =>F indicates that the if decision was false only during the simulation.

In the Code view, the color of each bar and annotations shows the amount of coverage of the corresponding line of code or code feature. Green indicates full coverage, yellow indicates partial coverage, and red indicates no coverage.

This table describes the BullseyeCoverage code annotations that you might see in a code generation report produced by a SIL simulation.

Code featureAnnotation symbolWhat happened during simulation
Decision=>Decision not executed.
TFDecision evaluated both true and false.
=>TDecision evaluated true only.
=>FDecision evaluated false only.
Function=>Function not called.
FcnFunction called.
Switch label=>Switch command not used.
SwSwitch command used.
ConstantkDecision or condition was constant, which did not allow any variation in coverage.
Condition=>Condition not encountered.
tfCondition evaluated both true and false.
=>tCondition evaluated true only.
=>fCondition evaluated false only.
Try=>Try block never completed.
TryTry block covered.
Catch=>Catch block not covered.
CatCatch block covered.

Related Topics