IF ... ELSE ... END IF

C Test Script Language

Syntax

IF <condition> { , <condition> }

ELSE

END IF

Description

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

These statements enclose portions of script that are included depending on the presence of one of the conditions in the list provided to the C 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 scripting or native language.

IF and END IF instructions must appear simultaneously.

The ELSE instruction is optional.

The generating 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).

The IF...ELSE...END IF block is equivalent to the following block in C:

#if defined(<condition>) { || defined(<condition>) } ...

...

#else

...

#endif

Example

IF test_on_target

VAR register, init == , ev = 0

ELSE

VAR register, init = 0 , ev = 0

END IF