Justifications in Source Code
You can provide justifications in source code comments. With this workflow, justifications are naturally reallocated when changing other parts of a source file.
The justifications start with key CTC++ Justify inside a comment:
switch (month) {
case JANUARY: ...
...
case DECEMBER: ...
default: // CTC++ Justify | DefensiveDefaults: Function call is only performed with proper enumeration - reviewed.
These justifications are included in HTML reports if option
-include-justifications is used with ctcreport
A justification is applied to the first matching counter on the same or the next source
code line. Relevant is the line number ctc records for the
coverage probe. For a multiline
if decision, this is the last line of
the decision. You can relax the search rule with indicator ">>" after justification
type. In this case, ctcreport looks for a matching counter
until the end of the
function./* CTC++ Justify True >> | Effort: Error handling only, hardly testable. */
if (no_memory() ||
no_space_on_hard_drive() ||
network_connection_lost()){
silently_say_goodbye();
return;
}Outside instrumented functions, only justifications of type Function are
applied. By default, they refer to a function starting at the same or on the next line.
Again, using ">>", the next instrumented function anywhere in the source file is
chosen.