Derivation of Justifications
Justifications are assigned by the user to certain counters. For dependent other
counters, statements and lines, ctcreport derives the status
Justified with the following rules.
Basic rule
A counter or a block of statements is justified, when all possible execution paths leading to this item are justified.
Example: With one justification directly assigned to the false counter in line 22, the else
block with all statements and counters is justified, as there is only one, justified
path to this block. The statement after the else branch in line 33
is also justified, because the path via the if branch is blocked by
the return statement in line 25. Without this
return, code in line 33 and later would not be justified.

Details
The basic rule is applied to different kind of code elements, with some special considerations:
- Statements
- For statements, justification property is derived per block. Statements form a block in this sense if there is nothing with a counter and nothing like a branch or loop end in between. This block is justified if all paths to it are justified, and the execution path to the following code element is justified. The number of statements in this block is counted as justified for statement coverage.
- Elements with counters
ifdecisions,returnstatements etc., are justified by derivation according to the basic rule. In this case, all their counters are justified and the execution paths originating in these counters (for example, from a false counter of anifstatement to the code after theifbranch).- Lines
- Typical code lines containing one statement or element are justified if the
element is justified. When the justification state changes in one line, the
line gets the status
PartiallyJustified. - MC/DC
- Justifications can be assigned directly to true-false-combinations. For each condition, a pair of true-false-combinations is justified if one of the combinations is justified and the other one is tested or justified.
- Conditions
- A counter of a condition of a composite decision is justified, if all true-false-combinations with the matching value for this counter are justified.
- Decision counters and true-false-combinations
- A justification of a true or a false counter of a composite decision leads to justifications of all true-false-combinations with the corresponding value. This is considered as the user's intention. Conversly, if all true-false-combinations with value true or false, respectively, are justified, the corresponding counter of the decision is justified.
- Not reachable code
- If code cannot be executed, there is no execution path to it, and hence
there is never a justification derived for this code. Additionally,
unreachable code can prevent the derivation of justifications for other
elements: in the following example, this happens for code in line 49 and
later.

