cvtest

Create model coverage test specification object

Syntax

cvto = cvtest(root)
cvto = cvtest(root, label)
cvto = cvtest(root, label, setupcmd)

Description

cvto = cvtest(root) creates a test specification object with the handle cvto. Simulate cvto with the cvsim command.

cvto = cvtest(root, label) creates a test object with the label label, which is used for reporting results.

cvto = cvtest(root, label, setupcmd) creates a test object with the setup command setupcmd.

Input Arguments

root

Name or handle for a Simulink® model or a subsystem. Only the specified model or subsystem and its descendants are subject to model coverage testing.

label

Label for test object

setupcmd

Setup command for creating test object. The setup command is executed in the base MATLAB® workspace just prior to running the simulation. This command is useful for loading data prior to a test.

Output Arguments

cvto

A test specification object with the following structure.

FieldDescription

id

Read-only internal ID

modelcov

Read-only internal ID

rootPath

Name of system or subsystem for analysis

label

String used when reporting results

setupCmd

Command executed in base workspace prior to simulation

settings.condition

Set to 1 for condition coverage.

settings.decision

Set to 1 for decision coverage.

settings.
designverifier

Set to 1 for coverage for Simulink Design Verifier™ blocks.

settings.mcdc

Set to 1 for MCDC coverage.

settings.relationalop

Set to 1 for relational boundary coverage. Use options.
covBoundaryAbsTol
and options.
covBoundaryRelTol
for specifying tolerances for this coverage.

For more information, see Relational Boundary Coverage.

settings.sigrange

Set to 1 for signal range coverage.

settings.sigsize

Set to 1 for signal size coverage.

settings.tableExec

Set to 1 for lookup table coverage.

modelRefSettings.
enable

  • 'off' — Disables coverage for all referenced models.

  • 'all' or on — Enables coverage for all referenced models.

  • 'filtered' — Enables coverage only for referenced models not listed in the excludedModels subfield.

modelRefSettings.
excludeTopModel

Set to 1 to exclude coverage for the top model

modelRefSettings.
excludedModels

String specifying a comma-separated list of referenced models for which coverage is disabled.

emlSettings.
enableExternal

Set to 1 to enable coverage for external program files called by MATLAB functions in your model.

options.
forceBlockReduction

Set to 1 to override the Simulink Block reduction parameter if it is enabled.

options.
covBoundaryRelTol

Set to the value of relative tolerance for relational boundary coverage.

For more information, see Relational Boundary Coverage.

options.
covBoundaryAbsTol

Set to the value of absolute tolerance for relational boundary coverage.

For more information, see Relational Boundary Coverage.

options.useTimeInterval

Set to 1 to restrict model coverage recording only inside a specified simulation time interval.

For more information see Specify Model Coverage Options.

options.intervalStartTime

Value of the coverage recording interval start time.

options.intervalStopTime

Value of the coverage recording interval stop time.

filter.fileName

String specifying name of coverage filter file, if you have excluded objects from coverage recording. See Coverage Filter Rules and Files.

Examples

Create a cvtest object for the Adjustable Rate Limiter block in the slvnvdemo_ratelim_harness model. Simulate and get coverage data using cvsim.

open_system('slvnvdemo_ratelim_harness');
testObj = cvtest(['slvnvdemo_ratelim_harness', ...
	'/Adjustable Rate Limiter']);
testObj.label = 'Gain within slew limits';
testObj.setupCmd = ...
	'load(''slvnvdemo_ratelim_harness_data.mat'');';
testObj.settings.decision = 1;
testObj.settings.overflowsaturation = 1;
cvdo = cvsim(testObj);
Was this topic helpful?