Titan



enumerated


The keyword denotes a structured type which can take only a distinct named set of values. It cannot be parameterized. 

Related keywords:


type enumerated (identifier  | address){
  enumeration_identifier [(integer )] [, enumeration_identifier [(integer )]] };


Example 1:

type enumerated Example {tisdag, fredag, onsdag};

The enumeration called Example consists of three elements. The number 0 is assigned to the first one (tisdag), the number 1 to "fredag" and number 2 to the last element (onsdag).

Example 2:

type enumerated Examplf {tisdag (2), fredag (-5), onsdag};

The enumeration called Examplf consists of three elements. Note, that the same element names may be used as in example 1 because they must be unique only within the same enumeration. The optional integer value determines the value assigned to the element name. Thus, "tisdag" has the value 2, "fredag" the value -5 and onsdag has been assigned the value zero. (The first free value from 0 upwards is assigned to elements without the optional integer value.)

Example 3:

type enumerated address {first_entity, second_entity};

There are two entities in the system under test (SUT). We can refer to the first one using the element name "first_entity" whereas the other entity is addressed by the element name "second_entity".


BNF definition of enumerated