Additional Statements

Code Coverage for Ada

Terminal Statements

An Ada statement is terminal if it transfers control of the program anywhere other than to a sequence (return, goto, raise, exit).

By extension, a decision statement (if, case) is also terminal if all its branches are terminal (i.e., if, then and else blocks and non-empty when blocks contain a terminal instruction). An if statement without an else statement is never terminal, since one of the blocks is empty and therefore transfers control in sequence.

Potentially Terminal Statements

An Ada statement is potentially terminal if it contains a decision choice that transfers control of the program anywhere other than after it (return, goto, raise, exit ).

Non-coverable Statements

An Ada statement is detected as being not coverable if it is not a goto label and if it is in a terminal statement sequence. Statements that are not coverable are detected by the feature during the instrumentation. A warning is generated to signal each one, which specifies its location source file and line. This is the only action Code Coverage takes for statements that cannot be covered.

Note Ada units whose purpose is to terminate execution unconditionally are not evaluated. This means that Code Coverage does not check that procedures or functions terminate or return.

Similarly, exit conditions for loops are not analyzed statistically to determine whether the loop is infinite. As a result, a for, while or loop/exit when loop is always considered non-terminal (i.e., able to transfer control in its sequence). This is not applicable to loop/end loop loops without an exit statement (with or without condition), which are terminal.

Related Topics

Selecting coverage types | Code Coverage