Documentation

slcoverage.FilterRule class

Package: slcoverage

Create coverage filtering rule

Description

Create a coverage filtering rule that includes the selector and the rationale for filtering.

Construction

rule = slcoverage.FilterRule(selector,rationale) creates the filter rule object rule using the specified selector and rationale text.

rule = slcoverage.FilterRule(selector,rationale,mode) specifies whether the filter mode for this rule is justify or exclude. You can use only justify (the default) with metric selectors.

Input Arguments

expand all

Selector that determines the objects that this rule applies to, specified as an slcoverage.BlockSelector object, slcoverage.MetricSelector object, or slcoverage.SFcnSelector object.

Reason for adding the rule, specified as a character vector.

Example: 'value is never less than 0'

Filter mode for this rule, specified as slcoverage.FilterMode.Justify or slcoverage.FilterMode.Exclude.

Properties

expand all

This property is read-only.

Filter mode that was specified for this rule, returned as Justify or Exclude.

This property is read-only.

Rationale text specified for this rule, returned as a character vector.

This property is read-only.

Selector object for this rule, returned as a slcoverage.BlockSelector object, slcoverage.SFcnSelector object, or slcoverage.SFcnSelector object.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Examples

expand all

Create a block selector object and a rule for it. Then add the rule to a filter.

Open the model. Specify coverage settings and turn on coverage recording.

modelName = 'sldemo_lct_bus';
open_system(modelName);
set_param(modelName,'CovMetricSettings','dcme','RecordCoverage','on');

Select blocks with block type 'RelationalOperator' to add a filter rule for.

bl = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockType,'RelationalOperator');

Create a filter object, create a rule, and add the rule to the filter. This rule excludes the selection from coverage analysis.

filt = slcoverage.Filter;
rule = slcoverage.FilterRule(bl,'Tested elsewhere',slcoverage.FilterMode.Exclude);
filt.addRule(rule);

Introduced in R2017b

Was this topic helpful?