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:
To output a square wave with a period of 10 sec:
square(et/10)
To transition when h changes to 0:
hasChangedTo(h,0)
To verify that x is greater than y:
verify(x > y)Assessment Statements
To verify simulation, stop simulation, and return verification
results, use assessment statements.
KeywordStatement
SyntaxDescriptionExampleverify(expression)
verify(expression,
errorMessage)
verify(expression, identifier,
errorMessage)Assesses a logical expression. Optional arguments label
results in the Test Manager and diagnostic viewer.verify(x > y,...
'SimulinkTest:'...
'greaterThan',...
'x and y values are '...
'%d, %d',x,y)
assert(expression)
assert(expression,
errorMessage)Evaluates a logical expression. Failure stops simulation
and returns an error. Optional arguments return an error message.assert(h==0 && k==0,...
'h an