# enumerated

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

- Enumerated types are never compatible with other basic or structured types.
- For each enumeration without an assigned integer value, the system successively associates an integer number in the textual order of the enumerations, starting at the left-hand side, beginning with zero, by step 1 and skipping any number occupied in any of the enumerations with a manually assigned value. These values are only used by the system to allow the use of relational operators.
- Operations on enumeration are restricted to assignment, equivalence and ordering operators

Related keywords:

- type
- address

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

- The type keyword introduces the type definition.

- identifier is the name used to refer to the enumeration. Must begin with a letter, may contain letters, numbers and underscore characters.

- address is a user defined type to allow addressing specific entities inside the System Under Test.

- enumeration_identifier identifies the elements of the enumeration. The identifiers must be unique within the same enumeration

- integer is the value optionally assigned to the enumeration element.

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