USE

C Test Script Language

Purpose

The USE instruction activates a test environment that is defined using the ENVIRONMENT instruction.

Syntax

USE <name> [ ( <expression> { , <expression> } ) ]

Description

The position of the USE instruction determines which tests are affected by the environment used:

  1. If USE occurs outside a SERVICE block, the instructions contained in this environment are applied to all subsequent ELEMENT blocks.

    If USE occurs within a SERVICE block and outside a TEST block, the instructions contained in this environment are applied to all subsequent ELEMENT blocks of this SERVICE block.

    If USE occurs within a TEST block and outside an ELEMENT block, the instructions contained in this environment are applied to all subsequent ELEMENT blocks of this TEST block.

    If USE occurs within an ELEMENT block, the instructions contained in this environment will only be applied to this block.

Because the USE instruction can appear at these four different levels, four priority levels are created from "outside a SERVICE block" (the lowest priority) to "inside an ELEMENT block" (the highest priority).

Within the same priority level, the last USE instruction is the one with the highest priority.

Testing is completed according to these priority rules, and on the basis that variables tested several times are included in the environment with the highest priority.

This is also true for every element of arrays described in extended mode.

If the environment it references takes parameters, the USE instruction must initialize these parameters using C expressions.

Associated Rules

The USE instruction can appear after BEGIN and outside an ENVIRONMENT block, after the definition of the environment it references.

<name> is the name of an environment declared by the ENVIRONMENT instruction.

<expression> must be an expression that conforms to C syntax and semantics.

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

USE compute_histo

Related Topics

ENVIRONMENT