cvtest
Create model coverage test specification object
Description
Use cvtest
to create a test specification object that stores
model coverage settings. Pass the cvtest
object to the
cvsim
function to execute coverage analysis based on your
settings.
Creation
Description
creates
a cvto
= cvtest(root
)cvtest
object with default coverage settings.
root
can be the name of a model or the handle to a
model. root
can also be the name or handle to a subsystem
within the model, in which case only the specified subsystem and its descendents
are analyzed for coverage.
Note
Coverage metric settings specified in the cvtest
object
override coverage metric settings set in the model configuration
parameters.
Input Arguments
root
— Name or handle of model or path to subsystem
character array
| string array
Model name or handle, or path to a subsystem, specified as a character array or string array.
Properties
id
— Internal Model ID
scalar
This property is read-only.
Internal model ID, returned as a scalar.
modelcov
— Internal Coverage Configuration ID
scalar
This property is read-only.
Internal coverage configuration ID, returned as a scalar.
rootPath
— Name or handle of system to analyze
character array
| string array
This property is read-only.
Name of the system you specified to analyze, returned as a character array or string array.
Data Types: char
| string
label
— Test label
character array
| string array
Test label, specified as a character array or a string array. This label appears in the coverage report as the test name.
Data Types: char
| string
setupCmd
— Command executed in base MATLAB workspace before simulation
character array
| string array
Command executed in base MATLAB workspace before simulation, specified as a character array or string array.
The setup command is executed before each simulation.
Data Types: char
| string
settings
— Coverage settings
structure
Types of coverage to collect, specified as a structure.
settings
includes the following fields:
Property | Description | Values |
---|---|---|
| Enable decision coverage data. |
|
| Enable condition coverage data. |
|
| Enable modified condition decision coverage (MCDC) data. If |
|
| Enable coverage data from Simulink® Design Verifier™ blocks. |
|
| Enable coverage data for lookup tables. |
|
| Enable signal range data. |
|
| Enable signal size data. |
|
| Enable saturation on integer overflow coverage data. |
|
| Enable relational boundary coverage data. Use
For more information, see Relational Boundary Coverage. |
|
options
— Advanced coverage options
structure
Advanced coverage options, specified as a structure.
options
includes the following fields:
Property | Description | Values |
---|---|---|
| Relative tolerance for relational boundary coverage. For more information, see Relational Boundary Coverage. |
|
| Absolute tolerance for relational boundary coverage. For more information, see Relational Boundary Coverage. |
|
| Whether to restrict model coverage recording to a specified simulation time interval. Use
For more information, see Specify Coverage Options. |
|
| When to start recording coverage. Specify this property if
|
|
| When to stop recording coverage. Specify this property if
|
|
| Whether to record coverage for blocks flagged with the Block Reduction parameter.
For more information, see Block reduction. |
|
| Which MCDC definition to apply to the model, specified as one of the following options:
For more information, see Modified Condition and Decision Coverage (MCDC) Definitions in Simulink Coverage. |
|
filter
— Coverage filter
structure
Coverage filter, specified as a structure.
filter
has one field,
filter.fileName
.
filter.fileName
is the name of a coverage filter
file to apply to coverage analysis, specified as a character array or string
array.
For more information, see Coverage Filter Rules and Files.
modelRefSettings
— Model reference settings
structure
(default)
Model reference settings, specified as a structure.
modelRefSettings
includes the following
fields:
Property | Description | Values |
---|---|---|
| Model reference coverage setting, specified as one of the following options:
|
|
| Whether to exclude the top model from coverage
analysis, specified as a numeric or logical |
|
| Referenced models to exclude from coverage analysis, specified as a single character or string array of comma-separated model names. To use
this field, set
|
|
emlSettings
— Whether to collect coverage for external program files called by MATLAB functions
structure
Whether to collect coverage for external program files called by MATLAB functions in your model, specified as a structure.
emlSettings
has one field,
emlSettings.enableExternal
. Set
emlSettings.enableExternal
to 1
if
you want to collect coverage for external program files called by
MATLAB functions, and 0
if you do not want to
collect coverage for external program files called by MATLAB functions.
sfcnSettings
— Whether to collect coverage for C/C++ S-Function blocks
structure
(default)
Whether to collect coverage for C/C++ S-Function blocks in your model, specified as a structure.
sfcnSettings
has one field,
sfcnSettings.enableSfcn
. Set
sfcnSettings.enableSfcn
to 1
if
you want to collect coverage for S-Functions in your model, and
0
if you do not want to collect coverage for
S-Functions in your model.
For more information, see S-Function.
Examples
Analyze Coverage Using a cvtest
Object
This example shows how to run coverage analysis using a cvtest
object.
Open the slvnvdemo_ratelim_harness
model and define the test object using cvtest
. When you create the cvtest
object, specify the Adjustable Rate Limiter block as the model object to analyze.
load_system('slvnvdemo_ratelim_harness'); testObj = cvtest(['slvnvdemo_ratelim_harness', ... '/Adjustable Rate Limiter']); testObj.label = 'Gain within slew limits';
Add a setup command to testObj
. The setup command executes in the base MATLAB workspace before coverage analysis. In this case, the setup command loads data into the workspace that is required for the simulation.
testObj.setupCmd = ... 'load within_lim.mat';
To collect decision coverage and saturation on integer overflow coverage, enable the decision
and overflowsaturation
properties in testObj
object by setting the properties to true
or 1
.
testObj.settings.decision = true; testObj.settings.overflowsaturation = true;
Finally, perform the coverage analysis by calling cvsim
with testObj
.
cvdo = cvsim(testObj);
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)