User`s guide

12 Verifying Generated Code for a Component
12-8
runopts = slvnvruntestopts;
2
Specify to simulate the model, and record coverage:
runopts.coverageEnabled = true;
3
Simulate the model using the logged input signals:
[~, covdata] = slvnvruntest('slvnvdemo_powerwindow_controller',...
mergedTestCases,runopts);
4
Display the HTML coverage report:
cvhtml('Coverage with Test Cases from Harness', covdata);
The slvnv_powerwindow_controller model achieved:
Decision coverage: 44%
Condition coverage: 45%
MCDC coverage: 10%
Note: For more information about decision coverage, condition coverage, and MCDC
coverage, see “Types of Model Coverage” on page 15-3.
If you do not achieve the desired coverage, continue to modify the test cases in the Signal
Builder in the harness model, log the input signals to the harness model, and repeat the
preceding steps until you achieve the desired coverage.
To achieve additional coverage to bring your model closer to 100% coverage, modify
or add test cases using the Signal Builder block in the harness model, as described in
“Create and Log Test Cases” on page 12-6.
Execute Component in Simulation Mode
To verify that the generated code for the model produces the same results as simulating
the model, use the Code Generation Verification (CGV) API methods. When you perform
this procedure, the simulation compiles and executes the model code using the merged
test cases:
1
Create a default options object for slvnvruncgvtest:
runcgvopts = slvnvruntestopts('cgv');
2
Specify to execute the model in simulation mode: