Test Sequence and Assessment Syntax

This topic describes syntax used within Test Sequence and Test
Assessment blocks, and Stateflow® charts. In the blocks, you use this syntax for test step actions, transitions,
and assessments. In charts, you use this syntax in states and transitions.

For information on using the command-line interface to create and edit test sequence
steps, transitions, and data symbols, see the functions listed under Test
Sequences on the Test Scripts page.

Test Sequence and Test Assessment blocks use MATLAB® as the action language. You define actions, transitions, assessments with
assessment operators, temporal operators, transition operators, signal generation functions,
logical operators, and relational operators. Except for verify,
Stateflow charts can use all operators in MATLAB or C as the action language. verify can be used only with
MATLAB language. For example:

Signal Generation Functions

Some signal generation functions use the temporal operator et, which is the
elapsed time of the test step in seconds. Scaling, rounding, and other approximations of
argument values can affect function outputs. Common
signal generation functions include:

Saves the value of x at the first
time latch(x) evaluates in a test step, and subsequently
returns the saved value of x. Resets the saved
value of x when the step exits. Reevaluates latch(x) when
the step is next active.

An exponential signal progressing at one tenth of the
test step elapsed time:

exp(et/10)

Logical Operators

You can use logical connectives in actions, transitions, and
assessments. In these examples, p and q represent
Boolean signals or logical expressions.

Operation

Syntax

Description

Example

Negation

~p

not p

verify(~p)

Conjunction

p && q

p and q

verify(p && q)

Disjunction

p || q

p or q

verify(p || q)

Implication

~p || q

if p, q. Logically
equivalent to implication p → q.

verify(~p || q)

Biconditional

(p && q) || (~p && ~q)

p and q, or not p and
not q. Logically equivalent to biconditional p ↔ q.

verify((p && q) || (~p && ~q))

Relational Operators

You can use relational operators in actions, transitions, and
assessments. In these examples, x and y represent
numeric-type variables.

Using == or ~= operators
in a verify statement returns a warning when comparing
floating-point data. Consider the precision limitations associated
with floating-point numbers when implementing verify statements.
See Floating-Point Numbers (MATLAB).
If you use floating-point data, consider defining a tolerance for
the assessment. For example, instead of verify(x == 5),
verify x within a tolerance of 0.001: