Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / cfgFile / define / structured / structured.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2015 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 structured {
9
10 //2012-12-03
11
12 modulepar {
13 charstring tsp_1:="", tsp_2:="";
14 F tsp_3_1:={f1:={f2:={f3:="default1"}}};
15 F tsp_3_2:={f1:={f2:={f3:="default2"}}};
16 F tsp_3_3:={f1:={f2:={f3:="default3"}}};
17 RoC tsp_4 :={"default"}
18 RoRoF tsp_5_1:={{0.0}}, tsp_5_2:={{0.0}};
19 F2 tsp_30 :={ f3:="default"},tsp_31 :={ f3:="default"},tsp_32 :={ f3:="default"};
20 F2 tsp_33 :={ f3:="default"},tsp_34 :={ f3:="default"},tsp_35 :={ f3:="default"};
21 F2 tsp_36 :={ f3:="default"},tsp_37 :={ f3:="default"},tsp_38 :={ f3:="default"};
22 F2 tsp_39 :={ f3:="default"};
23 RoRoC tsp_41 :={},tsp_42 :={},tsp_43 :={},tsp_44 :={}, tsp_50:={};
24 E tsp_e1 :={ i:=0, f:=0.0,bs:='0'B,hs:='F'H,os:='00'O,cs:=""};
25 E tsp_e2 :={ i:=0, f:=0.0,bs:='0'B,hs:='F'H,os:='00'O,cs:=""};
26 E tsp_e3 :={ i:=0, f:=0.0,bs:='0'B,hs:='F'H,os:='00'O,cs:=""};
27 E tsp_e4 :={ i:=0, f:=0.0,bs:='0'B,hs:='F'H,os:='00'O,cs:=""};
28 U tsp_U_i:={ i:=0 };
29 U tsp_U_f:={ f:=0.0 };
30 U tsp_U_bs:={ bs:='0'B };
31 U tsp_U_hs:={ hs:='0'H };
32 U tsp_U_os:={ os:='00'O };
33 U tsp_U_cs1:={ cs:="" };
34 U tsp_U_cs2:={ cs:="" };
35 CR tsp_CR1:= CR_DEFAULT;
36 CR tsp_CR2:= CR_DEFAULT;
37 CR tsp_CR3:= CR_DEFAULT;
38 }
39 type component MyCT {}
40
41 type record of float RoF;
42 type record of RoF RoRoF;
43 type record of charstring RoC;
44 type record of RoC RoRoC;
45
46
47 type record F2 { charstring f3};
48 type record F1 { F2 f2 };
49 type record F { F1 f1 };
50
51 type record G { F1 f1, integer i};
52 type record H { F1 f1, integer i};
53 type record I { integer i }
54
55 //to check basic ttcn3 types:
56 type record E {
57 integer i,
58 float f,
59 bitstring bs,
60 hexstring hs,
61 octetstring os,
62 charstring cs
63 }
64
65 type union U {
66 integer i,
67 float f,
68 bitstring bs,
69 hexstring hs,
70 octetstring os,
71 charstring cs
72 }
73
74 //this record is constructed to reproduce the CR_TR00019403
75 type record CR {
76 bitstring rf_PowerCapability,
77 bitstring a5_1,
78 bitstring esind,
79 bitstring revisionLevel,
80 bitstring spare1_1,
81 bitstring fc,
82 bitstring vgcs,
83 bitstring vbs,
84 bitstring sm_Capability,
85 bitstring ss_ScreenIndicator,
86 bitstring ps_Capability,
87 bitstring spare2_1,
88 ClassmarkInformationType classmarkInformationType2_oct5
89 }
90
91 type record ClassmarkInformationType {
92 bitstring a5_2,
93 bitstring a5_3,
94 bitstring cmsp,
95 bitstring solsa,
96 bitstring ucs2,
97 bitstring lcsvacap,
98 bitstring spare,
99 bitstring cm3
100 }
101
102 const CR CLASSMARK2_GSM_ONLY :=
103 {
104 rf_PowerCapability := '000'B, // '000'B class1 (for GSM+DCS+PCS)
105 a5_1 := '0'B, //encryption algorithm A5/1 available ('1'B) or not ('0'B)
106 esind := '0'B,//controlled early classmark sending implemented ('1'B) or not ('0'B)
107 revisionLevel := '01'B, // '00'B reserved for phase1 (GSM+DCS)
108 spare1_1 := '0'B,
109 fc := '0'B, // MS' support of E/R_GSM ('1'B) or not ('0'B)
110 vgcs := '0'B, // VGCS capability or notification wanted ('1'B) or not ('0'B)
111 vbs := '0'B, // VBS capability or notification wanted ('1'B) or not ('0'B)
112 sm_Capability := '1'B, // SM capbility present ('1'B) or not ('0'B)
113 ss_ScreenIndicator := '01'B, // '00'B default value of phase1 (GSM+DCS)
114 ps_Capability := '0'B, // ignored, if received
115 spare2_1 := '0'B,
116 classmarkInformationType2_oct5 :=
117 { a5_2 := '0'B,
118 a5_3 := '0'B,
119 cmsp := '0'B,
120 solsa := '0'B,
121 ucs2 := '0'B,
122 lcsvacap := '1'B,
123 spare := '0'B,
124 cm3 := '1'B
125 }
126 }
127
128 const CR CR_DEFAULT := {
129 rf_PowerCapability := '000'B,
130 a5_1 := '0'B,
131 esind := '0'B,
132 revisionLevel := '00'B,
133 spare1_1 := '0'B,
134 fc := '0'B,
135 vgcs := '0'B,
136 vbs := '0'B,
137 sm_Capability := '0'B,
138 ss_ScreenIndicator := '00'B,
139 ps_Capability := '0'B,
140 spare2_1 := '0'B,
141 classmarkInformationType2_oct5 :=
142 { a5_2 := '0'B,
143 a5_3 := '0'B,
144 cmsp := '0'B,
145 solsa := '0'B,
146 ucs2 := '0'B,
147 lcsvacap := '0'B,
148 spare := '0'B,
149 cm3 := '0'B
150 }
151 }
152
153 //functions
154 function f_checkCR(in CR pl_data, in template CR pl_expected_data) {
155 if( match(pl_data,pl_expected_data)) {
156 setverdict(pass)
157 } else {
158 setverdict(fail,match(pl_data,pl_expected_data)) }
159 }
160
161 function f_checkE(in E pl_data, in template E pl_expected_data) {
162 if( match(pl_data,pl_expected_data)) {
163 setverdict(pass)
164 } else {
165 setverdict(fail,match(pl_data,pl_expected_data)) }
166 }
167
168 function f_checkF(in F pl_data, in template F pl_expected_data) {
169 if( match(pl_data,pl_expected_data)) {
170 setverdict(pass)
171 } else {
172 setverdict(fail,match(pl_data,pl_expected_data)) }
173 }
174
175 function f_checkF2(in F2 pl_data, in template F2 pl_expected_data) {
176 if( match(pl_data,pl_expected_data)) {
177 setverdict(pass)
178 } else {
179 setverdict(fail,match(pl_data,pl_expected_data)) }
180 }
181 function f_checkRoC(in RoC pl_data, in template RoC pl_expected_data) {
182 if( match(pl_data,pl_expected_data)) {
183 setverdict(pass)
184 } else {
185 setverdict(fail,match(pl_data,pl_expected_data)) }
186 }
187
188 function f_checkRoRoC(in RoRoC pl_data, in template RoRoC pl_expected_data) {
189 if( match(pl_data,pl_expected_data)) {
190 setverdict(pass)
191 } else {
192 setverdict(fail,match(pl_data,pl_expected_data)) }
193 }
194
195 function f_checkRoRoF(in RoRoF pl_data, in template RoRoF pl_expected_data) {
196 if( match(pl_data,pl_expected_data)) {
197 setverdict(pass)
198 } else {
199 setverdict(fail,match(pl_data,pl_expected_data)) }
200 }
201
202 function f_checkU(in U pl_data, in template U pl_expected_data) {
203 if( match(pl_data,pl_expected_data)) {
204 setverdict(pass)
205 } else {
206 setverdict(fail,match(pl_data,pl_expected_data)) }
207 }
208
209 //==================================================
210 //=============== Testcases ========================
211 //==================================================
212 testcase tc_F_simple() runs on MyCT {
213 var template F vl_expected:={f1:={f2:={f3:= "a"}}};
214 f_checkF(tsp_3_1,vl_expected);
215 }
216
217 testcase tc_F_comments() runs on MyCT {
218 var template F vl_expected:={f1:={f2:={f3:= "a"}}};
219 f_checkF(tsp_3_2,vl_expected);
220 }
221
222 testcase tc_F_embedded1() runs on MyCT {
223 var template F vl_expected:={f1:={f2:={f3:= "abrakadabra"}}};
224 f_checkF(tsp_3_3,vl_expected);
225 }
226
227 testcase tc_RoC_comments() runs on MyCT {
228 var template RoC vl_expected:={ "asdf" };
229 f_checkRoC(tsp_4,vl_expected);
230 }
231
232 testcase tc_F2_30() runs on MyCT {
233 var template F2 vl_expected:={ f3:="1" };
234 f_checkF2(tsp_30,vl_expected);
235 }
236
237 testcase tc_F2_31() runs on MyCT {
238 var template F2 vl_expected:={ f3:="1" };
239 f_checkF2(tsp_31,vl_expected);
240 }
241
242 testcase tc_F2_32() runs on MyCT {
243 var template F2 vl_expected:={ f3:="1" };
244 f_checkF2(tsp_32,vl_expected);
245
246 }
247
248 testcase tc_F2_33() runs on MyCT {
249 var template F2 vl_expected:={ f3:="a" };
250 f_checkF2(tsp_33,vl_expected);
251 }
252
253 testcase tc_F2_34() runs on MyCT {
254 var template F2 vl_expected:={ f3:="a" };
255 f_checkF2(tsp_34,vl_expected);
256 }
257
258 testcase tc_F2_35() runs on MyCT {
259 var template F2 vl_expected:={ f3:="a" };
260 f_checkF2(tsp_35,vl_expected);
261 }
262
263 testcase tc_F2_36() runs on MyCT {
264 var template F2 vl_expected:={ f3:="a" };
265 f_checkF2(tsp_36,vl_expected);
266 }
267
268 testcase tc_F2_37() runs on MyCT {
269 var template F2 vl_expected:={ f3:="a" };
270 f_checkF2(tsp_37,vl_expected);
271 }
272 testcase tc_F2_38() runs on MyCT {
273 var template F2 vl_expected:={ f3:="a" };
274 f_checkF2(tsp_38,vl_expected);
275 }
276
277 testcase tc_F2_39() runs on MyCT {
278 var template F2 vl_expected:={ f3:="${DEF_20}" };
279 f_checkF2(tsp_39,vl_expected);
280 }
281
282 testcase tc_RoRoC_41() runs on MyCT {
283 var template RoRoC vl_expected:={ };
284 f_checkRoRoC(tsp_41,vl_expected);
285 }
286 testcase tc_RoRoC_42() runs on MyCT {
287 var template RoRoC vl_expected:={ };
288 f_checkRoRoC(tsp_42,vl_expected);
289 }
290
291 testcase tc_RoRoC_43() runs on MyCT {
292 var template RoRoC vl_expected:={ };
293 f_checkRoRoC(tsp_43,vl_expected);
294 }
295 testcase tc_RoRoC_44() runs on MyCT {
296 var template RoRoC vl_expected:={{},{},{},{},{}};
297 f_checkRoRoC(tsp_44,vl_expected);
298 }
299
300 testcase tc_RoRoC_50() runs on MyCT {
301 var template RoRoC vl_expected:={{},{},{},{}};
302 f_checkRoRoC(tsp_50,vl_expected);
303 }
304
305 //=====================================================
306
307 testcase tc_E1() runs on MyCT {
308 var template E vl_expected:= {
309 i:=0,
310 f:=3.14,
311 bs:='0011'B,
312 hs:='123AF'H,
313 os:='0123AF'O,
314 cs:="hello"
315 }
316 f_checkE(tsp_e1,vl_expected);
317 }
318
319 testcase tc_E2() runs on MyCT {
320 var template E vl_expected:=
321 {i:=1,f:=7.2,bs:='0011'B,hs:='123AF'H,os:='0123AF'O,cs:="abrakadabra"};
322 f_checkE(tsp_e2,vl_expected);
323 }
324
325 testcase tc_E3() runs on MyCT {
326 var template E vl_expected:=
327 {i:=1,f:=7.2,bs:='0011'B,hs:='123AF'H,os:='0123AF'O,cs:="""abrakadabra"""};
328 f_checkE(tsp_e3,vl_expected);
329 }
330
331 testcase tc_E4() runs on MyCT {
332 var template E vl_expected:=
333 {i:=1,f:=7.2,bs:='0011'B,hs:='123AF'H,os:='0123AF'O,cs:="abrakadabra"};
334 f_checkE(tsp_e4,vl_expected);
335 }
336
337 testcase tc_U_i() runs on MyCT {
338 var template U vl_expected:=
339 {i:=1};
340 f_checkU(tsp_U_i,vl_expected);
341 }
342
343 testcase tc_U_f() runs on MyCT {
344 var template U vl_expected:=
345 {f:=7.2};
346 f_checkU(tsp_U_f,vl_expected);
347 }
348
349 testcase tc_U_bs() runs on MyCT {
350 var template U vl_expected:=
351 {bs:= '0011'B};
352 f_checkU(tsp_U_bs,vl_expected);
353 }
354
355 testcase tc_U_hs() runs on MyCT {
356 var template U vl_expected:=
357 {hs:= '123AF'H };
358 f_checkU(tsp_U_hs,vl_expected);
359 }
360
361 testcase tc_U_os() runs on MyCT {
362 var template U vl_expected:=
363 { os := '0123AF'O };
364 f_checkU(tsp_U_os,vl_expected);
365 }
366
367 testcase tc_U_cs1() runs on MyCT {
368 var template U vl_expected:=
369 {cs:= "abrakadabra" };
370 f_checkU(tsp_U_cs1,vl_expected);
371 }
372
373 testcase tc_U_cs2() runs on MyCT {
374 var template U vl_expected:=
375 {cs:= "abrakadabra" };
376 f_checkU(tsp_U_cs2,vl_expected);
377 }
378
379 testcase tc_CR_example1() runs on MyCT {
380 var template CR vl_expected:= CLASSMARK2_GSM_ONLY;
381 f_checkCR(tsp_CR1,vl_expected);
382 }
383
384 testcase tc_CR_example2() runs on MyCT {
385 var template CR vl_expected:= CLASSMARK2_GSM_ONLY;
386 f_checkCR(tsp_CR2,vl_expected);
387 }
388
389 testcase tc_CR_example3() runs on MyCT {
390 var template CR vl_expected:= CLASSMARK2_GSM_ONLY;
391 f_checkCR(tsp_CR3,vl_expected);
392 }
393 //==== CONTROL PART ====
394 control {
395
396 execute(tc_F_simple());
397 execute(tc_F_comments());
398 execute(tc_F_embedded1());
399 execute(tc_RoC_comments());
400 execute(tc_F2_30());
401 execute(tc_F2_31());
402 execute(tc_F2_32());
403 execute(tc_F2_33());
404 execute(tc_F2_34());
405 execute(tc_F2_35());
406 execute(tc_F2_36());
407 execute(tc_F2_37());
408 execute(tc_F2_38());
409 execute(tc_F2_39());
410 execute(tc_RoRoC_41());
411 execute(tc_RoRoC_42());
412 execute(tc_RoRoC_43());
413 execute(tc_RoRoC_44());
414 execute(tc_RoRoC_50());
415 execute(tc_E1());
416 execute(tc_E2());
417 execute(tc_E3());
418 execute(tc_E4());
419 execute(tc_U_i());
420 execute(tc_U_f());
421 execute(tc_U_bs());
422 execute(tc_U_hs());
423 execute(tc_U_os());
424 execute(tc_U_cs1());
425 execute(tc_U_cs2());
426 execute(tc_CR_example1());
427 execute(tc_CR_example2());
428 execute(tc_CR_example3());
429 }
430 }
This page took 0.098616 seconds and 5 git commands to generate.