IF ... ELSE ... END IF

Ada Test Script Language

Purpose

The IF, ELSE and END IF statements allow conditional generation of the test driver.

Syntax

IF <condition> { , <condition> }

ELSE

END IF

where:

  • <condition> is an identifier sent by the -define option to the Ada Test Script Compiler.

Description

These statements enclose portions of script that are included depending on the presence of one of the conditions in the list provided to the Ada Test Script Compiler by the -define option.

The <condition> list forms a series of conditions that is equivalent to using an expression of logical ORs.

The IF instruction starts the conditional generation block.

The END IF instruction terminates this block.

The ELSE instruction separates the condition block into 2 parts, one being included when the other is not.

Associated Rules

<condition> is any identifier. You must have at least one condition in an IF instruction.

This block can contain any code written in Ada Test Script Language or native Ada.

IF and END IF instructions must appear simultaneously.

The ELSE instruction is optional.

The generation rules are as follows:

  • If at least one of the conditions specified in the IF instruction's list of conditions appears in the list associated with the -define option, the first part of the block is included.

    If none of the conditions specified in the IF instruction appears in the list associated with the -define option, then the second part of the block is included (if ELSE is present).

Example

IF test_on_target

VAR register, init == , ev = 0

ELSE

VAR register, init = 0 , ev = 0

END IF

Related Topics

SIMUL ... ELSE_SIMUL ... END SIMUL