User`s guide

Model Coverage for MATLAB Functions
18-21
Function header — Decision coverage is 100% if the function or local function is
executed.
if — Decision coverage is 100% if the if expression evaluates to true at least once,
and false at least once.
switch — Decision coverage is 100% if every switch case is taken, including the fall-
through case.
for — Decision coverage is 100% if the equivalent loop condition evaluates to true at
least once, and false at least once.
while — Decision coverage is 100% if the equivalent loop condition evaluates to true
at least once, and evaluates to false at least once.
Condition and MCDC Coverage
During simulation, in the MATLAB Function block function, the following logical
conditions are tested for condition and MCDC coverage:
if statement conditions
while statement conditions
Simulink Design Verifier Coverage
The following MATLAB functions are active in code generation and in Simulink Design
Verifier:
sldv.condition
sldv.test
sldv.assume
sldv.prove
When you specify the Simulink Design Verifier coverage metric in the Coverage
Settings dialog box, the Simulink Verification and Validation software records coverage
for these functions.
Each of these functions evaluates an expression expr, for example, sldv.test(expr),
where expr is a valid Boolean MATLAB expression. Simulink Design Verifier coverage
measures the number of time steps that the expression expr evaluates to true.
If expr is true for at least one time step, Simulink Design Verifier coverage for that
function is 100%. Otherwise, the Simulink Verification and Validation software reports
coverage for that function as 0%.