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 size_of_SW { //^In TTCN-3 module `size_of_SW'://
10 type port myPort message { inout integer } with { extension "internal" }
12 type component PDTestComponent {
13 port myPort portArr[5];
16 /*--- SIZEOF ON RECORDOF --------------------------------------------------*/
18 type record of integer sirortype1
19 type record of sirortype1 sirortype2
26 const sirortype1 siro1 := {}
27 const sirortype1 siro2 := {1}
28 const sirortype1 siro3 := {1,2}
30 const sirortype2 siro4 := {{}}
31 const sirortype2 siro5 := {{},{}}
32 const sirortype2 siro6 := {{1},{1,2}}
34 const integer sirocon1 := sizeof(siro1)
35 const integer sirocon2 := sizeof(siro2)
36 const integer sirocon3 := sizeof(siro3)
38 const integer sirocon4 := sizeof(siro4)
39 const integer sirocon5 := sizeof(siro5)
40 const integer sirocon6 := sizeof(siro5[1])
41 const integer sirocon7 := sizeof(siro6[1])
44 testcase sizeof_recof() runs on PDTestComponent{ //^In testcase definition//
47 and (sirocon1 == sizeof(siro1)))
49 else {setverdict(fail);} //^In else statement// \
50 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
52 and (sirocon2 == sizeof(siro2)))
54 else {setverdict(fail);} //^In else statement// \
55 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
57 and (sirocon3 == sizeof(siro3)))
59 else {setverdict(fail);} //^In else statement// \
60 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
62 and (sirocon4 == sizeof(siro4)))
64 else {setverdict(fail);} //^In else statement// \
65 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
67 and (sirocon5 == sizeof(siro5)))
69 else {setverdict(fail);} //^In else statement// \
70 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
72 and (sirocon6 == sizeof(siro5[1])))
74 else {setverdict(fail);} //^In else statement// \
75 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
77 and (sirocon7 == sizeof(siro6[1])))
79 else {setverdict(fail);} //^In else statement// \
80 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
82 if (sizeof(R: {1, 0.0}) == 2) {
84 } else { setverdict(fail);} //^In else statement// \
85 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
87 var template R tr := {1, 0.0};
88 if (sizeof(modifies tr := {2, 1.0}) == 2) {
90 } else { setverdict(fail);} //^In else statement// \
91 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
92 if (sizeof(modifies tr := {2, omit}) == 1) {
94 } else { setverdict(fail);} //^In else statement// \
95 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
99 /*--- SIZEOF ON SETOF --------------------------------------------------*/
101 type set of integer sisostype1
102 type set of sisostype1 sisostype2
104 const sisostype1 siso1 := {}
105 const sisostype1 siso2 := {1}
106 const sisostype1 siso3 := {1,2}
107 const sisostype2 siso4 := {{}}
108 const sisostype2 siso5 := {{},{}}
109 const sisostype2 siso6 := {{1},{1,2}}
111 const integer sisocon1 := sizeof(siso1)
112 const integer sisocon2 := sizeof(siso2)
113 const integer sisocon3 := sizeof(siso3)
115 const integer sisocon4 := sizeof(siso4)
116 const integer sisocon5 := sizeof(siso5)
117 const integer sisocon6 := sizeof(siso5[1])
118 const integer sisocon7 := sizeof(siso6[1])
121 testcase sizeof_setof() runs on PDTestComponent{ //^In testcase definition//
124 and (sisocon1 == sizeof(siso1)))
126 else {setverdict(fail);} //^In else statement// \
127 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
129 and (sisocon2 == sizeof(siso2)))
131 else {setverdict(fail);} //^In else statement// \
132 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
134 and (sisocon3 == sizeof(siso3)))
136 else {setverdict(fail);} //^In else statement// \
137 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
139 and (sisocon4 == sizeof(siso4)))
141 else {setverdict(fail);} //^In else statement// \
142 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
144 and (sisocon5 == sizeof(siso5)))
146 else {setverdict(fail);} //^In else statement// \
147 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
149 and (sisocon6 == sizeof(siso5[1])))
151 else {setverdict(fail);} //^In else statement// \
152 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
154 and (sisocon7 == sizeof(siso6[1])))
156 else {setverdict(fail);} //^In else statement// \
157 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
160 /*--- SIZEOF ON ARRAY --------------------------------------------------*/
162 type record of integer siarrtype
164 const siarrtype siar1[1] := {{}}
165 const siarrtype siar2[1] := {{1}}
166 const siarrtype siar3[3] := {{},{1},{1,2}}
169 const integer siarcon1 := sizeof(siar1)
170 const integer siarcon2 := sizeof(siar2)
171 const integer siarcon3 := sizeof(siar3)
173 testcase sizeof_array() runs on PDTestComponent{ //^In testcase definition//
176 and (siarcon1 == sizeof(siar1)))
178 else {setverdict(fail);} //^In else statement// \
179 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
181 and (siarcon2 == sizeof(siar2)))
183 else {setverdict(fail);} //^In else statement// \
184 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
186 and (siarcon3 == sizeof(siar3)))
188 else {setverdict(fail);} //^In else statement// \
189 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
191 if (sizeof(portArr) == 5)
193 else {setverdict(fail);} //^In else statement// \
194 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
197 if (sizeof(myTA) == 2)
199 else {setverdict(fail);} //^In else statement// \
200 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
205 execute (sizeof_recof());
206 execute (sizeof_setof());
207 execute (sizeof_array());