background image
<< Forced Conditions | Function Coverage >>
<< Forced Conditions | Function Coverage >>

Modified Conditions

Runtime Analysis
Modified Conditions
A modified condition is defined for each basic condition enclosed in a composition of
| | or && operators. It aims to prove that this condition affects the result of the
enclosing composition. To do that, find a subset of values affected by the other
conditions, for example, if the value of this condition changes, the result of the entire
expression changes.
Because compound conditions list all possible cases, you must find the two cases that
can result in changes to the entire expression. The modified condition is covered only
if the two compound conditions are covered.
/* state_control function */
int state_control ( void )
{
if ( ( ( flag & 0x01 ) &&
( instances_number > 10 ) ) ||
( flag & 0x04 ) )
return VALID_STATE;
else
return INVALID_STATE;
} /* There are 3 basic conditions, 5 compound conditions
and 3 modified conditions :
flag & 0x01 : TTX=T and FXF=F
nb_instances > 10 : TTX=T and TFF=F
flag & 0x04 : TFT=T and TFF=F, or FXT=T and FXF=F
4 test cases are enough to cover all those modified
conditions :
TTX=T
FXF=F
TFF=F
TFT=T or FXT=T
*/
Note You can associate a modified condition with more than one case, as
shown in this example for flag & 0x04. In this example, the modified condition
is covered if the two compound conditions of at least one of these cases are
covered.
Code Coverage calculates matching cases for each modified condition.
The same number of modified conditions as Boolean basic conditions appears in a
composition of | | and && operators.
Multiple Conditions
A multiple (or compound) condition is one of all the available cases for the || and
&& logical operator's composition, whenever it appears in a C function. It is defined
by the simultaneous values of the enclosed Boolean basic conditions.
A multiple condition is noted with a set of T, F, or X letters. These mean that the
corresponding basic condition evaluated to true, false, or was not evaluated,
respectively. Remember that the right operand of a || or && logical operator is not
43