ENVIRONMENT ... END ENVIRONMENT

C Test Script Language

Purpose

The ENVIRONMENT instruction defines a test environment declaration, that is, a default set of test specifications.

Syntax

ENVIRONMENT <name> [ ( <param> { , <param> } ) ]

END ENVIRONMENT

<name> is a mandatory identifier that provides a unique environment name.

<param> is an optional identifier.

Description

The test environment defines a general context. Variables which are declared within a context can be overwritten by a TEST statement.

Every environment can contain parameters. The declared parameters can be used in initialization and expected value expressions. These parameters are initiated by the USE instruction.

The END ENVIRONMENT instruction marks the end of an environment declaration.

<name> specifies an environment name that is referenced in the USE instruction.

An environment must be defined after the BEGIN instruction.

Each environment is visible in the block in which it has been declared and in any blocks included in this block, after its declaration.

An environment can only contain VAR, ARRAY, STR, FORMAT or STUB instructions and conditional generation instructions. If it is empty, a warning message is generated.

An environment is activated by the USE instruction that defines its scope and its priority. ENVIRONMENT blocks are executed in the reverse order of their respective USE instruction.

After generating the initializations and the tests of an ELEMENT block, visible environments are included in order of priority, at every END ELEMENT instruction, in order to complete the initializations and tests.

The scope of an ENVIRONMENT block is important insofar as only "visible" environment blocks apply, and use clauses can be out of scope.

Example

ENVIRONMENT compute_histo

 VAR x1, init = 0, ev = init

 VAR x2, init = SIZE_IMAGE-1, ev = init

 VAR y1, init = 0, ev = init

 VAR y2, init = SIZE_IMAGE-1, ev = init

 ARRAY histo, init = 0, ev = 0

 VAR status, init ==, ev = 0

END ENVIRONMENT

Related Topics

USE | VAR | ARRAY | STR | FORMAT