background image
<< Modified Conditions | Additional Statements >>
<< Modified Conditions | Additional Statements >>

Function Coverage

Test RealTime - User Guide
evaluated if the evaluation of the left operand determines the result of the entire
expression.
/* state_control function */
/* -cond=compound */
int state_control ( void )
{
if ( ( ( flag & 0x01 ) &&
( instances_number > 10 ) ) ||
( flag & 0x04 ) )
return VALID_STATE;
else
return INVALID_STATE;
} /* There are 3 basic conditions
and 5 compound conditions :
TTX=T <=> (( T && T ) || X ) = T
TFT=T
TFF=F
FXT=T
FXF=F
*/
Code Coverage calculates every available case for each composition.
The number of enumerated branches is the number of distinct available cases for each
composition of || or && operators.
Function Coverage
When analyzing C source code, Test RealTime can provide the following function
coverage:
·
Procedure Entries
·
Procedure Entries and Exits
Procedure Entries
Inputs identify the C functions that are executed.
/* Factorial function */
/* -proc */
int factorial ( int a )
{
if ( a > 0 ) return a * factorial ( a - 1 );
else return 1;
}
One branch is defined per C function.
Procedure Entries and Exits (Returns and Terminal Statements)
These include the standard output (if coverable), and all return instructions, exits,
and other terminal instructions that are instrumented, as well as the input.
/* Factorial function */
/* -proc=ret */
int factorial ( int a )
{
if ( a > 0 ) return a * factorial ( a - 1 );
44