IBM
Contents Index Previous Next



TTCN Expressions


All values in TTCN are quite simply expressions. Note that the TTCN syntax allows the operands of expressions to be:

Exactly which variables etc. may be used in an expression depends on the context in which the expression is used. This aspect will be discussed in the relevant sections.

TTCN Operators

TTCN supports the following kinds of operators for use in expressions:

Arithmetic Operators

TTCN supports the following arithmetic operators for use only with operands of INTEGER type or derivations of INTEGER type:

Expressions that use these operators are called arithmetic expressions.

Equality Operator

The equal to and not equal to operators may be used on values of any type:

Expressions that use these operators must always evaluate to a BOOLEAN value:

Other Relational Operators

TTCN supports the following relational operators for use only with operands of INTEGER type or derivations of INTEGER type:

Expressions that use these operators must always evaluate to a BOOLEAN value:

Boolean Operators

TTCN supports the following logical operators for use only with operands of BOOLEAN type or derivations of BOOLEAN type:

Expressions that use these operators must always evaluate to a BOOLEAN value:

Qualifiers

A qualifier is an expression enclosed in square brackets:

The expression must evaluate to a BOOLEAN value.

Assignment Lists

A TTCN statement may be an ASSIGNMENT_LIST, i.e. a list of assignments, separated by commas and enclosed in parentheses:

The left-hand side (l.h.s.) of an assignment must resolve to a variable. In the context of SEND and RECEIVE statements the l.h.s. of an assignment may resolve to an ASP parameter reference, a PDU field reference or a structure element reference. The right-hand side (r.h.s.) of the assignment is an expression, which must evaluate to a value of a type compatible with the type of the l.h.s.

Note:

By type compatibility we quite simply mean that a value, a, of type A is type compatible with type B if a is a legal value of both type A and type B.

TTCN Operations

TTCN supports both a number of predefined operations and a mechanism that allows the definition of user operations. Operations may be used as operands in expressions.

Predefined Operations

TTCN now supports a number of predefined operations. More are expected to be added by the work on TTCN extensions. Currently these operations are:

User Defined Operations

TTCN allows the informal definition of user define operations. A possible approach is to use a programing language to `describe' the operation.

Note:

The TTCN amendment (PDAM 2) is currently exploring ways of how user operation descriptions can be made more `formal'.

Like the predefined operations user defined operations may be used in both behaviour trees and as `values' in constraints.

Each user defined operations is declared in a Test Suite Operations table.

Case study 11: Definition of a user defined operation.

Figure 28 : Test Suite Operation Definition

If an operator does not have any arguments it should be called with an empty actual parameter list, e.g. DATE ( ).


http://www.ibm.com/rational
Contents Index Previous Next