VAR
System Testing Test Script Language.
Syntax
VAR <variable> , INIT= <expression> | EV= <expression>
Description
This instruction allows you to initialize or check a variable. The first statement performs the initialization. The second statement compares the contents of the variable with the expression.
<variable> is a message or a variable that has previously been declared in native language. It may be any basic or structure type expression.
<expression> is in C and takes the following form:
cmp_expression::= C_CPP__lang_exp
{cmp_init {,cmp_initialization}}
[attol_init {,attol_init}]
cmp_init::=Constant=>C_CPP_lang_exp |
Constant1 .. Constant2=>C_CPP_lang_exp |
C_CPP_lang_exp
field_name =>C_language_expression
When controlling a numeric value (VAR ... EV=), you can check a range of values with one of following syntaxes:
VAR <variable>, EV= [ <expr_min> .. ]
VAR <variable>, EV= [ .. <expr_max> ]
VAR <variable>, EV= [ <expr_min> .. <expr_max> ]
This indicates that the value should be greater than <expr_min>, less than <expr_max>, or between the two expressions.
The VAR instruction may appear in a PROC, SCENARIO, INITIALIZATION, TERMINATION or EXCEPTION block.
The keyword OTHERS in a <expression> that represents ranges in an array or fields in a structure that have not been previously specified.
The identifiers I1, I2, ... I20 are reserved to access different dimensions of an array. For a three-dimensional matrix, I1 represents the index for the first dimension, I2 the index for the second dimension, and I3 the index for the third dimension.
Example
SCENARIO Main
#int matrix[3][3];
#struct {
# char name[30];
# char color[20];
# double size;
# } object;
# long x;
CALL compute(matrix)
VAR matrix, EV=[ [1, 1, 1], [2, 2, 2], [1, 1, 1] ]
-- OR
VAR matrix, EV=[ 2 => [2, 2, 2], OTHERS =>[1,1,1] ]
-- multiplication table:
VAR matrix, INIT= I1 I2
VAR object, INIT=[ name => "car", color => "rouge",
& size => 2.50 ]
VAR object, INIT=[ size => 0.10, OTHERS => "orange" ]
VAR x, EV=[11..28]
END SCENARIO
Related Topics
CALL |