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
12 module IsPresent_Test {
14 modulepar integer tsp_repeatN :=100;
16 type port MyChrMessage_PT message {
18 } with { extension "internal"}
20 type component MTC_CT {
21 port MyChrMessage_PT my_PCO;
22 //var integer v_counter1 :=0;
25 //===== SIMPLE, NOT TOO DEEP =====
26 type record of charstring ROC;
27 type record of integer ROI;
28 type record MyRecord {
34 type record of ROI ROROI;
43 const MyUnion1 c_myunion1:= { roc:= { "1aa", "2bb", "3cc"}}
44 const MyUnion1 c_myunion2:= { i:= 5}
47 //====== DEEP 3===============
55 type record of MyRec2 MyRecOf
62 const MyRec2 c_myrec2_1:={
65 u:={r:={ i:=1, x:=1.0, c:="one"}},
66 r:={ i:=1, x:=1.0, c:="one"}
68 const MyRec2 c_myrec2_2:={
71 u:={r:={ i:=1, x:=1.0, c:="one"}},
72 r:={ i:=1, x:=1.0, c:="one"}
76 //partially initialized record:
77 const MyRec2 c_myrec2_part:={
80 u:={ r:={ /*i:=1,*/ x:=1.0, c:="one"}},
81 r:={ i:=1, x:=1.0, c:="one"}
83 const MyRec3 c_myrec3_1 := {
84 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
88 const MyRec3 c_myrec3_2 := {
89 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
98 const MyRec3 c_myrec3_innerOmits := {
99 roroi:= { {1,2,3,4,5,6,7,8,9},{10} },
109 //==== Templates =====
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)}
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)}
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)}
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)}
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)}
141 testcase tc_simple_integer_unbound() runs on MTC_CT {
143 if(ispresent(vl_i)){setverdict(fail)} else {setverdict(pass)} //fail
146 testcase tc_simple_integer_value() runs on MTC_CT {
148 if(ispresent(vl_i)) {setverdict(pass)} else {setverdict(fail)} //pass,
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)};
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)};
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)};
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
171 testcase tc_simple_octetstring_isvalue() runs on MTC_CT {
174 if(ispresent(vl_o)) {setverdict(pass)} else {setverdict(fail)} //not logged
177 //======= SPECIAL TYPES ======
179 altstep as_empty() runs on MTC_CT {
183 function f_empty() runs on MTC_CT {
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)};
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)}
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)};
199 deactivate(vl_default);
200 if(ispresent(vl_default)){setverdict(pass)}else {setverdict(fail)};
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)};
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)};
212 vc_myComp.start(f_empty());
213 if(ispresent(vc_myComp)){setverdict(pass)}else {setverdict(fail)};
216 if(ispresent(vc_myComp)){setverdict(pass)}else {setverdict(fail)};
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)}
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)}
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)}
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)}
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)}
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)}
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)}
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);
302 if(ispresent(vl_u.i)){setverdict(fail)}else {setverdict(pass)}
304 if(ispresent(vl_u.roc)) {setverdict(pass)}else {setverdict(fail)}
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)}
312 //====== DEEP 2-3 ===============
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
447 type union MyUnion_OneOption {
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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)};
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}} }
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)};
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)};
548 //========== WildCard in templates====================
550 testcase tc_record_withWildCard1() runs on MTC_CT {
551 var template MyRec2 vtl_rec2;
555 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
557 testcase tc_record_withWildCard1A() runs on MTC_CT {
558 var template MyRec2 vtl_rec2;
562 if(ispresent(vtl_rec2.roc)) {setverdict(fail)}else {setverdict(pass)};
565 testcase tc_record_withWildCard1AA() runs on MTC_CT {
566 var template MyRec2 vtl_rec2;
570 if(ispresent(vtl_rec2.roc)) {setverdict(pass)}else {setverdict(fail)};
573 testcase tc_record_withWildCard1B() runs on MTC_CT {
574 var template MyRec2 vtl_rec2;
578 if(ispresent(vtl_rec2.roc[0])) {setverdict(fail)}else {setverdict(pass)};
581 testcase tc_record_withWildCard2() runs on MTC_CT {
582 var template MyRec2 vtl_rec2;
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)};
594 testcase tc_record_withWildCard2A() runs on MTC_CT {
595 var template MyRec2 vtl_rec2;
599 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
601 testcase tc_record_withWildCard2B() runs on MTC_CT {
602 var template MyRec2 vtl_rec2;
606 if(ispresent(vtl_rec2.u)){setverdict(fail)}else {setverdict(pass)};
608 testcase tc_record_withWildCard2C() runs on MTC_CT {
609 var template MyRec2 vtl_rec2;
613 if(ispresent(vtl_rec2.r)){setverdict(fail)}else {setverdict(pass)};
616 testcase tc_record_withWildCard3() runs on MTC_CT {
617 var template MyRec2 vtl_rec2;
621 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
624 testcase tc_record_withWildCard3A() runs on MTC_CT {
625 var template MyRec2 vtl_rec2;
629 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
632 testcase tc_record_withWildCard3B() runs on MTC_CT {
633 var template MyRec2 vtl_rec2;
637 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
640 testcase tc_record_withWildCard3C() runs on MTC_CT {
641 var template MyRec2 vtl_rec2;
645 if(ispresent(vtl_rec2.u)){setverdict(fail)}else{setverdict(pass)};
648 testcase tc_record_withWildCard3D() runs on MTC_CT {
649 var template MyRec2 vtl_rec2;
653 if(ispresent(vtl_rec2.u)){setverdict(pass)}else{setverdict(fail)};
656 testcase tc_record_withWildCard3E() runs on MTC_CT {
657 var template MyRec2 vtl_rec2;
662 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else{setverdict(pass)}; //pass
665 testcase tc_record_withWildCard3E_log_sideeffect() runs on MTC_CT {
666 var template MyRec2 vtl_rec2;
671 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else{setverdict(pass)}; //pass
674 testcase tc_record_withWildCard3E_log_sideeffect1() runs on MTC_CT {
675 var template MyRec2 vtl_rec2;
680 if(ispresent(vtl_rec2.u.i)){setverdict(fail)}else {setverdict(pass)}; //fail
683 testcase tc_record_withWildCard4() runs on MTC_CT {
684 var template MyRec2 vtl_rec2;
689 if(ispresent(vtl_rec2)) {setverdict(pass)}else {setverdict(fail)};
690 if(ispresent(vtl_rec2.roc)){setverdict(fail)}else {setverdict(pass)};
693 testcase tc_record_withWildCard4A() runs on MTC_CT {
694 var template MyRec2 vtl_rec2;
699 if(ispresent(vtl_rec2.roi)){setverdict(fail)}else {setverdict(pass)};
702 testcase tc_record_withWildCard4B() runs on MTC_CT {
703 var template MyRec2 vtl_rec2;
708 if(ispresent(vtl_rec2.u)){setverdict(pass)}else {setverdict(fail)};
709 if(ispresent(vtl_rec2.u.i)){setverdict(pass)}else {setverdict(fail)};
712 testcase tc_record_withWildCard5() runs on MTC_CT {
713 var template MyRec2 vtl_rec2;
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)};
724 testcase tc_record_withWildCard5A() runs on MTC_CT {
725 var template MyRec2 vtl_rec2;
729 if(ispresent(vtl_rec2.r)) {setverdict(pass)}else {setverdict(fail)};
732 testcase tc_record_withWildCard5B_optional() runs on MTC_CT {
733 var template MyRec2 vtl_rec2;
737 if(ispresent(vtl_rec2.r.i)) {setverdict(fail)}else {setverdict(pass)};
738 if(ispresent(vtl_rec2.r.x)) {setverdict(fail)}else {setverdict(pass)};
741 testcase tc_record_withWildCard5B_mandatory() runs on MTC_CT {
742 var template MyRec2 vtl_rec2;
746 if(ispresent(vtl_rec2.r.c)) {setverdict(pass)}else {setverdict(fail)};
749 testcase tc_record_withWildCard6() runs on MTC_CT {
750 var template MyRec2 vtl_rec2;
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)};
761 testcase tc_record_withWildCard6A() runs on MTC_CT {
762 var template MyRec2 vtl_rec2;
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)};
773 type record MyRecord_HO72812
776 boolean innerField1 optional,
777 integer innerField2 optional
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)}
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)}
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???
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???
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
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)}
826 template integer t_i(integer i, integer j) :=i+j;
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
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());