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_SW { //^In TTCN-3 module `enum_to_SW'://
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// \
51 //^warning: Control never reaches this code because of previous effective condition\(s\)//
53 and (e2ivar1_2 == enum2int(enumvar1_2)))
55 else {setverdict(fail);} //^In else statement// \
56 //^warning: Control never reaches this code because of previous effective condition\(s\)//
58 and (e2ivar1_3 == enum2int(enumvar1_3)))
60 else {setverdict(fail);} //^In else statement// \
61 //^warning: Control never reaches this code because of previous effective condition\(s\)//
64 and (e2ivar2_1 == enum2int(enumvar2_1)))
66 else {setverdict(fail);} //^In else statement// \
67 //^warning: Control never reaches this code because of previous effective condition\(s\)//
69 and (e2ivar2_2 == enum2int(enumvar2_2)))
71 else {setverdict(fail);} //^In else statement// \
72 //^warning: Control never reaches this code because of previous effective condition\(s\)//
74 and (e2ivar2_3 == enum2int(enumvar2_3)))
76 else {setverdict(fail);} //^In else statement// \
77 //^warning: Control never reaches this code because of previous effective condition\(s\)//
80 and (e2ivar3_1 == enum2int(enumvar3_1)))
82 else {setverdict(fail);} //^In else statement// \
83 //^warning: Control never reaches this code because of previous effective condition\(s\)//
85 and (e2ivar3_2 == enum2int(enumvar3_2)))
87 else {setverdict(fail);} //^In else statement// \
88 //^warning: Control never reaches this code because of previous effective condition\(s\)//
90 and (e2ivar3_3 == enum2int(enumvar3_3)))
92 else {setverdict(fail);} //^In else statement// \
93 //^warning: Control never reaches this code because of previous effective condition\(s\)//
98 execute (enum_to_int());