conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 06_types_and_values / 0602_structured_types_and_values / 060204_enumerated_type_and_values / Sem_060204_enumerated_type_and_values_003.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:6.2.4, explicit numbering of enumerated items
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirement is tested:
17 // For each enumerated value without an assigned integer value, the system
18 // successively associates an integer number in the textual order of the
19 // enumerated values, starting at the left-hand side, beginning with zero, by
20 // step 1 and skipping any number occupied by any of the enumerated values with
21 // a manually assigned value. These values are only used by the system to allow
22 // the use of relational operators. The user shall not directly use associated
23 // integer values but can access them and convert integer values into enumerated
24 // values by using the predefined functions enum2int and int2enum (see clauses
25 // 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4).
26
27 module Sem_060204_enumerated_type_and_values_003 {
28
29 type component GeneralComp {
30 }
31
32 type enumerated EDays {
33 Monday(-1), Tuesday(4), Wednesday(0), Thursday(6), Friday(20)
34 };
35
36 testcase TC_Sem_060204_enumerated_type_and_values_003() runs on GeneralComp {
37 var EDays v_day0 := Monday, v_day2 := Wednesday, v_day4 := Friday;
38
39 if (enum2int(v_day0) == -1 and enum2int(v_day2) == 0 and enum2int(v_day4) == 20) {
40 setverdict(pass);
41 } else {
42 setverdict(fail);
43 }
44 }
45
46 control {
47 execute(TC_Sem_060204_enumerated_type_and_values_003());
48 }
49 }
This page took 0.032665 seconds and 5 git commands to generate.