Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / ispresent / IsPresent_Test.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 //Purpose: To test function ispresent()
9 //Last modified:2013-01-09 ETHBAAT
10 //It should be run in parallel mode
11
12 module IsPresent_Test {
13
14 modulepar integer tsp_repeatN :=100;
15
16 type port MyChrMessage_PT message {
17 inout charstring
18 } with { extension "internal"}
19
20 type component MTC_CT {
21 port MyChrMessage_PT my_PCO;
22 //var integer v_counter1 :=0;
23
24 }
25 //===== SIMPLE, NOT TOO DEEP =====
26 type record of charstring ROC;
27 type record of integer ROI;
28 type record MyRecord {
29 integer i optional,
30 float x optional,
31 charstring c
32 }
33
34 type record of ROI ROROI;
35
36 type union MyUnion1 {
37 ROC roc,
38 integer i,
39 ROI roi,
40 MyRecord r
41 }
42
43 const MyUnion1 c_myunion1:= { roc:= { "1aa", "2bb", "3cc"}}
44 const MyUnion1 c_myunion2:= { i:= 5}
45
46
47 //====== DEEP 3===============
48 type record MyRec2 {
49 ROC roc optional,
50 ROI roi optional,
51 MyUnion1 u optional,
52 MyRecord r optional
53 }
54
55 type record of MyRec2 MyRecOf
56
57 type record MyRec3{
58 ROROI roroi optional,
59 MyRec2 r optional
60 }
61
62 const MyRec2 c_myrec2_1:={
63 roc:=omit,
64 roi:={},
65 u:={r:={ i:=1, x:=1.0, c:="one"}},
66 r:={ i:=1, x:=1.0, c:="one"}
67 }
68 const MyRec2 c_myrec2_2:={
69 roc:={},
70 roi:={10,9,8},
71 u:={r:={ i:=1, x:=1.0, c:="one"}},
72 r:={ i:=1, x:=1.0, c:="one"}
73 }
74
75
76 //partially initialized record:
77 const MyRec2 c_myrec2_part:={
78 roc:={},
79 roi:={10,9,8},
80 u:={ r:={ /*i:=1,*/ x:=1.0, c:="one"}},
81 r:={ i:=1, x:=1.0, c:="one"}
82 }
83 const MyRec3 c_myrec3_1 := {
84 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
85 r:= omit
86 }
87
88 const MyRec3 c_myrec3_2 := {
89 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
90 r:= {
91 roc:={},
92 roi:={},
93 u:={i:=5},
94 r:=omit
95 }
96 }
97
98 const MyRec3 c_myrec3_innerOmits := {
99 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
100 r:= {
101 roc:=omit,
102 roi:=omit,
103 u:=omit,
104 r:=omit
105 }
106 }
107
108
109 //==== Templates =====
110
111
112 //===== SIMPLE TYPES =====
113 testcase tc_simple_charstring_unbound() runs on MTC_CT {
114 var charstring vl_ch;
115 if(ispresent(vl_ch)){setverdict(fail)} else {setverdict(pass)}
116 }
117
118
119 testcase tc_simple_charstring_isvalue() runs on MTC_CT {
120 var charstring vl_ch:="honey";
121 if(ispresent(vl_ch)) { setverdict(pass)} else {setverdict(fail)}
122 }
123
124 testcase tc_simple_charstring_template_unbound() runs on MTC_CT {
125 var template charstring vlt_ch;
126 if(ispresent(vlt_ch)){setverdict(fail)} else {setverdict(pass)}
127 }
128
129 testcase tc_simple_charstring_template_isvalue() runs on MTC_CT {
130 var template charstring vlt_ch:="AB?D*"
131 if(ispresent(vlt_ch)) {setverdict(pass)} else {setverdict(fail)}
132
133 }
134
135 testcase tc_simple_charstring_template_pattern() runs on MTC_CT {
136 var template charstring vlt_ch;
137 vlt_ch:= pattern "AB?D"
138 if(ispresent(vlt_ch)) {setverdict(pass)} else {setverdict(fail)}
139 }
140
141 testcase tc_simple_integer_unbound() runs on MTC_CT {
142 var integer vl_i;
143 if(ispresent(vl_i)){setverdict(fail)} else {setverdict(pass)} //fail
144 }
145
146 testcase tc_simple_integer_value() runs on MTC_CT {
147 var integer vl_i:=5;
148 if(ispresent(vl_i)) {setverdict(pass)} else {setverdict(fail)} //pass,
149 }
150
151 testcase tc_simple_integer_templ_asterix() runs on MTC_CT {
152 var template integer vtl_i :=*;
153 if(ispresent( vtl_i )) {setverdict(fail)}else {setverdict(pass)};
154 }
155
156 testcase tc_simple_integer_templ_qm() runs on MTC_CT {
157 var template integer vtl_i :=?;
158 if(ispresent( vtl_i )) {setverdict(pass)}else {setverdict(fail)};
159 }
160
161 testcase tc_simple_integer_templ_value() runs on MTC_CT {
162 var template integer vtl_i:=5;
163 if(ispresent( vtl_i )) {setverdict(pass)}else {setverdict(fail)};
164 }
165
166 testcase tc_simple_octetstring_unbound() runs on MTC_CT {
167 var octetstring vl_o;
168 if(ispresent(vl_o)){setverdict(fail)} else {setverdict(pass)} //fail
169 }
170
171 testcase tc_simple_octetstring_isvalue() runs on MTC_CT {
172 var octetstring
173 vl_o:='ABBA'O;
174 if(ispresent(vl_o)) {setverdict(pass)} else {setverdict(fail)} //not logged
175 }
176
177 //======= SPECIAL TYPES ======
178
179 altstep as_empty() runs on MTC_CT {
180 [] my_PCO.receive {}
181 };
182
183 function f_empty() runs on MTC_CT {
184 }
185
186 testcase tc_special_default_value_unbound() runs on MTC_CT {
187 var default vl_default;
188 if(ispresent(vl_default)){setverdict(fail)}else {setverdict(pass)};
189 }
190
191 testcase tc_special_default_value_null() runs on MTC_CT {
192 var default vl_default := null;
193 if(ispresent(vl_default)) {setverdict(pass)} else {setverdict(fail)}
194 }
195 testcase tc_special_default_value_isvalue() runs on MTC_CT {
196 var default vl_default := activate(as_empty());
197 if(ispresent(vl_default)){setverdict(pass)}else {setverdict(fail)};
198
199 deactivate(vl_default);
200 if(ispresent(vl_default)){setverdict(pass)}else {setverdict(fail)};
201 }
202
203 testcase tc_special_compref_unbound() runs on MTC_CT {
204 var MTC_CT vc_myComp;
205 if(ispresent(vc_myComp)){setverdict(fail)}else {setverdict(pass)};
206 }
207
208 testcase tc_special_compref_isvalue() runs on MTC_CT {
209 var MTC_CT vc_myComp:= MTC_CT.create("hali");
210 if(ispresent(vc_myComp)){setverdict(pass)}else {setverdict(fail)};
211
212 vc_myComp.start(f_empty());
213 if(ispresent(vc_myComp)){setverdict(pass)}else {setverdict(fail)};
214
215 vc_myComp.done;
216 if(ispresent(vc_myComp)){setverdict(pass)}else {setverdict(fail)};
217 }
218
219 //========= Compound =====
220 testcase tc_unionOfRecordOfs1() runs on MTC_CT {
221 var MyUnion1 vl_u:= c_myunion1;
222 if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
223 }
224 testcase tc_unionOfRecordOfs1_2() runs on MTC_CT {
225 var MyUnion1 vl_u:= c_myunion1;
226 if(ispresent(vl_u.roc)){setverdict(pass)} else {setverdict(fail)}
227 if(ispresent(vl_u.roc[0])){setverdict(pass)}else {setverdict(fail)}
228 if(ispresent(vl_u.roc[1])){setverdict(pass)}else {setverdict(fail)}
229 if(ispresent(vl_u.roc[2])){setverdict(pass)}else {setverdict(fail)}
230 if(ispresent(vl_u.roc[3])){setverdict(fail)}else {setverdict(pass)}
231 if(ispresent(vl_u.roc[99])){setverdict(fail)}else {setverdict(pass)}
232 if(ispresent(vl_u.i)){setverdict(fail)}else {setverdict(pass)}
233 if(ispresent(vl_u.roi)){setverdict(fail)}else {setverdict(pass)}
234 if(ispresent(vl_u.roi[0])){setverdict(fail)}else {setverdict(pass)}
235 if(ispresent(vl_u.roi[1])){setverdict(fail)} else {setverdict(pass)}
236 }
237
238 testcase tc_unionOfRecordOfs2() runs on MTC_CT {
239 var MyUnion1 vl_u:= c_myunion2;
240 if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
241 if(ispresent(vl_u.roc)){setverdict(fail)} else {setverdict(pass)}
242 if(ispresent(vl_u.roc[0])){setverdict(fail)} else {setverdict(pass)}
243 if(ispresent(vl_u.roc[1])){setverdict(fail)} else {setverdict(pass)}
244 if(ispresent(vl_u.roc[2])){setverdict(fail)} else {setverdict(pass)}
245 if(ispresent(vl_u.roc[3])){setverdict(fail)} else {setverdict(pass)}
246 if(ispresent(vl_u.roc[99])){setverdict(fail)} else {setverdict(pass)}
247 if(ispresent(vl_u.r)){setverdict(fail)} else {setverdict(pass)};
248 if(ispresent(vl_u.r.i)){setverdict(fail)} else {setverdict(pass)};
249 if(ispresent(vl_u.r.x)){setverdict(fail)} else {setverdict(pass)};
250 if(ispresent(vl_u.r.c)){setverdict(fail)} else {setverdict(pass)};
251 //checks if the selected item remained the same
252 if(ispresent(vl_u.i)){setverdict(pass)}else {setverdict(fail)}
253 if(ispresent(vl_u.roi)){setverdict(fail)} else {setverdict(pass)}
254 if(ispresent(vl_u.roi[0])){setverdict(fail)}else {setverdict(pass)}
255 if(ispresent(vl_u.roi[1])){setverdict(fail)} else {setverdict(pass)}
256 }
257
258
259 // testcase tc_compilationerror1() runs on MTC_CT {
260 // var MyUnion1 vl_u:= c_myunion2;
261 // if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
262 // if(ispresent(vl_u.roc)){setverdict(fail)} else {setverdict(pass)}
263 // if(ispresent(vl_u.roc[0])){setverdict(fail)}else {setverdict(pass)}
264 // if(ispresent(vl_u.r.x)){setverdict(fail)}else {setverdict(pass)}
265 // if(ispresent(vl_u.roc[99])){setverdict(fail)} else {setverdict(pass)}
266 // }
267
268
269
270 testcase tc_union_modify() runs on MTC_CT {
271 var MyUnion1 vl_u:= c_myunion2;
272 if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
273 if(ispresent(vl_u.roc)){setverdict(fail)} else {setverdict(pass)}
274 if(ispresent(vl_u.roi)){setverdict(fail)} else {setverdict(pass)}
275
276 vl_u:=c_myunion1;
277 if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
278 if(ispresent(vl_u.roc)){setverdict(pass)} else {setverdict(fail)}
279 if(ispresent(vl_u.roc[0])){setverdict(pass)}else {setverdict(fail)}
280 if(ispresent(vl_u.roc[1])){setverdict(pass)}else {setverdict(fail)}
281 if(ispresent(vl_u.roc[2])){setverdict(pass)}else {setverdict(fail)}
282 if(ispresent(vl_u.roc[3])){setverdict(fail)}
283 if(ispresent(vl_u.roc[99])){setverdict(fail)}
284 if(ispresent(vl_u.i)){setverdict(fail)}
285 if(ispresent(vl_u.roi)){setverdict(fail)}
286 if(ispresent(vl_u.roi[0])){setverdict(fail)}
287 if(ispresent(vl_u.roi[1])){setverdict(fail)} else {setverdict(pass)}
288 }
289 //expected:error
290 testcase tc_sideeffect1() runs on MTC_CT {
291 var MyUnion1 vl_u:= c_myunion1; // { roc:= { "1aa", "2bb", "3cc"}}
292 if(ispresent(vl_u.roc[2])){setverdict(pass)}else {setverdict(fail)}
293 if(ispresent(vl_u.roc[3])){setverdict(fail)}else {setverdict(pass)}
294 }
295
296 //expected:error
297 testcase tc_sideeffect2() runs on MTC_CT {
298 var MyUnion1 vl_u:= c_myunion1; // { roc:= { "1aa", "2bb", "3cc"}}
299 var integer vl_oldsize:=0, vl_newsize:=0;
300 vl_oldsize:=sizeof(vl_u.roc);
301
302 if(ispresent(vl_u.i)){setverdict(fail)}else {setverdict(pass)}
303
304 if(ispresent(vl_u.roc)) {setverdict(pass)}else {setverdict(fail)}
305
306 //checks if size is unchenged
307 if(ispresent(vl_u.roc[4])) {setverdict(fail)}else {setverdict(pass)}
308 vl_newsize:=sizeof(vl_u.roc);
309 if(vl_newsize == vl_oldsize) {setverdict(pass)}else {setverdict(fail)}
310 }
311
312 //====== DEEP 2-3 ===============
313
314
315 testcase tc_recordOf_omit1() runs on MTC_CT {
316 var MyRec2 vl_r:=c_myrec2_1;
317 if(ispresent(vl_r.roc)){setverdict(fail)}else {setverdict(pass)};
318 }
319
320 testcase tc_recordOf_omit2() runs on MTC_CT {
321 var MyRec2 vl_r:=c_myrec2_1;
322 if(ispresent(vl_r.roc[0])){setverdict(fail)}else {setverdict(pass)};
323 }
324
325 testcase tc_recordOf_emptyRoi1() runs on MTC_CT {
326 var MyRec2 vl_r:=c_myrec2_1;
327 if(ispresent(vl_r.roi)){setverdict(pass)}else {setverdict(fail)};
328 }
329
330 testcase tc_recordOf_emptyRoi2() runs on MTC_CT {
331 var MyRec2 vl_r:=c_myrec2_1;
332 if(ispresent(vl_r.roi[0])){setverdict(fail)}else {setverdict(pass)};
333 }
334
335 testcase tc_recordOf_emptyRoi3() runs on MTC_CT {
336 var MyRec2 vl_r:=c_myrec2_1;
337 if(ispresent(vl_r.roi[90])){setverdict(fail)}else {setverdict(pass)};
338 }
339
340 testcase tc_record_unbound() runs on MTC_CT {
341 var template MyRec2 vtl_rec2;
342 if(ispresent(vtl_rec2)) {setverdict(fail)}else {setverdict(pass)};
343 }
344
345 testcase tc_record_completlyInit() runs on MTC_CT {
346 var MyRec2 vl_r:=c_myrec2_1;
347 if(ispresent(vl_r)){setverdict(pass)}else {setverdict(fail)};
348 }
349
350 testcase tc_record_partiallyInit1() runs on MTC_CT {
351 var MyRec2 vl_r:=c_myrec2_part;
352 if(ispresent(vl_r)){setverdict(pass)}else {setverdict(fail)};
353 }
354
355
356 testcase tc_record_partiallyInit3() runs on MTC_CT {
357 var MyRec2 vl_r:=c_myrec2_part;
358 if(ispresent(vl_r.roc)){setverdict(pass)}else {setverdict(fail)};
359 }
360
361 testcase tc_record_partiallyInit4() runs on MTC_CT {
362 var MyRec2 vl_r:=c_myrec2_part;
363 if(ispresent(vl_r.roi)){setverdict(pass)}else {setverdict(fail)};
364 }
365
366 testcase tc_record_partiallyInit5() runs on MTC_CT {
367 var MyRec2 vl_r:=c_myrec2_part;
368 if(ispresent(vl_r.u)){setverdict(pass)}else {setverdict(fail)};
369 }
370
371 testcase tc_record_partiallyInit6() runs on MTC_CT {
372 var MyRec2 vl_r:=c_myrec2_part;
373 if(ispresent(vl_r.u.r)){setverdict(pass)}else {setverdict(fail)};
374 }
375
376 testcase tc_record_partiallyInit7() runs on MTC_CT {
377 var MyRec2 vl_r:=c_myrec2_part;
378 if(ispresent(vl_r.u.r.i)){setverdict(fail)}else {setverdict(pass)};
379 }
380
381 testcase tc_record_partiallyInit8() runs on MTC_CT {
382 var MyRec2 vl_r:=c_myrec2_part;
383 if(ispresent(vl_r.u.r.x)){setverdict(pass)}else {setverdict(fail)};
384 }
385
386 testcase tc_record_partiallyInit9() runs on MTC_CT {
387 var MyRec2 vl_r:=c_myrec2_part;
388 if(ispresent(vl_r.u.r.c)){setverdict(pass)}else {setverdict(fail)};
389 }
390
391 testcase tc_record_partiallyInit10() runs on MTC_CT {
392 var MyRec2 vl_r:=c_myrec2_part;
393 if(ispresent(vl_r.u.i)){setverdict(fail)}else {setverdict(pass)};
394 }
395
396
397 // testcase tc_record_partiallyInit11() runs on MTC_CT {
398 // var MyRec2 vl_r:={ r:={}}
399 // if(ispresent(vl_r.r)){setverdict(pass)}else {setverdict(fail)};
400 // }
401
402 testcase tc_record_partiallyInit12() runs on MTC_CT {
403 var MyRec2 vl_r:={ r:={i:=5}}
404 if(ispresent(vl_r.r)){setverdict(pass)}else {setverdict(fail)};
405 if(ispresent(vl_r.r.i)){setverdict(pass)}else {setverdict(fail)};
406 }
407
408 testcase tc_record_partiallyInit13() runs on MTC_CT {
409 var MyRec2 vl_r:={ r:={i:=5,x:=-,c:= -}}
410 if(ispresent(vl_r)){setverdict(pass)}else {setverdict(fail)};
411 if(ispresent(vl_r.r)){setverdict(pass)}else {setverdict(fail)};
412 if(ispresent(vl_r.r.i)){setverdict(pass)}else {setverdict(fail)};
413 }
414
415 testcase tc_record_omit() runs on MTC_CT {
416 var MyRec2 vl_r:={omit, omit, omit, omit}
417 if(ispresent(vl_r)){setverdict(pass)}else {setverdict(fail)};
418 if(ispresent(vl_r.roc)){setverdict(fail)}else {setverdict(pass)};
419 if(ispresent(vl_r.roi)){setverdict(fail)}else {setverdict(pass)};
420 if(ispresent(vl_r.u)){setverdict(fail)}else {setverdict(pass)};
421 if(ispresent(vl_r.u.r)){setverdict(fail)}else {setverdict(pass)};
422 if(ispresent(vl_r.u.r.i)){setverdict(fail)}else {setverdict(pass)};
423 if(ispresent(vl_r.u.r.x)){setverdict(fail)}else {setverdict(pass)};
424 if(ispresent(vl_r.u.r.c)){setverdict(fail)}else {setverdict(pass)};
425 if(ispresent(vl_r.r)){setverdict(fail)}else {setverdict(pass)};
426 if(ispresent(vl_r.r.i)){setverdict(fail)}else {setverdict(pass)};
427 if(ispresent(vl_r.r.x)){setverdict(fail)}else {setverdict(pass)};
428 if(ispresent(vl_r.r.c)){setverdict(fail)}else {setverdict(pass)};
429 }
430
431 testcase tc_record_omit2() runs on MTC_CT {
432 var MyRec2 vl_r:={roc:=omit, roi:=omit,u:= omit,r:= omit}
433 if(ispresent(vl_r)){setverdict(pass)}else {setverdict(fail)};
434 if(ispresent(vl_r.roc)){setverdict(fail)}else {setverdict(pass)};
435 if(ispresent(vl_r.roi)){setverdict(fail)}else {setverdict(pass)};
436 if(ispresent(vl_r.u)){setverdict(fail)}else {setverdict(pass)};
437 if(ispresent(vl_r.u.r)){setverdict(fail)}else {setverdict(pass)};
438 if(ispresent(vl_r.u.r.i)){setverdict(fail)}else {setverdict(pass)};
439 if(ispresent(vl_r.u.r.x)){setverdict(fail)}else {setverdict(pass)};
440 if(ispresent(vl_r.u.r.c)){setverdict(fail)}else {setverdict(pass)};
441 if(ispresent(vl_r.r)){setverdict(fail)}else {setverdict(pass)};
442 if(ispresent(vl_r.r.i)){setverdict(fail)}else {setverdict(pass)};
443 if(ispresent(vl_r.r.x)){setverdict(fail)}else {setverdict(pass)};
444 if(ispresent(vl_r.r.c)){setverdict(fail)}else {setverdict(pass)};
445 }
446
447 type union MyUnion_OneOption {
448 integer i
449 }
450
451 type record MyRec4 {
452 MyUnion_OneOption u,
453 integer i
454 }
455
456 testcase tc_union_OneOption_WithWildcard() runs on MTC_CT {
457 var template MyRec4 vtl_rec:=?
458 if(ispresent(vtl_rec)){setverdict(pass)}else {setverdict(fail)};
459 log("DTE is expected in the next line")
460 if(ispresent(vtl_rec.u.i)){setverdict(fail)};
461 }
462
463 testcase tc_record_mandatoryField_WithWildcard() runs on MTC_CT {
464 var template MyRec4 vtl_rec:=?
465 if(ispresent(vtl_rec.u)){setverdict(pass)}else {setverdict(fail)};
466 if(ispresent(vtl_rec.i)){setverdict(pass)}else {setverdict(fail)};
467 }
468
469 testcase tc_recordOf_union() runs on MTC_CT {
470 var MyRec2 vl_r:=c_myrec2_1;
471 if(ispresent(vl_r.u)){setverdict(pass)}else {setverdict(fail)};
472 if(ispresent(vl_r.u.r)){setverdict(pass)}else {setverdict(fail)};
473 if(ispresent(vl_r.u.r.i)){setverdict(pass)}else {setverdict(fail)};
474 if(ispresent(vl_r.u.r.x)){setverdict(pass)}else {setverdict(fail)};
475 if(ispresent(vl_r.u.r.c)){setverdict(pass)}else {setverdict(fail)};
476 if(ispresent(vl_r.u.roi)){setverdict(fail)}else {setverdict(pass)};
477 if(ispresent(vl_r.u.roi[3])){setverdict(fail)}else {setverdict(pass)};
478 if(ispresent(vl_r.u.i)){setverdict(fail)}else {setverdict(pass)};
479 if(ispresent(vl_r.u.roc)){setverdict(fail)}else {setverdict(pass)};
480 if(ispresent(vl_r.u.roc[0])){setverdict(fail)}else {setverdict(pass)};
481 }
482
483 testcase tc_recordOf_recordOfRecordOfInt() runs on MTC_CT {
484 var MyRec3 vl_r:=c_myrec3_1;
485 if(ispresent(vl_r.roroi)){setverdict(pass)}else {setverdict(fail)};
486 if(ispresent(vl_r.roroi[0])){setverdict(pass)}else {setverdict(fail)};
487 if(ispresent(vl_r.roroi[1])){setverdict(pass)}else {setverdict(fail)};
488 if(ispresent(vl_r.roroi[2])){setverdict(fail)}else {setverdict(pass)};
489 if(ispresent(vl_r.roroi[200])){setverdict(fail)}else {setverdict(pass)};
490 if(ispresent(vl_r.roroi[0][0])){setverdict(pass)}else {setverdict(fail)};
491 }
492
493 testcase tc_recordOf_recordOfRecordOfInt2() runs on MTC_CT {
494 var MyRec3 vl_r:=c_myrec3_1;
495 if(ispresent(vl_r.roroi[0][8])){setverdict(pass)}else {setverdict(fail)};
496 if(ispresent(vl_r.roroi[0][9])){setverdict(fail)}else {setverdict(pass)};
497 if(ispresent(vl_r.roroi[1][0])){setverdict(pass)}else {setverdict(fail)};
498 if(ispresent(vl_r.roroi[1][1])){setverdict(fail)}else {setverdict(pass)};
499 if(ispresent(vl_r.roroi[2][0])){setverdict(fail)}else {setverdict(pass)};
500 }
501
502 testcase tc_recordOf_recordInRecord() runs on MTC_CT {
503 var MyRec3 vl_r:=c_myrec3_2;
504 if(ispresent(vl_r.r)) {setverdict(pass)}else {setverdict(fail)};
505 if(ispresent(vl_r.r.roc)) {setverdict(pass)}else {setverdict(fail)};
506 if(ispresent(vl_r.r.roi)) {setverdict(pass)}else {setverdict(fail)};
507 if(ispresent(vl_r.r.u)) {setverdict(pass)}else {setverdict(fail)};
508 if(ispresent(vl_r.r.u)) {setverdict(pass)}else {setverdict(fail)};
509 if(ispresent(vl_r.r.u.i)) {setverdict(pass)}else {setverdict(fail)};
510 }
511
512 testcase tc_recordOf_recordInRecord2() runs on MTC_CT {
513 var MyRec3 vl_r:=c_myrec3_2;
514 if(ispresent(vl_r.r.r)) {setverdict(fail)}else {setverdict(pass)};
515 }
516
517 testcase tc_recordOf_recordInRecord_innerOmits() runs on MTC_CT {
518 var MyRec3 vl_r:=c_myrec3_innerOmits;
519 if(ispresent(vl_r.roroi)) {setverdict(pass)}else {setverdict(fail)};
520 if(ispresent(vl_r.r)) {setverdict(pass)}else {setverdict(fail)};
521 if(ispresent(vl_r.r.roc)) {setverdict(fail)}else {setverdict(pass)};
522 if(ispresent(vl_r.r.roi)) {setverdict(fail)}else {setverdict(pass)};
523 if(ispresent(vl_r.r.u)) {setverdict(fail)}else {setverdict(pass)};
524 if(ispresent(vl_r.r.r)){setverdict(fail)}else {setverdict(pass)};
525 }
526
527
528 template MyRecOf t_recOf1 := (
529 { [0]:= { roc:=omit }, [1]:= {roc:=omit} },
530 { [0]:= { roc:=omit }, [1]:= {roc:={"one", "two"}} },
531 { [0]:= { roc:=omit }, [2]:= {u:={i:=5}} }
532 )
533
534 testcase tc_recordOf_template1() runs on MTC_CT {
535 var template MyRecOf vtl_recOf:= t_recOf1;
536 if(ispresent( vtl_recOf )) {setverdict(pass)}else {setverdict(fail)};
537 if(ispresent( t_recOf1 )) {setverdict(pass)}else {setverdict(fail)};
538 }
539
540 testcase tc_recordOf_template2() runs on MTC_CT {
541 var template MyRecOf vtl_recOf:= t_recOf1;
542 if(ispresent( vtl_recOf[0] )) {setverdict(fail)}else {setverdict(pass)};
543 if(ispresent( vtl_recOf[1] )) {setverdict(fail)}else {setverdict(pass)};
544 if(ispresent( vtl_recOf[2] )) {setverdict(fail)}else {setverdict(pass)};
545 }
546
547
548 //========== WildCard in templates====================
549
550 testcase tc_record_withWildCard1() runs on MTC_CT {
551 var template MyRec2 vtl_rec2;
552 vtl_rec2:={
553 roc:=*
554 }
555 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
556 }
557 testcase tc_record_withWildCard1A() runs on MTC_CT {
558 var template MyRec2 vtl_rec2;
559 vtl_rec2:={
560 roc:=*
561 }
562 if(ispresent(vtl_rec2.roc)) {setverdict(fail)}else {setverdict(pass)};
563 }
564
565 testcase tc_record_withWildCard1AA() runs on MTC_CT {
566 var template MyRec2 vtl_rec2;
567 vtl_rec2:={
568 roc:=?
569 }
570 if(ispresent(vtl_rec2.roc)) {setverdict(pass)}else {setverdict(fail)};
571 }
572
573 testcase tc_record_withWildCard1B() runs on MTC_CT {
574 var template MyRec2 vtl_rec2;
575 vtl_rec2:={
576 roc:=*
577 }
578 if(ispresent(vtl_rec2.roc[0])) {setverdict(fail)}else {setverdict(pass)};
579 }
580
581 testcase tc_record_withWildCard2() runs on MTC_CT {
582 var template MyRec2 vtl_rec2;
583 vtl_rec2:={
584 roc:={ ?,? }
585 }
586 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
587 if(ispresent(vtl_rec2.roc)) {setverdict(pass)}else {setverdict(fail)};
588 if(ispresent(vtl_rec2.roc[0])){setverdict(pass)}else {setverdict(fail)};
589 if(ispresent(vtl_rec2.roc[1])){setverdict(pass)}else {setverdict(fail)};
590 if(ispresent(vtl_rec2.roc[10])){setverdict(fail)}else {setverdict(pass)};
591 }
592
593 //unbound
594 testcase tc_record_withWildCard2A() runs on MTC_CT {
595 var template MyRec2 vtl_rec2;
596 vtl_rec2:={
597 roc:={ ?,? }
598 }
599 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
600 }
601 testcase tc_record_withWildCard2B() runs on MTC_CT {
602 var template MyRec2 vtl_rec2;
603 vtl_rec2:={
604 roc:={ ?,? }
605 }
606 if(ispresent(vtl_rec2.u)){setverdict(fail)}else {setverdict(pass)};
607 }
608 testcase tc_record_withWildCard2C() runs on MTC_CT {
609 var template MyRec2 vtl_rec2;
610 vtl_rec2:={
611 roc:={ ?,? }
612 }
613 if(ispresent(vtl_rec2.r)){setverdict(fail)}else {setverdict(pass)};
614 }
615
616 testcase tc_record_withWildCard3() runs on MTC_CT {
617 var template MyRec2 vtl_rec2;
618 vtl_rec2:={
619 u := *
620 }
621 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
622 }
623
624 testcase tc_record_withWildCard3A() runs on MTC_CT {
625 var template MyRec2 vtl_rec2;
626 vtl_rec2:={
627 u := *
628 }
629 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
630 }
631
632 testcase tc_record_withWildCard3B() runs on MTC_CT {
633 var template MyRec2 vtl_rec2;
634 vtl_rec2:={
635 u := *
636 }
637 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
638 }
639
640 testcase tc_record_withWildCard3C() runs on MTC_CT {
641 var template MyRec2 vtl_rec2;
642 vtl_rec2:={
643 u := *
644 }
645 if(ispresent(vtl_rec2.u)){setverdict(fail)}else{setverdict(pass)};
646 }
647
648 testcase tc_record_withWildCard3D() runs on MTC_CT {
649 var template MyRec2 vtl_rec2;
650 vtl_rec2:={
651 u := ?
652 }
653 if(ispresent(vtl_rec2.u)){setverdict(pass)}else{setverdict(fail)};
654 }
655
656 testcase tc_record_withWildCard3E() runs on MTC_CT {
657 var template MyRec2 vtl_rec2;
658 vtl_rec2:={
659 u := ?
660 }
661
662 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else{setverdict(pass)}; //pass
663 }
664
665 testcase tc_record_withWildCard3E_log_sideeffect() runs on MTC_CT {
666 var template MyRec2 vtl_rec2;
667 vtl_rec2:={
668 u := ?
669 }
670
671 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else{setverdict(pass)}; //pass
672 }
673
674 testcase tc_record_withWildCard3E_log_sideeffect1() runs on MTC_CT {
675 var template MyRec2 vtl_rec2;
676 vtl_rec2:={
677 u := ?
678 }
679
680 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else {setverdict(pass)}; //fail
681 }
682
683 testcase tc_record_withWildCard4() runs on MTC_CT {
684 var template MyRec2 vtl_rec2;
685 vtl_rec2:={
686 roc:=omit,
687 u:={i:=?}
688 }
689 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
690 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
691 }
692
693 testcase tc_record_withWildCard4A() runs on MTC_CT {
694 var template MyRec2 vtl_rec2;
695 vtl_rec2:={
696 roc:=omit,
697 u:={i:=?}
698 }
699 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
700 }
701
702 testcase tc_record_withWildCard4B() runs on MTC_CT {
703 var template MyRec2 vtl_rec2;
704 vtl_rec2:={
705 roc:=omit,
706 u:={i:=?}
707 }
708 if(ispresent(vtl_rec2.u)){setverdict(pass)}else {setverdict(fail)};
709 if(ispresent(vtl_rec2.u.i)){setverdict(pass)}else {setverdict(fail)};
710 }
711
712 testcase tc_record_withWildCard5() runs on MTC_CT {
713 var template MyRec2 vtl_rec2;
714 vtl_rec2:={
715 r:= ?
716 }
717 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
718 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
719 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
720 if(ispresent(vtl_rec2.u)){setverdict(fail)}else {setverdict(pass)};
721 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else {setverdict(pass)};
722 }
723
724 testcase tc_record_withWildCard5A() runs on MTC_CT {
725 var template MyRec2 vtl_rec2;
726 vtl_rec2:={
727 r:= ?
728 }
729 if(ispresent(vtl_rec2.r)) {setverdict(pass)}else {setverdict(fail)};
730 }
731
732 testcase tc_record_withWildCard5B_optional() runs on MTC_CT {
733 var template MyRec2 vtl_rec2;
734 vtl_rec2:={
735 r:= ?
736 }
737 if(ispresent(vtl_rec2.r.i)) {setverdict(fail)}else {setverdict(pass)};
738 if(ispresent(vtl_rec2.r.x)) {setverdict(fail)}else {setverdict(pass)};
739 }
740
741 testcase tc_record_withWildCard5B_mandatory() runs on MTC_CT {
742 var template MyRec2 vtl_rec2;
743 vtl_rec2:={
744 r:= ?
745 }
746 if(ispresent(vtl_rec2.r.c)) {setverdict(pass)}else {setverdict(fail)};
747 }
748
749 testcase tc_record_withWildCard6() runs on MTC_CT {
750 var template MyRec2 vtl_rec2;
751 vtl_rec2:={
752 r:= *
753 }
754 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
755 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
756 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
757 if(ispresent(vtl_rec2.u)){setverdict(fail)}else {setverdict(pass)};
758 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else {setverdict(pass)};
759 }
760
761 testcase tc_record_withWildCard6A() runs on MTC_CT {
762 var template MyRec2 vtl_rec2;
763 vtl_rec2:={
764 r:= *
765 }
766 if(ispresent(vtl_rec2.r)) {setverdict(fail)}else {setverdict(pass)};
767 if(ispresent(vtl_rec2.r.i)) {setverdict(fail)}else {setverdict(pass)};
768 if(ispresent(vtl_rec2.r.x)) {setverdict(fail)}else {setverdict(pass)};
769 if(ispresent(vtl_rec2.r.c)) {setverdict(fail)}else {setverdict(pass)};
770 }
771
772 group g_TR_HO72812 {
773 type record MyRecord_HO72812
774 {
775 record {
776 boolean innerField1 optional,
777 integer innerField2 optional
778 } field1 optional,
779 integer field2
780 }
781 testcase tc_record_TR_HO72813() runs on MTC_CT {
782 var MyRecord_HO72812 vl_MyRecord := { field1 := {}, field2 := 5 };
783 if(ispresent(vl_MyRecord)) {setverdict(pass)} else {setverdict(fail)}
784 if(ispresent(vl_MyRecord.field1)) {setverdict(fail)} else {setverdict(pass)} //according to ethgry
785 if(ispresent(vl_MyRecord.field2)) {setverdict(pass)} else {setverdict(fail)}
786 }
787
788 testcase tc_record_TR_HO72813_innerFields() runs on MTC_CT {
789 var MyRecord_HO72812 vl_MyRecord := { field1 := {}, field2 := 5 };
790 if(ispresent(vl_MyRecord.field1.innerField1)) {setverdict(fail)} else {setverdict(pass)}
791 if(ispresent(vl_MyRecord.field1.innerField2)) {setverdict(fail)} else {setverdict(pass)}
792 }
793
794 testcase tc_record_TR_HO72813_partlyInitialized() runs on MTC_CT {
795 var MyRecord_HO72812 vl_MyRecord := { field1 := {innerField1:=true}, field2 := 5 };
796 if(ispresent(vl_MyRecord.field1)) {setverdict(pass)} else {setverdict(fail)} ;
797 if(ispresent(vl_MyRecord.field1.innerField1)) {setverdict(pass)} else {setverdict(fail)};
798 if(ispresent(vl_MyRecord.field1.innerField2)) {setverdict(fail)} else {setverdict(pass)} ; //DTE???
799 }
800
801 testcase tc_record_TR_HO72813_omit() runs on MTC_CT {
802 var MyRecord_HO72812 vl_MyRecord := { field1 := {innerField1:=true}, field2 := 5 }
803 vl_MyRecord.field1 := omit;
804 if(ispresent(vl_MyRecord.field1)) {setverdict(fail)} else {setverdict(pass)}
805 if(ispresent(vl_MyRecord.field1.innerField1)) {setverdict(fail)} else {setverdict(pass)};
806 if(ispresent(vl_MyRecord.field1.innerField2)) {setverdict(fail)} else {setverdict(pass)} ; //DTE???
807 }
808
809 }//group
810
811 testcase tc_runtimeDivisionByZero() runs on MTC_CT {
812 var MyUnion1 vl_u:= c_myunion2;
813 if(ispresent(vl_u)) {setverdict(pass)} else {setverdict(fail)}
814 if(ispresent(vl_u.i)){setverdict(pass)}else {setverdict(fail)}
815 if(ispresent(vl_u.i/2)){setverdict(pass)}else {setverdict(fail)}
816 if(ispresent(vl_u.i*0)){setverdict(pass)}else {setverdict(fail)}
817 log("Expected DTE comes!!!");
818 if(ispresent(vl_u.i/(vl_u.i-5))){setverdict(fail)}else {setverdict(pass)} //DTE - OK
819 }
820
821 //compilation error - ok?
822 // testcase tc_compilationErrorDivisionByZero() runs on MTC_CT {
823 // var MyUnion1 vl_u:= c_myunion2;
824 // if(ispresent(vl_u.i/0)){setverdict(fail)}else {setverdict(pass)}
825 // }
826 template integer t_i(integer i, integer j) :=i+j;
827
828 testcase tc_runtimeExprEval() runs on MTC_CT {
829 var template integer vt_i:= t_i(1,2);
830 var integer vl_i:=1, vl_j:=0;
831 if(ispresent(vt_i)) {setverdict(pass)} else {setverdict(fail)};
832 if(ispresent(t_i(1,2))) {setverdict(pass)} else {setverdict(fail)};
833 if(ispresent(t_i(1,2*vl_i))) {setverdict(pass)} else {setverdict(fail)};
834 //if(ispresent(t_i(1,2/vl_j))) {setverdict(pass)} else {setverdict(fail)}; //DTE
835 }
836
837
838 control {
839
840 execute(tc_simple_charstring_unbound()); //pass
841 execute(tc_simple_charstring_isvalue()); //pass
842 execute(tc_simple_charstring_template_unbound()); //pass
843 execute(tc_simple_charstring_template_isvalue()); //pass
844 execute(tc_simple_charstring_template_pattern()); //pass
845 execute(tc_simple_integer_unbound()); //pass
846 execute(tc_simple_integer_value()); //pass
847 execute(tc_simple_integer_templ_asterix()); //pass
848 execute(tc_simple_integer_templ_qm()); //pass
849 execute(tc_simple_integer_templ_value()); //pass
850 execute(tc_simple_octetstring_isvalue()); //pass
851 execute(tc_simple_octetstring_unbound()); //pass
852 execute(tc_special_default_value_unbound());//pass
853 execute(tc_special_default_value_null()); //pass
854 execute(tc_special_default_value_isvalue());//pass
855 execute(tc_special_compref_unbound()); //pass
856 execute(tc_special_compref_isvalue()); //pass
857 execute(tc_unionOfRecordOfs1()); //pass
858 execute(tc_unionOfRecordOfs1_2()); //pass
859 execute(tc_unionOfRecordOfs2()); //pass
860 // //execute(tc_compilationerror1());
861 execute(tc_union_modify()); //pass
862 execute(tc_sideeffect1()); //pass
863 execute(tc_sideeffect2()); //pass
864 execute(tc_recordOf_omit1()); //pass
865 execute(tc_recordOf_omit2()); //pass
866 execute(tc_recordOf_emptyRoi1()); //pass
867 execute(tc_recordOf_emptyRoi2()); //pass
868 execute(tc_recordOf_emptyRoi3()); //pass
869 execute(tc_record_unbound())
870 execute(tc_record_completlyInit()); //pass
871 execute(tc_record_partiallyInit1()); //pass
872 execute(tc_record_partiallyInit3()); //pass
873 execute(tc_record_partiallyInit4());
874 execute(tc_record_partiallyInit5());
875 execute(tc_record_partiallyInit6());
876 execute(tc_record_partiallyInit7());
877 execute(tc_record_partiallyInit8());
878 execute(tc_record_partiallyInit9());
879 execute(tc_record_partiallyInit10());
880 // //execute(tc_record_partiallyInit11()); //<=======COMPILATION ERROR
881 execute(tc_record_partiallyInit12());
882 execute(tc_record_partiallyInit13());
883 execute(tc_record_omit());
884 execute(tc_record_omit2());
885 execute(tc_union_OneOption_WithWildcard());
886 execute(tc_record_mandatoryField_WithWildcard());
887 execute(tc_recordOf_union());
888 execute(tc_recordOf_recordOfRecordOfInt());
889 execute(tc_recordOf_recordOfRecordOfInt2());
890 execute(tc_recordOf_recordInRecord());
891 execute(tc_recordOf_recordInRecord2());
892 execute(tc_recordOf_recordInRecord_innerOmits());
893 execute(tc_recordOf_template1());
894 execute(tc_recordOf_template2());
895 execute(tc_record_withWildCard1());
896 execute(tc_record_withWildCard1A()); //pass
897 execute(tc_record_withWildCard1B());
898 execute(tc_record_withWildCard2());
899 execute(tc_record_withWildCard2A());//pass (unbound)
900 execute(tc_record_withWildCard2B());//pass (unbound)
901 execute(tc_record_withWildCard2C());//pass (unbound)
902 execute(tc_record_withWildCard3());
903 execute(tc_record_withWildCard3A());//pass (unbound)
904 execute(tc_record_withWildCard3B());//pass (unbound)
905 execute(tc_record_withWildCard3C());//pass (*)
906 execute(tc_record_withWildCard3D());//pass
907 execute(tc_record_withWildCard3E());
908 execute(tc_record_withWildCard3E_log_sideeffect());
909 //execute(tc_record_withWildCard3E_log_sideeffect1()); // fail, mail sent to ethgry
910 execute(tc_record_withWildCard4());//pass
911 execute(tc_record_withWildCard4A());
912 execute(tc_record_withWildCard4B());
913 execute(tc_record_withWildCard5());//pass
914 execute(tc_record_withWildCard5A());//pass
915 execute(tc_record_withWildCard5A());//pass
916 execute(tc_record_withWildCard5B_optional());//pass
917 execute(tc_record_withWildCard5B_mandatory());//pass
918 execute(tc_record_withWildCard6());//pass
919 execute(tc_record_withWildCard6A());
920 execute(tc_record_TR_HO72813());
921 execute(tc_record_TR_HO72813_innerFields());
922 execute(tc_record_TR_HO72813_partlyInitialized());
923 execute(tc_record_TR_HO72813_omit());
924 //execute(tc_runtimeDivisionByZero()); //expected DTE
925 //execute(tc_compilationErrorDivisionByZero()); ok!?
926 execute(tc_runtimeExprEval());
927
928 }
929
930 }//module
This page took 0.051452 seconds and 6 git commands to generate.