![]() |
![]() |
![]() |
![]() |
![]() |
The keyword denotes a structured type representing an unordered sequence of elements, i.e., the ordering of the set fields is not significant. Each element consists of a type and an identifier.
Related keywords:
type set (identifier | address) { type_reference element_identifier [ optional ] ... }; |
The type set keywords introduce the type definition.
identifier is the name used to refer to the set. 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.
type_reference refers to an already defined (structured or simple) type.
element_identifier identifies the elements of the set. The identifiers must be unique within the same set
... indicates that type_reference element_identifier pairs may be repeated. They are separated by comma.
type set [ length (set_size) ] of type_reference identifier }; |
The type set of keywords introduce the type definition.
The optional length keyword denotes that the size of the set is restricted.
set_size is the size restriction. When a single integer value is given, it specifies the exact size of the set. When two integer values are given (separated by two dots), the minimal and the maximal length of the set are given.
type_reference refers to an already defined (structured or simple) type.
identifier is the name used to refer to the set. Must begin with a letter, may contain letters, numbers and underscore characters.
Example 1: type definition
type set MySetType {
integer Number1 optional,
integer Number2,
charstring String
}
The set called MySetType consists of three elements. There are two fields of type integer having the identifier Number1 (optional) and Number2 . There is one field of type character string and having the identifier String.
Example 2: dot notation (For the type definition see example 1)
var MySetType v_mySet;
v_mySet.Number1 := omit;
v_mySet.Number2 := 12;
The variable v_mySet of type MySetType is defined. The first field (Number1) is omitted and the value 12 is assigned to the field Number2.
Example 3: assignment notation (For the type and variable definition see example 1 & 2)
v_mySet := {Number2 := 112};
The value 112 is assigned to the field Number2.
Example 4: the predefined function sizeof()
v_mySet := {Number1 := omit, Number2 := 191, String := "s"};
var integer v_Stk := sizeof (v_mySet);
The variable v_Stk equals two as there are two elements in v_mySet (the first one is omitted).
Example 5: the predefined function ispresent()
v_mySet := {Number1 := omit, Number2 := 191, String := "s"};
var boolean v_kukuccs := ispresent (v_mySet.Number1);
The variable v_kukuccs equals false as there the referenced element in v_mySet (Number1) is omitted.
Example 6: set of the same element type
type set length (3) of integer IntegerList;
var IntegerList v_il := {71, 92, 83};
var integer v_elem := v_il[1];
A set of three integers is defined. The set is called IntegerList.
To assign values to the elements of the set, value list notation is used. The elements of the set will have the value 71, 92 and 83, respectively.
Individual elements of the set may be accessed using the array notation. In the example above the variable v_elem will have the value 92.
BNF definition of set
BNF definition of set of