1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 module enum_to_OK { //^In TTCN-3 module `enum_to_OK'://
10 type component PDTestComponent {};
12 /*--- ENUM2INT --------------------------------------------------*/
14 type enumerated MyFirstEnumType { Monday, Tuesday, Wednesday, Thursday, Friday };
15 type enumerated MySecondEnumType { Saturday, Sunday, Monday };
16 type enumerated MyThirdEnumType { first(-3), second (0), third };
19 testcase enum_to_int() runs on PDTestComponent{ //In testcase definition//
21 const MyFirstEnumType enumvar1_1 := Monday;
22 const MyFirstEnumType enumvar1_2 := Wednesday;
23 const MyFirstEnumType enumvar1_3 := Friday;
25 const MySecondEnumType enumvar2_1 := Monday;
26 const MySecondEnumType enumvar2_2 := Saturday;
27 const MySecondEnumType enumvar2_3 := Sunday;
29 const MyThirdEnumType enumvar3_1 := third;
30 const MyThirdEnumType enumvar3_2 := first;
31 const MyThirdEnumType enumvar3_3 := second;
34 const integer e2ivar1_1 := enum2int(enumvar1_1); // returns 0
35 const integer e2ivar1_2 := enum2int(enumvar1_2); // returns 2
36 const integer e2ivar1_3 := enum2int(enumvar1_3); // returns 4
38 const integer e2ivar2_1 := enum2int(enumvar2_1); // returns 2
39 const integer e2ivar2_2 := enum2int(enumvar2_2); // returns 0
40 const integer e2ivar2_3 := enum2int(enumvar2_3); // returns 1
42 const integer e2ivar3_1 := enum2int(enumvar3_1); // returns 1
43 const integer e2ivar3_2 := enum2int(enumvar3_2); // returns -3
44 const integer e2ivar3_3 := enum2int(enumvar3_3); // returns 0
48 and (e2ivar1_1 == enum2int(enumvar1_1)))
50 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
52 and (e2ivar1_2 == enum2int(enumvar1_2)))
54 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
56 and (e2ivar1_3 == enum2int(enumvar1_3)))
58 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
61 and (e2ivar2_1 == enum2int(enumvar2_1)))
63 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
65 and (e2ivar2_2 == enum2int(enumvar2_2)))
67 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
69 and (e2ivar2_3 == enum2int(enumvar2_3)))
71 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
74 and (e2ivar3_1 == enum2int(enumvar3_1)))
76 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
78 and (e2ivar3_2 == enum2int(enumvar3_2)))
80 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
82 and (e2ivar3_3 == enum2int(enumvar3_3)))
84 else {setverdict(fail);} //In else statement// //Control never reaches this code because of previous effective condition\(s\)//
89 execute (enum_to_int());