VAR, ARRAY and STR <expected> Parameter

Ada Test Script Language

Purpose

In conjunction with the VAR, ARRAY and STR keywords, the <expected value> parameters for Ada specify the expected value of a variable.

Syntax

EV = <exp>

EV = <exp> , DELTA = <delta>

MIN = <exp>, MAX = <exp>

EV IN ) <exp>, <exp>, ... )

EV ( <variable> ) IN ) <exp>, <exp>, ... )

EV ==

where:

Description

The EV expressions are used to specify a test criteria by comparison with the value of a variable. The test is considered Passed when the actual value matches the <expected value> expression.

The EV value is calculated during the preprocessing phase, not dynamically during test execution.

An acceptable tolerance <delta> can be expressed:

Expected values can be expressed in the following ways:

    EV = <exp> specifies the expected value of the variable when it is known in advance. The value of variable is considered correct if it is equal to <exp>.

    EV = <exp>, DELTA = <tolerance> allows a tolerance for the expected value. The value of variable is considered correct if it lies between <exp> - <tolerance> and <exp> + <tolerance>.

    MIN = <exp> and MAX = <exp> specify an interval delimited by an upper and lower limit. The value of the variable is considered correct if it lies between the two expressions. Characters and character strings are treated in dictionary order.

    EV IN ) <exp>, <exp>, ... ) specifies the values expected successively, in accordance with the initial values, for a variable that is declared in INIT IN. It is therefore essential that the two lists have an identical number of values.

    EV ( <variable> ) IN is identical to EV IN, but the expected values are a function of another variable that has previously been declared in INIT IN. As for EV IN, the two lists must have an identical number of values.

    EV == allows the value of <variable> not to be checked at the end of the test. Instead, this value is read and displayed. The value of <variable> is always considered correct.

Expressions

The initialization expressions <exp> can be among any of the following values:

Additional Rules

EV with DELTA is only allowed for numeric variables.

MIN = <exp> and MAX = <exp> are only allowed for alphanumeric variables that use lexicographical order for characters and character strings.

MIN = <exp> and MAX = <exp> are not allowed for pointers.

Only EV = and EV == are allowed for structured variables.

In some cases, in order to avoid generated code compilation warnings, the word CAST must be inserted before the NIL or NONIL keywords.

Example

VAR x, ..., EV = pi/4-1

VAR y[4], ..., EV IN ) 0, 1, 2, 3 )

VAR y[5], ..., EV(y[4]) IN ) 10, 11, 12, 13 )

VAR z.field, ..., MIN = 0, MAX = 100

VAR p->value, ..., EV ==

ARRAY y[0..100], ..., EV = cos(I)

ARRAY y, ..., EV = )50=>10,others=>0)

STR z, ..., EV = )0, "", NIL)

STR *p, ..., EV = )value=>4.9, valid=>1)

 

Related Topics

VAR, ARRAY and STRVAR, ARRAY and STR <expected> ParameterVAR, ARRAY and STR <variable> Parameter