b1daa6a209427b4d7e5cd76082bcef1bcbbac59b
[deliverable/titan.core.git] / function_test / Semantic_Analyser / TTCN3_SA_ttcn3adhoc_TD.script
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 :text.
9 :lang eng.
10
11 .* EDML webpage: http://cpi.ericsson.se/dwaxe/
12 .* EDML2PDF converter: http://dwaxe.ericsson.se/x2pdf
13 .* EDML user guide: http://www.lmc.ericsson.se/~lmcmarg/isit/edml_ug.html
14
15 .* Document header information
16 :docname.Test Description
17 :docno.2x/152 91-CRL 113 200/5 Uen
18 :rev.A
19 :date.2015-04-27
20
21 :prep.ETH/XZ Jeno Balasko
22 :appr.ETH/XZ (Gyula Koos)
23 :checked.ETHGRY
24
25 :title.Test description of the TTCN-3 Semantic Analyzer: Adhoc tests
26 :contents level=2.
27 .*---------------------------------------------------------------------*
28 :h1.Introduction
29 .*---------------------------------------------------------------------*
30 .*---------------------------------------------------------------------*
31 :h2.Revision history
32 .*---------------------------------------------------------------------*
33 :xmp tab=2.
34 REV DATE PREPARED CHANGE
35 __________________________________________________
36 - 2005-02-19 EGBOTAT New document for TITAN R1.6
37 - 2005-06-30 ETIBHRA Added select-case, alive, interleave tests
38 - 2005-08-16 ETIBHRA Deleted select-case, alive, interleave tests
39 - 2007-12-03 ETHNBA TCs for IsBound are added
40 - 2008-02-05 ETHNBA IsBound changed to IsValue
41 - 2009-06-11 EKRISZA Name correction
42 - 2010-08-10 EKRISZA decvalue test added
43 G 2010-08-13 EKRISZA updated version number
44 H 2010-12-14 EKRISZA updated version number
45 J 2011-05-26 EKRISZA updated version number
46 A 2011-12-12 EKRISZA Updated for release
47 B 2012-04-13 EFERKOV Updated for release
48 A 2012-06-27 EFERKOV Updated for release
49 A 2013-01-17 EKRIPND Updated for release
50 :exmp.
51 .*---------------------------------------------------------------------*
52 :h2.Purpose
53 .*---------------------------------------------------------------------*
54 This document contains adhoc tests for TTCN-3 Semantic Analyser. These test
55 cases shall be moved to different test descriptions in forthcoming
56 projects.
57 .*---------------------------------------------------------------------*
58 :h2.Test cases
59 .*---------------------------------------------------------------------*
60 .*---------------------------------------------------------------------*
61 :h3.Adhoc - Duplicate definition
62 .*---------------------------------------------------------------------*
63 :xmp tab=0.
64
65 <TC - Adhoc - Duplicate definition>
66
67 <COMPILE>
68 <VERDICT_LEAF PASS>
69 <MODULE TTCN Temp Temp.ttcn>
70 module Temp {
71
72 function F() {
73 var integer I, I;
74 }
75
76 }
77 <END_MODULE>
78 <RESULT COUNT 1>
79 (?im)duplicate.+?definition
80 <END_RESULT>
81 <RESULT COUNT 1>
82 (?im)previous.+?definition
83 <END_RESULT>
84 <RESULT COUNT 1>
85 (?is)\berror:
86 <END_RESULT>
87 <RESULT>
88 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
89 <END_RESULT>
90 <END_TC>
91
92 :exmp.
93
94 .*---------------------------------------------------------------------*
95 :h3.Adhoc - Duplicated label
96 .*---------------------------------------------------------------------*
97 :xmp tab=0.
98
99 <TC - Adhoc - Duplicated label>
100
101 <COMPILE>
102 <VERDICT_LEAF PASS>
103 <MODULE TTCN Temp Temp.ttcn>
104 module Temp {
105
106 function F() {
107 label L1;
108 goto L1;
109 label L1;
110 }
111
112 }
113 <END_MODULE>
114 <RESULT COUNT 1>
115 (?im)duplicate.+?label
116 <END_RESULT>
117 <RESULT COUNT 1>
118 (?im)previous.+?definition
119 <END_RESULT>
120 <RESULT COUNT 1>
121 (?is)\berror:
122 <END_RESULT>
123 <RESULT>
124 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
125 <END_RESULT>
126 <END_TC>
127
128 :exmp.
129
130 .*---------------------------------------------------------------------*
131 :h3.Adhoc - goto label
132 .*---------------------------------------------------------------------*
133 :xmp tab=0.
134
135 <TC - Adhoc - goto label>
136
137 <COMPILE>
138 <VERDICT_LEAF PASS>
139 <MODULE TTCN Temp Temp.ttcn>
140 module Temp {
141
142 function F() {
143 goto L1; // same scope
144 label L1;
145 while(true) {
146 goto L2; // different scope 1 (to higher scope)
147 label L3;
148 }
149 label L2;
150 goto L3; // different scope 2 (to lower scope)
151 goto L4; // nonexistent label
152 }
153
154 }
155 <END_MODULE>
156 <RESULT COUNT 2>
157 (?im)label.+?\bnot\b.+?defined
158 <END_RESULT>
159 <RESULT COUNT 2>
160 (?is)\berror:
161 <END_RESULT>
162 <RESULT>
163 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
164 <END_RESULT>
165 <END_TC>
166
167 :exmp.
168
169 .*---------------------------------------------------------------------*
170 :h3.Adhoc - loop alt guards
171 .*---------------------------------------------------------------------*
172 :xmp tab=0.
173
174 <TC - Adhoc - loop alt guards>
175
176 <COMPILE>
177 <VERDICT_LEAF PASS>
178 <MODULE TTCN Temp Temp.ttcn>
179 module Temp {
180
181 function F() {
182 timer T1, T2;
183 var boolean b := true;
184 T1.start(1.0);
185 T2.start(1.1);
186 alt {
187 // Statement::set_my_ags() -> case S_WHILE
188 [b==true] T1.timeout { while(true) { } }
189 [b] T2.timeout { while(true) { b:=0; } }
190 }
191 }
192
193 }
194 <END_MODULE>
195 <RESULT COUNT 1>
196 (?im)boolean.+?value.+?expected
197 <END_RESULT>
198 <RESULT COUNT 1>
199 (?is)\berror:
200 <END_RESULT>
201 <RESULT>
202 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
203 <END_RESULT>
204 <END_TC>
205
206 :exmp.
207
208 .*---------------------------------------------------------------------*
209 :h3.Adhoc - Embedded statement block
210 .*---------------------------------------------------------------------*
211 Note: Statement blocks can be created.
212 :xmp tab=0.
213
214 <TC - Adhoc - Embedded statement block>
215
216 <COMPILEGCC>
217 <VERDICT_LEAF PASS>
218 <MODULE TTCN Temp Temp.ttcn>
219 module Temp {
220
221 function F() {
222 {
223 { }
224 }
225 }
226
227 }
228 <END_MODULE>
229 <RESULT IF_PASS NEGATIVE>
230 (?is)\berror:
231 <END_RESULT>
232 <END_TC>
233
234 :exmp.
235
236 .*---------------------------------------------------------------------*
237 :h3.Adhoc - function instance
238 .*---------------------------------------------------------------------*
239 :xmp tab=0.
240
241 <TC - Adhoc - function instance>
242
243 <COMPILE>
244 <VERDICT_LEAF PASS>
245 <MODULE TTCN Temp Temp.ttcn>
246 module Temp {
247
248 type port MyPortType message { inout integer }
249 type component MyComponent { port MyPortType MyPort; }
250 function F() runs on MyComponent { }
251
252 testcase TC() runs on MyComponent {
253 var MyComponent C;
254 C.start(F(123));
255 }
256
257 }
258 <END_MODULE>
259 <RESULT COUNT 1>
260 (?im)\btoo\b.+?many.+?parameters
261 <END_RESULT>
262 <RESULT COUNT 1>
263 (?is)\berror:
264 <END_RESULT>
265 <RESULT>
266 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
267 <END_RESULT>
268 <END_TC>
269
270 :exmp.
271
272 .*---------------------------------------------------------------------*
273 :h3.Adhoc - action statement
274 .*---------------------------------------------------------------------*
275 Note: this is a positive test. Errors would have been catched by the
276 parser, thus not increasing code coverage of the semantic analyser.
277
278 :xmp tab=0.
279
280 <TC - Adhoc - action statement>
281
282 <COMPILE>
283 <VERDICT_LEAF PASS>
284 <MODULE TTCN Temp Temp.ttcn>
285 module Temp {
286
287 function F() {
288 action("qwerty");
289 }
290
291 }
292 <END_MODULE>
293 <RESULT>
294 (?im)\bnotify\b.+?\bfiles\b.+?\bupdated\b
295 <END_RESULT>
296 <END_TC>
297
298 :exmp.
299
300 .*---------------------------------------------------------------------*
301 :h3.Adhoc - start/stop non-port/timer/component
302 .*---------------------------------------------------------------------*
303 :xmp tab=0.
304
305 <TC - Adhoc - start/stop non-port/timer/component>
306
307 <COMPILE>
308 <VERDICT_LEAF PASS>
309 <MODULE TTCN Temp Temp.ttcn>
310 module Temp {
311
312 type port MyPortType message { inout integer }
313 type component MyComponent { port MyPortType MyPort; }
314 function F() runs on MyComponent { }
315 altstep AS(timer T) {
316 []T.timeout { }
317 }
318
319 testcase TC() runs on MyComponent {
320 var integer I, J, K;
321 I.start(1.0);
322 J.start(F());
323 K.start;
324 I.stop;
325 AS.start;
326 AS.stop;
327 }
328
329 }
330 <END_MODULE>
331 <RESULT COUNT 8>
332 (?is)\berror:
333 <END_RESULT>
334 <RESULT>
335 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
336 <END_RESULT>
337 <END_TC>
338
339 :exmp.
340
341 .*---------------------------------------------------------------------*
342 :h3.Adhoc - start port operation with argument
343 .*---------------------------------------------------------------------*
344 :xmp tab=0.
345
346 <TC - Adhoc - start port operation with argument>
347
348 <COMPILE>
349 <VERDICT_LEAF PASS>
350 <MODULE TTCN Temp Temp.ttcn>
351 module Temp {
352
353 type port MyPortType message { inout integer }
354 type component MyComponent { port MyPortType MyPort; }
355 function F() runs on MyComponent { }
356
357 testcase TC() runs on MyComponent {
358 MyPort.start(123.4);
359 MyPort.start(F());
360 }
361
362 }
363 <END_MODULE>
364 <RESULT COUNT 2>
365 (?im)start.+?port.+?operation.+?cannot.+?have.+?argument
366 <END_RESULT>
367 <RESULT COUNT 2>
368 (?is)\berror:
369 <END_RESULT>
370 <RESULT>
371 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
372 <END_RESULT>
373 <END_TC>
374
375 :exmp.
376
377 .*---------------------------------------------------------------------*
378 :h3.Adhoc - return type of signature
379 .*---------------------------------------------------------------------*
380 :xmp tab=0.
381
382 <TC - Adhoc - return type of signature>
383
384 <COMPILE>
385 <VERDICT_LEAF PASS>
386 <MODULE TTCN Temp Temp.ttcn>
387 module Temp {
388
389 signature Sig1() return integer;
390 signature Sig2();
391 signature Sig3() return integer;
392 signature Sig4();
393 type port MyPortType procedure { inout Sig1, Sig2 }
394 type component MyComponent { port MyPortType MyPort }
395
396 testcase TC() runs on MyComponent {
397 MyPort.reply(Sig1:{});
398 MyPort.reply(Sig2:{} value "qwerty");
399 MyPort.reply(Sig3:{});
400 MyPort.reply(Sig4:{} value 1);
401 }
402
403 }
404 <END_MODULE>
405 <RESULT COUNT 2>
406 (?im)missing.+?return.+?value
407 <END_RESULT>
408 <RESULT COUNT 2>
409 (?im)unexpected.+?return.+?value
410 <END_RESULT>
411 <RESULT COUNT 2>
412 (?im)signature.+?not.+?\bon\b.+?incoming.+?list
413 <END_RESULT>
414 <RESULT COUNT 6>
415 (?is)\berror:
416 <END_RESULT>
417 <RESULT>
418 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
419 <END_RESULT>
420 <END_TC>
421
422 :exmp.
423
424 .*---------------------------------------------------------------------*
425 :h3.Adhoc - raising port, signature and default type
426 .*---------------------------------------------------------------------*
427 :xmp tab=0.
428
429 <TC - Adhoc - raising port, signature and default type>
430
431 <COMPILE>
432 <VERDICT_LEAF PASS>
433 <MODULE TTCN Temp Temp.ttcn>
434 module Temp {
435
436 signature Sig1(); // no exception!
437 type port MyPortType procedure { inout Sig1 }
438 type component MyComponent { port MyPortType MyPort }
439
440 testcase TC() runs on MyComponent {
441 var default d;
442 // The following is a workaround to get a specific error message.
443 var MyPortType portVar;
444 MyPort.raise(Sig1, portVar);
445 MyPort.raise(Sig1, Sig1:{});
446 MyPort.raise(Sig1, d);
447 }
448
449 }
450 <END_MODULE>
451 <RESULT COUNT 1>
452 (?im)variable.+?cannot.+?\bbe\b.+?defined.+?\bfor\b.+?port
453 <END_RESULT>
454 <RESULT COUNT 1>
455 (?im)raise.+?parameter.+?port.+?cannot.+?\bbe\b.+?exception.+?type
456 <END_RESULT>
457 <RESULT COUNT 3>
458 (?im)signature.+?does.+?\bnot\b.+?have.+?exceptions
459 <END_RESULT>
460 <RESULT COUNT 1>
461 (?im)raise.+?parameter.+?default.+?cannot.+?\bbe\b.+?exception.+?type
462 <END_RESULT>
463 <RESULT COUNT 1>
464 (?im)raise.+?parameter.+?signature.+?cannot.+?\bbe\b.+?exception.+?type
465 <END_RESULT>
466 <RESULT COUNT 7>
467 (?is)\berror:
468 <END_RESULT>
469 <RESULT>
470 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
471 <END_RESULT>
472 <END_TC>
473
474 :exmp.
475
476 .*---------------------------------------------------------------------*
477 :h3.Adhoc - any port operation with parameter
478 .*---------------------------------------------------------------------*
479 :xmp tab=0.
480
481 <TC - Adhoc - any port operation with parameter>
482
483 <COMPILE>
484 <VERDICT_LEAF PASS>
485 <MODULE TTCN Temp Temp.ttcn>
486 module Temp {
487
488 signature Sig() exception(float);
489 type port MPortType message { inout integer }
490 type port PPortType procedure { inout Sig }
491 type component MyComponent {
492 port MPortType MPort;
493 port PPortType PPort;
494 }
495
496 testcase TC() runs on MyComponent {
497 alt {
498 []any port.receive(integer:?) { }
499 []any port.check(receive(integer:?)) { }
500
501 []any port.getcall(Sig:{}) { }
502 []any port.getreply(Sig:{}) { }
503 []any port.catch(Sig, float:?) { }
504 []any port.check(getcall(Sig:{})) { }
505 []any port.check(getreply(Sig:{})) { }
506 []any port.check(catch(Sig, float:?)) { }
507 }
508 }
509
510 }
511 <END_MODULE>
512 <RESULT COUNT 8>
513 (?im)operation.+?\bany\b.+?port.+?cannot.+?have.+?parameter
514 <END_RESULT>
515 <RESULT COUNT 8>
516 (?is)\berror:
517 <END_RESULT>
518 <RESULT>
519 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
520 <END_RESULT>
521 <END_TC>
522
523 :exmp.
524
525 .*---------------------------------------------------------------------*
526 :h3.Adhoc - any port operation with redirect
527 .*---------------------------------------------------------------------*
528 :xmp tab=0.
529
530 <TC - Adhoc - any port operation with redirect>
531
532 <COMPILE>
533 <VERDICT_LEAF PASS>
534 <MODULE TTCN Temp Temp.ttcn>
535 module Temp {
536
537 signature Sig(inout integer Par) return integer exception(float);
538 type port MPortType message { inout integer }
539 type port PPortType procedure { inout Sig }
540 type component MyComponent {
541 port MPortType MPort;
542 port PPortType PPort;
543 }
544
545 testcase TC() runs on MyComponent {
546 var integer I, J;
547 var float F;
548 alt {
549 []any port.receive(integer:?) -> value I { }
550 []any port.check(receive(integer:*) -> value I) { }
551
552 []any port.getcall(Sig:{0}) -> param(I) { }
553 []any port.getreply(Sig:{0}) -> value J param(I) { }
554 []any port.catch(Sig, float:*) -> value F { }
555 []any port.check(getcall(Sig:{0}) -> param(I)) { }
556 []any port.check(getreply(Sig:{0}) -> value J param(I)) { }
557 []any port.check(catch(Sig, float:*) -> value F) { }
558 }
559 }
560
561 }
562 <END_MODULE>
563 <RESULT COUNT 8>
564 (?im)operation.+?\bany\b.+?port.+?cannot.+?have.+?parameter\s*$
565 <END_RESULT>
566 <RESULT COUNT 6>
567 (?im)operation.+?\bany\b.+?port.+?cannot.+?have.+?value.+?redirect
568 <END_RESULT>
569 <RESULT COUNT 4>
570 (?im)operation.+?\bany\b.+?port.+?cannot.+?have.+?parameter.+?redirect
571 <END_RESULT>
572 <RESULT COUNT 18>
573 (?is)\berror:
574 <END_RESULT>
575 <RESULT>
576 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
577 <END_RESULT>
578 <END_TC>
579
580 :exmp.
581
582 .*---------------------------------------------------------------------*
583 :h3.Adhoc - message based port operation with procedure based ports
584 .*---------------------------------------------------------------------*
585 :xmp tab=0.
586
587 <TC - Adhoc - message based port operation with procedure based ports>
588
589 <COMPILE>
590 <VERDICT_LEAF PASS>
591 <MODULE TTCN Temp Temp.ttcn>
592 module Temp {
593
594 signature Sig();
595 type port MyPortType procedure { inout Sig }
596 type component MyComponent { port MyPortType MyPort; }
597
598 testcase TC() runs on MyComponent {
599 MyPort.send(9);
600 alt {
601 // TR-682: message based operation on procedure based port and vice versa
602 []MyPort.receive { }
603 []MyPort.trigger { }
604 []MyPort.check(receive) { }
605 }
606 }
607
608 }
609 <END_MODULE>
610 <RESULT COUNT 4>
611 (?im)message.+?based.+?operation.+?procedure.+?based.+?port
612 <END_RESULT>
613 <RESULT COUNT 4>
614 (?is)\berror:
615 <END_RESULT>
616 <RESULT>
617 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
618 <END_RESULT>
619 <END_TC>
620
621 :exmp.
622
623 .*---------------------------------------------------------------------*
624 :h3.Adhoc - procedure based port operation with message based ports
625 .*---------------------------------------------------------------------*
626 :xmp tab=0.
627
628 <TC - Adhoc - procedure based port operation with message based ports>
629
630 <COMPILE>
631 <VERDICT_LEAF PASS>
632 <MODULE TTCN Temp Temp.ttcn>
633 module Temp {
634
635 signature Sig() exception(integer);
636 type port MyPortType message { inout integer }
637 type component MyComponent { port MyPortType MyPort; }
638
639 testcase TC() runs on MyComponent {
640 MyPort.call(Sig:{ }, nowait);
641 MyPort.reply(Sig:{ });
642 MyPort.raise(Sig, 10);
643 alt {
644 // TR-682: message based operation on procedure based port and vice versa
645 []MyPort.check(getcall) { }
646 []MyPort.check(getreply(Sig:{ })) { }
647 []MyPort.check(catch(Sig, integer: ?)) { }
648 }
649 alt {
650 []MyPort.getcall(Sig:{ }) { }
651 []MyPort.getreply(Sig:{ }) { }
652 []MyPort.catch(Sig, integer: ?) { }
653 }
654 MyPort.call(Sig:{ }, 10.0) {
655 []MyPort.getreply(Sig:{ }) { }
656 []MyPort.catch(timeout) { }
657 }
658 }
659
660 }
661 <END_MODULE>
662 <RESULT COUNT 11>
663 (?im)procedure.+?based.+?operation.+?message.+?based.+?port
664 <END_RESULT>
665 <RESULT COUNT 1>
666 (?im)timeout.+?exception.+?message.+?based.+?port
667 <END_RESULT>
668 <RESULT COUNT 12>
669 (?is)\berror:
670 <END_RESULT>
671 <RESULT>
672 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
673 <END_RESULT>
674 <END_TC>
675
676 :exmp.
677
678 .*---------------------------------------------------------------------*
679 :h3.Adhoc - blocking call: getreply refers to different port
680 .*---------------------------------------------------------------------*
681 :xmp tab=0.
682
683 <TC - Adhoc - blocking call: getreply refers to different port>
684
685 <COMPILE>
686 <VERDICT_LEAF PASS>
687 <MODULE TTCN Temp Temp.ttcn>
688 module Temp {
689
690 signature Sig() exception(integer);
691
692 type port MyPortType1 procedure { inout Sig }
693 type port MyPortType2 procedure { inout Sig }
694
695 type component MyComponent {
696 port MyPortType1 MyPort1;
697 port MyPortType2 MyPort2
698 }
699
700 testcase TC() runs on MyComponent {
701 MyPort1.call(Sig:{ }, 10.0) {
702 []MyPort2.getreply(Sig:{ }) { }
703 []MyPort2.getreply { }
704 []MyPort2.catch(Sig, integer: ?) { }
705 []MyPort2.catch { }
706 []MyPort2.catch(timeout) { }
707 }
708 }
709
710 }
711 <END_MODULE>
712 <RESULT COUNT 5>
713 (?im)operation.+?refers.+?\bto\b.+?different.+?port
714 <END_RESULT>
715 <RESULT COUNT 5>
716 (?is)\berror:
717 <END_RESULT>
718 <RESULT>
719 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
720 <END_RESULT>
721 <END_TC>
722
723 :exmp.
724
725 .*---------------------------------------------------------------------*
726 :h3.Adhoc - message type not present on outgoing list of port
727 .*---------------------------------------------------------------------*
728 Note: this test is similar to one of the testcases in TTCN3_SA_5_TD.script
729 with the exception that the outgoing list contains more then one message type.
730 :xmp tab=0.
731
732 <TC - Adhoc - message type not present on outgoing list of port>
733
734 <COMPILE>
735 <VERDICT_LEAF PASS>
736 <MODULE TTCN Temp Temp.ttcn>
737 module Temp {
738
739 type port MyPortType message { out integer, float, charstring }
740 type component MyComponent { port MyPortType MyPort; }
741
742 testcase TC() runs on MyComponent {
743 MyPort.send('0111'B);
744 }
745
746 }
747 <END_MODULE>
748 <RESULT COUNT 1>
749 (?im)message.+?type.+?\bnot\b.+?\bon\b.+?outgoing.+?list
750 <END_RESULT>
751 <RESULT COUNT 1>
752 (?is)\berror:
753 <END_RESULT>
754 <RESULT>
755 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
756 <END_RESULT>
757 <END_TC>
758
759 :exmp.
760
761 .*---------------------------------------------------------------------*
762 :h3.Adhoc - inconsistent port connections
763 .*---------------------------------------------------------------------*
764 :xmp tab=0.
765
766 <TC - Adhoc - inconsistent port connections>
767
768 <COMPILE>
769 <VERDICT_LEAF PASS>
770 <MODULE TTCN Temp Temp.ttcn>
771 module Temp {
772
773 type port MyPortType1 message {
774 out integer, float, boolean;
775 in bitstring;
776 }
777 type port MyPortType2 message {
778 out bitstring, charstring, octetstring;
779 in integer;
780 }
781 type component MyComponent {
782 port MyPortType1 MyPort1;
783 port MyPortType2 MyPort2;
784 }
785
786 testcase TC() runs on MyComponent {
787 connect(self:MyPort1, self:MyPort2);
788 }
789
790 }
791 <END_MODULE>
792 <RESULT COUNT 1>
793 (?im)connection.+?between.+?port.+?types.+?\bnot\b.+?consistent
794 <END_RESULT>
795 <RESULT COUNT 4>
796 (?im)outgoing.+?message.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
797 <END_RESULT>
798 <RESULT COUNT 1>
799 (?is)\berror:
800 <END_RESULT>
801 <RESULT>
802 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
803 <END_RESULT>
804 <END_TC>
805
806 :exmp.
807
808 .*---------------------------------------------------------------------*
809 :h3.Adhoc - connecting message based port to procedure based port
810 .*---------------------------------------------------------------------*
811 :xmp tab=0.
812
813 <TC - Adhoc - connecting message based port to procedure based port>
814
815 <COMPILE>
816 <VERDICT_LEAF PASS>
817 <MODULE TTCN Temp Temp.ttcn>
818 module Temp {
819
820 signature Sig();
821 type port MyPortType1 message { inout integer }
822 type port MyPortType2 procedure { inout Sig }
823 type component MyComponent {
824 port MyPortType1 MyPort1;
825 port MyPortType2 MyPort2;
826 }
827
828 testcase TC() runs on MyComponent {
829 connect(self:MyPort1, self:MyPort2);
830 }
831
832 }
833 <END_MODULE>
834 <RESULT COUNT 1>
835 (?im)connection.+?between.+?port.+?types.+?\bnot\b.+?consistent
836 <END_RESULT>
837 <RESULT COUNT 1>
838 (?im)outgoing.+?message.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
839 <END_RESULT>
840 <RESULT COUNT 1>
841 (?im)outgoing.+?signature.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
842 <END_RESULT>
843 <RESULT COUNT 1>
844 (?is)\berror:
845 <END_RESULT>
846 <RESULT>
847 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
848 <END_RESULT>
849 <END_TC>
850
851 :exmp.
852
853 .*---------------------------------------------------------------------*
854 :h3.Adhoc - inconsistent port connections (with two components)
855 .*---------------------------------------------------------------------*
856 :xmp tab=0.
857
858 <TC - Adhoc - inconsistent port connections (with two components)>
859
860 <COMPILE>
861 <VERDICT_LEAF PASS>
862 <MODULE TTCN Temp Temp.ttcn>
863 module Temp {
864
865 type port MyPortType1 message {
866 out integer, float, boolean;
867 in bitstring;
868 }
869 type port MyPortType2 message {
870 out bitstring, charstring, octetstring;
871 in integer;
872 }
873 type component MyComponent1 { port MyPortType1 MyPort1 }
874 type component MyComponent2 { port MyPortType2 MyPort2 }
875
876 testcase TC() runs on MyComponent1 {
877 var MyComponent2 comp2;
878 connect(self:MyPort1, comp2:MyPort2);
879 }
880
881 }
882 <END_MODULE>
883 <RESULT COUNT 1>
884 (?im)connection.+?between.+?port.+?types.+?\bnot\b.+?consistent
885 <END_RESULT>
886 <RESULT COUNT 4>
887 (?im)outgoing.+?message.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
888 <END_RESULT>
889 <RESULT COUNT 1>
890 (?is)\berror:
891 <END_RESULT>
892 <RESULT>
893 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
894 <END_RESULT>
895 <END_TC>
896
897 :exmp.
898
899 .*---------------------------------------------------------------------*
900 :h3.Adhoc - connecting message based port to procedure based port (with two components)
901 .*---------------------------------------------------------------------*
902 :xmp tab=0.
903
904 <TC - Adhoc - connecting message based port to procedure based port (with two components)>
905
906 <COMPILE>
907 <VERDICT_LEAF PASS>
908 <MODULE TTCN Temp Temp.ttcn>
909 module Temp {
910
911 signature Sig();
912 type port MyPortType1 message { inout integer }
913 type port MyPortType2 procedure { inout Sig }
914
915 type component MyComponent1 { port MyPortType1 MyPort1 }
916 type component MyComponent2 { port MyPortType2 MyPort2 }
917
918 testcase TC() runs on MyComponent1 {
919 var MyComponent2 comp2;
920 connect(self:MyPort1, comp2:MyPort2);
921 }
922
923 }
924 <END_MODULE>
925 <RESULT COUNT 1>
926 (?im)connection.+?between.+?port.+?types.+?\bnot\b.+?consistent
927 <END_RESULT>
928 <RESULT COUNT 1>
929 (?im)outgoing.+?message.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
930 <END_RESULT>
931 <RESULT COUNT 1>
932 (?im)outgoing.+?signature.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
933 <END_RESULT>
934 <RESULT COUNT 1>
935 (?is)\berror:
936 <END_RESULT>
937 <RESULT>
938 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
939 <END_RESULT>
940 <END_TC>
941
942 :exmp.
943
944 .*---------------------------------------------------------------------*
945 :h3.Adhoc - mapping internal ports
946 .*---------------------------------------------------------------------*
947 :xmp tab=0.
948
949 <TC - Adhoc - mapping internal ports>
950
951 <COMPILE>
952 <VERDICT_LEAF PASS>
953 <MODULE TTCN Temp Temp.ttcn>
954 module Temp {
955
956 signature Sig();
957 type port MyPortType1 message { inout integer } with { extension "internal" }
958 type port MyPortType2 procedure { inout Sig } with { extension "internal" }
959
960 type component MyComponent {
961 port MyPortType1 MyPort1;
962 port MyPortType2 MyPort2;
963 }
964
965 testcase TC() runs on MyComponent system MyComponent {
966 // note: these will only cause warnings.
967 map(self:MyPort1, system:MyPort1);
968 map(self:MyPort2, system:MyPort2);
969 }
970
971 }
972 <END_MODULE>
973 <RESULT COUNT 4>
974 (?im)port.+?type.+?marked.+?\bas\b.+?internal
975 <END_RESULT>
976 <END_TC>
977
978 :exmp.
979
980 .*---------------------------------------------------------------------*
981 :h3.Adhoc - inconsistent port mappings
982 .*---------------------------------------------------------------------*
983 :xmp tab=0.
984
985 <TC - Adhoc - inconsistent port mappings>
986
987 <COMPILE>
988 <VERDICT_LEAF PASS>
989 <MODULE TTCN Temp Temp.ttcn>
990 module Temp {
991
992 type port MyPortType1 message {
993 out integer, float, boolean;
994 in bitstring;
995 }
996 type port MyPortType2 message {
997 out bitstring, charstring, octetstring;
998 in integer;
999 }
1000 type component MyComponent {
1001 port MyPortType1 MyPort1;
1002 port MyPortType2 MyPort2;
1003 }
1004
1005 testcase TC() runs on MyComponent system MyComponent {
1006 map(self:MyPort1, system:MyPort2);
1007 }
1008
1009 }
1010 <END_MODULE>
1011 <RESULT COUNT 1>
1012 (?im)mapping.+?between.+?port.+?type.+?\bnot\b.+?consistent
1013 <END_RESULT>
1014 <RESULT COUNT 3>
1015 (?im)outgoing.+?message.+?type.+?\bnot\b.+?present.+?\bon\b.+?outgoing.+?list
1016 <END_RESULT>
1017 <RESULT COUNT 1>
1018 (?im)incoming.+?message.+?type.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
1019 <END_RESULT>
1020 <RESULT COUNT 1>
1021 (?is)\berror:
1022 <END_RESULT>
1023 <RESULT>
1024 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1025 <END_RESULT>
1026 <END_TC>
1027
1028 :exmp.
1029
1030 .*---------------------------------------------------------------------*
1031 :h3.Adhoc - mapping message based port to procedure based port
1032 .*---------------------------------------------------------------------*
1033 :xmp tab=0.
1034
1035 <TC - Adhoc - mapping message based port to procedure based port>
1036
1037 <COMPILE>
1038 <VERDICT_LEAF PASS>
1039 <MODULE TTCN Temp Temp.ttcn>
1040 module Temp {
1041
1042 signature Sig();
1043 type port MyPortType1 message { inout integer }
1044 type port MyPortType2 procedure { inout Sig }
1045 type component MyComponent {
1046 port MyPortType1 MyPort1;
1047 port MyPortType2 MyPort2;
1048 }
1049
1050 testcase TC() runs on MyComponent system MyComponent {
1051 map(self:MyPort1, system:MyPort2);
1052 }
1053
1054 }
1055 <END_MODULE>
1056 <RESULT COUNT 1>
1057 (?im)mapping.+?between.+?port.+?type.+?\bnot\b.+?consistent
1058 <END_RESULT>
1059 <RESULT COUNT 1>
1060 (?im)outgoing.+?message.+?\bnot\b.+?present.+?\bon\b.+?outgoing.+?list
1061 <END_RESULT>
1062 <RESULT COUNT 1>
1063 (?im)incoming.+?signature.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
1064 <END_RESULT>
1065 <RESULT COUNT 1>
1066 (?is)\berror:
1067 <END_RESULT>
1068 <RESULT>
1069 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1070 <END_RESULT>
1071 <END_TC>
1072
1073 :exmp.
1074
1075 .*---------------------------------------------------------------------*
1076 :h3.Adhoc - mapping procedure based port to message based port
1077 .*---------------------------------------------------------------------*
1078 :xmp tab=0.
1079
1080 <TC - Adhoc - mapping procedure based port to message based port>
1081
1082 <COMPILE>
1083 <VERDICT_LEAF PASS>
1084 <MODULE TTCN Temp Temp.ttcn>
1085 module Temp {
1086
1087 signature Sig();
1088 type port MyPortType1 message { inout integer }
1089 type port MyPortType2 procedure { inout Sig }
1090 type component MyComponent {
1091 port MyPortType1 MyPort1;
1092 port MyPortType2 MyPort2;
1093 }
1094
1095 testcase TC() runs on MyComponent system MyComponent {
1096 map(self:MyPort2, system:MyPort1);
1097 }
1098
1099 }
1100 <END_MODULE>
1101 <RESULT COUNT 1>
1102 (?im)mapping.+?between.+?port.+?type.+?\bnot\b.+?consistent
1103 <END_RESULT>
1104 <RESULT COUNT 1>
1105 (?im)outgoing.+?signature.+?\bnot\b.+?present.+?\bon\b.+?outgoing.+?list
1106 <END_RESULT>
1107 <RESULT COUNT 1>
1108 (?im)incoming.+?message.+?\bnot\b.+?present.+?\bon\b.+?incoming.+?list
1109 <END_RESULT>
1110 <RESULT COUNT 1>
1111 (?is)\berror:
1112 <END_RESULT>
1113 <RESULT>
1114 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1115 <END_RESULT>
1116 <END_TC>
1117
1118 :exmp.
1119
1120 .*---------------------------------------------------------------------*
1121 :h3.Adhoc - executing non-testcase
1122 .*---------------------------------------------------------------------*
1123 :xmp tab=0.
1124
1125 <TC - Adhoc - executing non-testcase>
1126
1127 <COMPILE>
1128 <VERDICT_LEAF PASS>
1129 <MODULE TTCN Temp Temp.ttcn>
1130 module Temp {
1131
1132 function F() { }
1133 external function extF();
1134 signature S();
1135 altstep A() {
1136 timer T;
1137 []T.timeout { }
1138 }
1139
1140 control {
1141 var integer I;
1142 execute(F());
1143 execute(extF());
1144 execute(S());
1145 execute(A());
1146 execute(I());
1147 }
1148
1149 }
1150 <END_MODULE>
1151 <RESULT COUNT 5>
1152 (?im)reference.+?\bto\b.+?testcase.+?expected
1153 <END_RESULT>
1154 <RESULT COUNT 2>
1155 (?im)referenced.+?cannot.+?have.+?actual.+?parameters
1156 <END_RESULT>
1157 <RESULT COUNT 7>
1158 (?is)\berror:
1159 <END_RESULT>
1160 <RESULT>
1161 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1162 <END_RESULT>
1163 <END_TC>
1164
1165 :exmp.
1166
1167 .*---------------------------------------------------------------------*
1168 :h3.Adhoc - return statement in control part
1169 .*---------------------------------------------------------------------*
1170 :xmp tab=0.
1171
1172 <TC - Adhoc - return statement in control part>
1173
1174 <COMPILE>
1175 <VERDICT_LEAF FAIL>
1176 <MODULE TTCN Temp Temp.ttcn>
1177 module Temp {
1178
1179 control {
1180 timer T;
1181 alt {
1182 []T.timeout { return 0; }
1183 }
1184 }
1185
1186 }
1187 <END_MODULE>
1188 <RESULT COUNT 1>
1189 (?im)\bparse\b.+?\berror\b
1190 <END_RESULT>
1191 <END_TC>
1192
1193 :exmp.
1194
1195 .*---------------------------------------------------------------------*
1196 :h3.Adhoc - port operation in control part
1197 .*---------------------------------------------------------------------*
1198 :xmp tab=0.
1199
1200 <TC - Adhoc - port operation in control part>
1201
1202 <COMPILE>
1203 <VERDICT_LEAF PASS>
1204 <MODULE TTCN Temp Temp.ttcn>
1205 module Temp {
1206
1207 control {
1208 alt { // standalone port operations would cause parser error
1209 []any port.receive { }
1210 []any port.getcall { }
1211 []any port.getreply { }
1212 []any port.catch { }
1213
1214 []any port.check(receive) { }
1215 []any port.check(getcall) { }
1216 []any port.check(getreply) { }
1217 []any port.check(catch) { }
1218 }
1219 }
1220
1221 }
1222 <END_MODULE>
1223 <RESULT COUNT 8>
1224 (?im)port.+?operation.+?\bnot\b.+?allowed.+?\bin\b.+?control.+?part
1225 <END_RESULT>
1226 <RESULT COUNT 8>
1227 (?is)\berror:
1228 <END_RESULT>
1229 <RESULT>
1230 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1231 <END_RESULT>
1232 <END_TC>
1233
1234 :exmp.
1235
1236 .*---------------------------------------------------------------------*
1237 :h3.Adhoc - port operation: redirect to constant
1238 .*---------------------------------------------------------------------*
1239 :xmp tab=0.
1240
1241 <TC - Adhoc - port operation: redirect to constant>
1242
1243 <COMPILE>
1244 <VERDICT_LEAF PASS>
1245 <MODULE TTCN Temp Temp.ttcn>
1246 module Temp {
1247
1248 signature Sig(inout integer Par) return bitstring exception(charstring);
1249 template Sig tSig := { Par:=? }
1250 type port PPortType procedure { inout Sig }
1251 type port MPortType message { inout integer }
1252 type component MyComponent { port PPortType PPort; port MPortType MPort; }
1253
1254 const integer cI:=0;
1255 const bitstring cBS:=''B;
1256 const charstring cCS:="";
1257
1258 testcase TC() runs on MyComponent {
1259 alt {
1260 []MPort.receive(integer:?) -> value cI { }
1261 []PPort.getcall(tSig) -> param(cI) { }
1262 []PPort.getreply(tSig value ?) -> value cBS param(cI) { }
1263 []PPort.check(catch(Sig, charstring:?) -> value cCS) { }
1264 }
1265 }
1266
1267 }
1268 <END_MODULE>
1269 <RESULT COUNT 5>
1270 (?im)reference.+?\bto\b.+?variable.+?\bor\b.+?value.+?parameter.+?expected
1271 <END_RESULT>
1272 <RESULT COUNT 5>
1273 (?is)\berror:
1274 <END_RESULT>
1275 <RESULT>
1276 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1277 <END_RESULT>
1278 <END_TC>
1279
1280 :exmp.
1281
1282 .*---------------------------------------------------------------------*
1283 :h3.Adhoc - port operation: redirect to type
1284 .*---------------------------------------------------------------------*
1285 :xmp tab=0.
1286
1287 <TC - Adhoc - port operation: redirect to type>
1288
1289 <COMPILE>
1290 <VERDICT_LEAF PASS>
1291 <MODULE TTCN Temp Temp.ttcn>
1292 module Temp {
1293
1294 signature Sig(inout integer Par) return bitstring exception(charstring);
1295 template Sig tSig := { Par:=? }
1296 type port PPortType procedure { inout Sig }
1297 type port MPortType message { inout integer }
1298 type component MyComponent { port PPortType PPort; port MPortType MPort; }
1299
1300 type integer tI;
1301 type bitstring tBS;
1302 type charstring tCS;
1303
1304 testcase TC() runs on MyComponent {
1305 alt {
1306 []MPort.receive(integer:?) -> value tI { }
1307 []PPort.getcall(tSig) -> param(tI) { }
1308 []PPort.getreply(tSig value ?) -> value tBS param(tI) { }
1309 []PPort.check(catch(Sig, charstring:?) -> value tCS) { }
1310 }
1311 }
1312
1313 }
1314 <END_MODULE>
1315 <RESULT COUNT 5>
1316 (?im)reference.+?\bto\b.+?variable.+?\bor\b.+?value.+?parameter.+?expected
1317 <END_RESULT>
1318 <RESULT COUNT 5>
1319 (?is)\berror:
1320 <END_RESULT>
1321 <RESULT>
1322 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1323 <END_RESULT>
1324 <END_TC>
1325
1326 :exmp.
1327
1328 .*---------------------------------------------------------------------*
1329 :h3.Adhoc - check port operation: sender redirect
1330 .*---------------------------------------------------------------------*
1331 :xmp tab=0.
1332
1333 <TC - Adhoc - check port operation: sender redirect>
1334
1335 <COMPILEGCC>
1336 <VERDICT_LEAF PASS>
1337 <MODULE TTCN Temp Temp.ttcn>
1338 module Temp {
1339
1340 type port MyPortType message { inout integer }
1341 type component MyComponent { port MyPortType MyPort; }
1342
1343 testcase TC() runs on MyComponent {
1344 var MyComponent Peer;
1345 alt {
1346 []MyPort.check (-> sender Peer) { }
1347 }
1348 }
1349
1350 }
1351 <END_MODULE>
1352 <RESULT IF_PASS NEGATIVE>
1353 (?is)\berror:
1354 <END_RESULT>
1355 <END_TC>
1356
1357 :exmp.
1358
1359 .*---------------------------------------------------------------------*
1360 :h3.Adhoc - component operation in control part
1361 .*---------------------------------------------------------------------*
1362 :xmp tab=0.
1363
1364 <TC - Adhoc - component operation in control part>
1365
1366 <COMPILE>
1367 <VERDICT_LEAF PASS>
1368 <MODULE TTCN Temp Temp.ttcn>
1369 module Temp {
1370
1371 signature Sig(inout integer Par) return bitstring exception(charstring);
1372 template Sig tSig := { Par:=? }
1373 type port PPortType procedure { inout Sig }
1374 type port MPortType message { inout integer }
1375 type component MyComponent { port PPortType PPort; port MPortType MPort; }
1376
1377 function F() runs on MyComponent { }
1378
1379 control {
1380 var MyComponent C1, C2;
1381 // TR-683: Create and running component operations in control part
1382 C2 := MyComponent.create;
1383 if(C1.running) { }
1384 alt {
1385 []C1.done {
1386 connect(C1:PPort, C2:PPort); // 2 operands -> 2 errors!
1387 map(C1:MPort, system:MPort); // 2 operands -> 2 errors!
1388 disconnect(C1:PPort, C2:PPort); // 2 operands -> 2 errors!
1389 unmap(C1:MPort, system:MPort); // 2 operands -> 2 errors!
1390 C1.start(F());
1391 }
1392 }
1393 C1.stop;
1394 }
1395
1396 }
1397 <END_MODULE>
1398 <RESULT COUNT 1>
1399 (?im)operation.+?create.+?\bnot\b.+?allowed.+?\bin\b.+?control.+?part
1400 <END_RESULT>
1401 <RESULT COUNT 1>
1402 (?im)operation.+?component.+?running.+?\bnot\b.+?allowed.+?\bin\b.+?control.+?part
1403 <END_RESULT>
1404 <RESULT COUNT 11>
1405 (?im)component.+?operation.+?\bnot\b.+?allowed.+?\bin\b.+?control.+?part
1406 <END_RESULT>
1407 <RESULT COUNT 13>
1408 (?is)\berror:
1409 <END_RESULT>
1410 <RESULT>
1411 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1412 <END_RESULT>
1413 <END_TC>
1414
1415 :exmp.
1416
1417 .*---------------------------------------------------------------------*
1418 :h3.Adhoc - operations on not allowed component types
1419 .*---------------------------------------------------------------------*
1420 :xmp tab=0.
1421
1422 <TC - Adhoc - operations on not allowed component types>
1423
1424 <COMPILE>
1425 <VERDICT_LEAF PASS>
1426 <MODULE TTCN Temp Temp.ttcn>
1427 module Temp {
1428
1429 type port MPortType message { inout integer }
1430 type component MyComponent { port MPortType MPort; }
1431
1432 function F() runs on MyComponent { }
1433
1434 const MyComponent Null := null;
1435
1436 testcase TC() runs on MyComponent system MyComponent {
1437 map(Null:MPort, system:MPort);
1438 unmap(Null:MPort, system:MPort);
1439 connect(Null:MPort, self:MPort);
1440 disconnect(self:MPort, Null:MPort);
1441 map(mtc:MPort, self:MPort);
1442 connect(self:MPort, system:MPort);
1443 Null.start(F());
1444 Null.stop;
1445 // TR-683: Create and running component operations in control part
1446 // (in the `note' section: running operation on null component reference)
1447 if(Null.running) { Null.done; }
1448 }
1449
1450 }
1451 <END_MODULE>
1452 <RESULT COUNT 1>
1453 (?im)operand.+?refers.+?\bto\b.+?null.+?component.+?reference
1454 <END_RESULT>
1455 <RESULT COUNT 7>
1456 (?im)null.+?component.+?reference.+?shall.+?not.+?used.+?operation
1457 <END_RESULT>
1458 <RESULT COUNT 1>
1459 (?im)both.+?endpoints.+?are.+?test.+?component.+?ports
1460 <END_RESULT>
1461 <RESULT COUNT 1>
1462 (?im)system.+?component.+?reference.+?shall.+?not.+?used.+?operation
1463 <END_RESULT>
1464 <RESULT COUNT 10>
1465 (?is)\berror:
1466 <END_RESULT>
1467 <RESULT>
1468 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1469 <END_RESULT>
1470 <END_TC>
1471
1472 :exmp.
1473
1474 .*---------------------------------------------------------------------*
1475 :h3.Adhoc - create, map/unmap operation on non-component
1476 .*---------------------------------------------------------------------*
1477 :xmp tab=0.
1478
1479 <TC - Adhoc - create, map/unmap operation on non-component>
1480
1481 <COMPILE>
1482 <VERDICT_LEAF PASS>
1483 <MODULE TTCN Temp Temp.ttcn>
1484 module Temp {
1485
1486 const integer cInt := 9;
1487 type integer INT;
1488
1489 function F() runs on INT { }
1490
1491 testcase TC() runs on INT system INT {
1492 var integer vInt := 10;
1493 vInt := INT.create;
1494 map(vInt:MyPort, system:MyPort);
1495 unmap(vInt:MyPort, system:MyPort);
1496 }
1497
1498 }
1499 <END_MODULE>
1500 <RESULT COUNT 3>
1501 (?im)reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?component.+?type
1502 <END_RESULT>
1503 <RESULT COUNT 2>
1504 (?im)type.+?\bof\b.+?operand.+?should.+?\bbe\b.+?component.+?type
1505 <END_RESULT>
1506 <RESULT COUNT 1>
1507 (?im)reference.+?\bto\b.+?component.+?type.+?expected
1508 <END_RESULT>
1509 <RESULT COUNT 6>
1510 (?is)\berror:
1511 <END_RESULT>
1512 <RESULT>
1513 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1514 <END_RESULT>
1515 <END_TC>
1516
1517 :exmp.
1518
1519 .*---------------------------------------------------------------------*
1520 :h3.Adhoc - connect/disconnect on non-component
1521 .*---------------------------------------------------------------------*
1522 :xmp tab=0.
1523
1524 <TC - Adhoc - connect/disconnect operation on non-component>
1525
1526 <COMPILE>
1527 <VERDICT_LEAF PASS>
1528 <MODULE TTCN Temp Temp.ttcn>
1529 module Temp {
1530
1531 const integer cInt := 9;
1532 type integer INT;
1533
1534 testcase TC() runs on INT system INT {
1535 var integer vInt := 10;
1536 connect(vInt:MyPort, cInt:MyPort);
1537 disconnect(vInt:MyPort, cInt:MyPort);
1538 }
1539
1540 }
1541 <END_MODULE>
1542 <RESULT COUNT 2>
1543 (?im)reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?component.+?type
1544 <END_RESULT>
1545 <RESULT COUNT 2>
1546 (?im)type.+?\bof\b.+?operand.+?should.+?\bbe\b.+?component.+?type
1547 <END_RESULT>
1548 <RESULT COUNT 2>
1549 (?im)component.+?reference.+?expected.+?\bas\b.+?operand
1550 <END_RESULT>
1551 <RESULT COUNT 6>
1552 (?is)\berror:
1553 <END_RESULT>
1554 <RESULT>
1555 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1556 <END_RESULT>
1557 <END_TC>
1558
1559 :exmp.
1560
1561 .*---------------------------------------------------------------------*
1562 :h3.Adhoc - start/stop operation on non-component
1563 .*---------------------------------------------------------------------*
1564 :xmp tab=0.
1565
1566 <TC - Adhoc - start/stop operation on non-component>
1567
1568 <COMPILE>
1569 <VERDICT_LEAF PASS>
1570 <MODULE TTCN Temp Temp.ttcn>
1571 module Temp {
1572
1573 const integer cInt := 9;
1574 type integer INT;
1575
1576 function F() runs on INT { }
1577
1578 testcase TC() runs on INT system INT {
1579 var integer vInt := 10;
1580 vInt.start(F());
1581 vInt.stop;
1582 }
1583
1584 }
1585 <END_MODULE>
1586 <RESULT COUNT 3>
1587 (?im)reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?component.+?type
1588 <END_RESULT>
1589 <RESULT COUNT 2>
1590 (?im)type.+?\bof\b.+?operand.+?should.+?\bbe\b.+?component.+?type
1591 <END_RESULT>
1592 <RESULT COUNT 5>
1593 (?is)\berror:
1594 <END_RESULT>
1595 <RESULT>
1596 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1597 <END_RESULT>
1598 <END_TC>
1599
1600 :exmp.
1601
1602 .*---------------------------------------------------------------------*
1603 :h3.Adhoc - running/done operation on non-component
1604 .*---------------------------------------------------------------------*
1605 :xmp tab=0.
1606
1607 <TC - Adhoc - running/done operation on non-component>
1608
1609 <COMPILE>
1610 <VERDICT_LEAF PASS>
1611 <MODULE TTCN Temp Temp.ttcn>
1612 module Temp {
1613
1614 const integer cInt := 9;
1615 const integer INT := 120;
1616
1617 testcase TC() runs on INT system INT {
1618 var integer vInt := 10;
1619 if(vInt.running) {
1620 vInt.done;
1621 }
1622 }
1623
1624 }
1625 <END_MODULE>
1626 <RESULT COUNT 2>
1627 (?im)reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?type
1628 <END_RESULT>
1629 <RESULT COUNT 1>
1630 (?im)type.+?\bof\b.+?operand.+?should.+?\bbe\b.+?component.+?type
1631 <END_RESULT>
1632 <RESULT COUNT 1>
1633 (?im)component.+?reference.+?expected
1634 <END_RESULT>
1635 <RESULT COUNT 4>
1636 (?is)\berror:
1637 <END_RESULT>
1638 <RESULT>
1639 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1640 <END_RESULT>
1641 <END_TC>
1642
1643 :exmp.
1644
1645 .*---------------------------------------------------------------------*
1646 :h3.Adhoc - connect/map on non-port
1647 .*---------------------------------------------------------------------*
1648 :xmp tab=0.
1649
1650 <TC - Adhoc - connect/map on non-port>
1651
1652 <COMPILE>
1653 <VERDICT_LEAF PASS>
1654 <MODULE TTCN Temp Temp.ttcn>
1655 module Temp {
1656
1657 type component MyComponent { var integer vInt; }
1658
1659 testcase TC() runs on MyComponent system MyComponent {
1660 var MyComponent C;
1661 connect(C:vInt, self:vInt);
1662 map(self:vInt, system:vInt);
1663 }
1664
1665 }
1666 <END_MODULE>
1667 <RESULT COUNT 4>
1668 (?im)definition.+?\bis\b.+?variable.+?\bnot\b.+?port
1669 <END_RESULT>
1670 <RESULT COUNT 4>
1671 (?is)\berror:
1672 <END_RESULT>
1673 <RESULT>
1674 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1675 <END_RESULT>
1676 <END_TC>
1677
1678 :exmp.
1679
1680 .*---------------------------------------------------------------------*
1681 :h3.Adhoc - send/receive on non-port
1682 .*---------------------------------------------------------------------*
1683 :xmp tab=0.
1684
1685 <TC - Adhoc - send/receive on non-port>
1686
1687 <COMPILE>
1688 <VERDICT_LEAF PASS>
1689 <MODULE TTCN Temp Temp.ttcn>
1690 module Temp {
1691
1692 type component MyComponent { var integer vInt; }
1693
1694 testcase TC() runs on MyComponent system MyComponent {
1695 var integer lInt;
1696 vInt.send(3);
1697 alt {
1698 []lInt.receive(integer:?) { }
1699 }
1700 }
1701
1702 }
1703 <END_MODULE>
1704 <RESULT COUNT 2>
1705 (?im)reference.+?\bto\b.+?port.+?expected
1706 <END_RESULT>
1707 <RESULT COUNT 2>
1708 (?is)\berror:
1709 <END_RESULT>
1710 <RESULT>
1711 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1712 <END_RESULT>
1713 <END_TC>
1714
1715 :exmp.
1716
1717 .*---------------------------------------------------------------------*
1718 :h3.Adhoc - call/getreply on non-port
1719 .*---------------------------------------------------------------------*
1720 :xmp tab=0.
1721
1722 <TC - Adhoc - call/getreply on non-port>
1723
1724 <COMPILE>
1725 <VERDICT_LEAF PASS>
1726 <MODULE TTCN Temp Temp.ttcn>
1727 module Temp {
1728
1729 signature Sig();
1730 type component MyComponent { var integer vInt; }
1731
1732 testcase TC() runs on MyComponent system MyComponent {
1733 var MyComponent C;
1734 vInt.call(Sig:{}, 10.0) {
1735 []vInt.getreply(Sig:{}) { }
1736 []vInt.catch { }
1737 []vInt.catch(timeout) { }
1738 }
1739 }
1740
1741 }
1742 <END_MODULE>
1743 <RESULT COUNT 4>
1744 (?im)reference.+?\bto\b.+?port.+?expected
1745 <END_RESULT>
1746 <RESULT COUNT 4>
1747 (?is)\berror:
1748 <END_RESULT>
1749 <RESULT>
1750 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1751 <END_RESULT>
1752 <END_TC>
1753
1754 :exmp.
1755
1756 .*---------------------------------------------------------------------*
1757 :h3.Adhoc - too few or too many parameters to reference
1758 .*---------------------------------------------------------------------*
1759 :xmp tab=0.
1760
1761 <TC - Adhoc - too few or too many parameters to reference>
1762
1763 <COMPILE>
1764 <VERDICT_LEAF PASS>
1765 <MODULE TTCN Temp Temp.ttcn>
1766 module Temp {
1767
1768 function F(in integer A, in float B, in charstring E) { }
1769
1770 function G() {
1771 F(0, 1.0);
1772 F(0, 1.0, "two", '0011'B);
1773 }
1774
1775 }
1776 <END_MODULE>
1777 <RESULT COUNT 1>
1778 (?im)\btoo\b.+?few.+?parameters
1779 <END_RESULT>
1780 <RESULT COUNT 1>
1781 (?im)\btoo\b.+?many.+?parameters
1782 <END_RESULT>
1783 <RESULT COUNT 2>
1784 (?is)\berror:
1785 <END_RESULT>
1786 <RESULT>
1787 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1788 <END_RESULT>
1789 <END_TC>
1790
1791 :exmp.
1792
1793 .*---------------------------------------------------------------------*
1794 :h3.Adhoc - imported component element hides a definition at module scope
1795 .*---------------------------------------------------------------------*
1796 NOTE: causes only warning messages.
1797 :xmp tab=0.
1798
1799 <TC - Adhoc - imported component element hides a definition at module scope>
1800
1801 <COMPILE>
1802 <VERDICT_LEAF PASS>
1803 <MODULE TTCN TempA TempA.ttcn>
1804 module TempA {
1805 type component MyComponent { const integer Hidden := 9; }
1806 }
1807 <END_MODULE>
1808 <MODULE TTCN TempB TempB.ttcn>
1809 module TempB {
1810 import from TempA all;
1811 const integer Hidden := 9;
1812 testcase TC() runs on MyComponent { }
1813 }
1814 <END_MODULE>
1815 <RESULT COUNT 1>
1816 (?im)warning.+?imported.+?component.+?element.+?definition.+?hides.+?definition.+?\bat\b.+?module.+?scope
1817 <END_RESULT>
1818 <RESULT COUNT 1>
1819 (?im)warning.+?hidden.+?definition.+?\bis\b.+?here
1820 <END_RESULT>
1821 <END_TC>
1822
1823 :exmp.
1824
1825 .*---------------------------------------------------------------------*
1826 :h3.Adhoc - constant definition for port and signature
1827 .*---------------------------------------------------------------------*
1828 :xmp tab=0.
1829
1830 <TC - Adhoc - constant definition for port and signature>
1831
1832 <COMPILE>
1833 <VERDICT_LEAF PASS>
1834 <MODULE TTCN Temp Temp.ttcn>
1835 module Temp {
1836 signature Sig();
1837 type port MyPortType procedure { inout Sig }
1838 const Sig cSig := 0;
1839 const MyPortType cMyPort := 0;
1840 }
1841 <END_MODULE>
1842 <RESULT COUNT 1>
1843 (?im)constant.+?cannot.+?\bbe\b.+?defined.+?for.+?signature
1844 <END_RESULT>
1845 <RESULT COUNT 1>
1846 (?im)constant.+?cannot.+?\bbe\b.+?defined.+?for.+?port.+?type
1847 <END_RESULT>
1848 <RESULT COUNT 2>
1849 (?is)\berror:
1850 <END_RESULT>
1851 <RESULT>
1852 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1853 <END_RESULT>
1854 <END_TC>
1855
1856 :exmp.
1857
1858 .*---------------------------------------------------------------------*
1859 :h3.Adhoc - external constant definition for port and signature
1860 .*---------------------------------------------------------------------*
1861 :xmp tab=0.
1862
1863 <TC - Adhoc - external constant definition for port and signature>
1864
1865 <COMPILE>
1866 <VERDICT_LEAF PASS>
1867 <MODULE TTCN Temp Temp.ttcn>
1868 module Temp {
1869 signature Sig();
1870 type port MyPortType procedure { inout Sig }
1871 external const Sig cSig;
1872 external const MyPortType cMyPort;
1873 }
1874 <END_MODULE>
1875 <RESULT COUNT 1>
1876 (?im)external.+?constant.+?cannot.+?\bbe\b.+?defined.+?for.+?signature
1877 <END_RESULT>
1878 <RESULT COUNT 1>
1879 (?im)external.+?constant.+?cannot.+?\bbe\b.+?defined.+?for.+?port.+?type
1880 <END_RESULT>
1881 <RESULT COUNT 2>
1882 (?is)\berror:
1883 <END_RESULT>
1884 <RESULT>
1885 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1886 <END_RESULT>
1887 <END_TC>
1888
1889 :exmp.
1890
1891 .*---------------------------------------------------------------------*
1892 :h3.Adhoc - signature as module parameter
1893 .*---------------------------------------------------------------------*
1894 :xmp tab=0.
1895
1896 <TC - Adhoc - signature as module parameter>
1897
1898 <COMPILE>
1899 <VERDICT_LEAF PASS>
1900 <MODULE TTCN Temp Temp.ttcn>
1901 module Temp {
1902 signature Sig();
1903 modulepar {
1904 Sig PSig;
1905 }
1906 }
1907 <END_MODULE>
1908 <RESULT COUNT 1>
1909 (?im)type.+?\bof\b.+?module.+?parameter.+?cannot.+?\bbe\b.+?signature
1910 <END_RESULT>
1911 <RESULT COUNT 1>
1912 (?is)\berror:
1913 <END_RESULT>
1914 <RESULT>
1915 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1916 <END_RESULT>
1917 <END_TC>
1918
1919 :exmp.
1920
1921 .*---------------------------------------------------------------------*
1922 :h3.Adhoc - template definition for port type
1923 .*---------------------------------------------------------------------*
1924 :xmp tab=0.
1925
1926 <TC - Adhoc - template definition for port type>
1927
1928 <COMPILE>
1929 <VERDICT_LEAF PASS>
1930 <MODULE TTCN Temp Temp.ttcn>
1931 module Temp {
1932 type port MyPortType message { inout integer; }
1933 template MyPortType tPort := 0;
1934 }
1935 <END_MODULE>
1936 <RESULT COUNT 1>
1937 (?im)template.+?cannot.+?\bbe\b.+?defined.+?\bfor\b.+?port.+?type
1938 <END_RESULT>
1939 <RESULT COUNT 1>
1940 (?is)\berror:
1941 <END_RESULT>
1942 <RESULT>
1943 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1944 <END_RESULT>
1945 <END_TC>
1946
1947 :exmp.
1948
1949 .*---------------------------------------------------------------------*
1950 :h3.Adhoc - modified template from non-template
1951 .*---------------------------------------------------------------------*
1952 :xmp tab=0.
1953
1954 <TC - Adhoc - modified template from non-template>
1955
1956 <COMPILE>
1957 <VERDICT_LEAF PASS>
1958 <MODULE TTCN Temp Temp.ttcn>
1959 module Temp {
1960 type record MyRecord { integer I, float F }
1961 const MyRecord cMyRecord := { 0, 1.0 }
1962 template MyRecord tMyRecord modifies cMyRecord := { F := 1.1 }
1963 }
1964 <END_MODULE>
1965 <RESULT COUNT 1>
1966 (?im)reference.+?\bto\b.+?template.+?expected.+?\bin\b.+?modifies
1967 <END_RESULT>
1968 <RESULT COUNT 1>
1969 (?is)\berror:
1970 <END_RESULT>
1971 <RESULT>
1972 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
1973 <END_RESULT>
1974 <END_TC>
1975
1976 :exmp.
1977
1978 .*---------------------------------------------------------------------*
1979 :h3.Adhoc - modified template with parameters
1980 .*---------------------------------------------------------------------*
1981 :xmp tab=0.
1982
1983 <TC - Adhoc - modified template with parameters>
1984
1985 <COMPILE>
1986 <VERDICT_LEAF PASS>
1987 <MODULE TTCN Temp Temp.ttcn>
1988 module Temp {
1989 type record MyRecord { integer I, float F }
1990 template MyRecord MyBaseT (integer pI, template float pF) := {
1991 I := pI, F := pF
1992 }
1993
1994 // fewer parameters
1995 template MyRecord MyModifiedT1 (integer pI) modifies MyBaseT := {
1996 I := pI
1997 }
1998
1999 // different kind of parameters
2000 template MyRecord MyModifiedT2 (template integer pI, float pF)
2001 modifies MyBaseT:= {
2002 I := pI
2003 }
2004
2005 // different type of parameters
2006 template MyRecord MyModifiedT3 (charstring pI, template octetstring pF)
2007 modifies MyBaseT:= {
2008 I := 0
2009 }
2010 }
2011 <END_MODULE>
2012 <RESULT COUNT 1>
2013 (?im)modified.+?template.+?has.+?fewer.+?formal.+?parameters.+?than.+?base.+?template
2014 <END_RESULT>
2015 <RESULT COUNT 2>
2016 (?im)kind.+?\bof\b.+?parameter.+?\bis\b.+?\bnot\b.+?\bthe\b.+?same.+?\bas\b.+?\bin\b.+?base.+?template
2017 <END_RESULT>
2018 <RESULT COUNT 2>
2019 (?im)type.+?\bof\b.+?parameter.+?\bis\b.+?\bnot\b.+?\bthe\b.+?same.+?\bas\b.+?\bin\b.+?base.+?template
2020 <END_RESULT>
2021 <RESULT COUNT 5>
2022 (?is)\berror:
2023 <END_RESULT>
2024 <RESULT>
2025 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2026 <END_RESULT>
2027 <END_TC>
2028
2029 :exmp.
2030
2031 .*---------------------------------------------------------------------*
2032 :h3.Adhoc - variable definition for signature
2033 .*---------------------------------------------------------------------*
2034 :xmp tab=0.
2035
2036 <TC - Adhoc - variable definition for signature>
2037
2038 <COMPILE>
2039 <VERDICT_LEAF PASS>
2040 <MODULE TTCN Temp Temp.ttcn>
2041 module Temp {
2042 signature Sig();
2043 function F() {
2044 var Sig lSig;
2045 }
2046 }
2047 <END_MODULE>
2048 <RESULT COUNT 1>
2049 (?im)variable.+?cannot.+?\bbe\b.+?defined.+?for.+?signature
2050 <END_RESULT>
2051 <RESULT COUNT 1>
2052 (?is)\berror:
2053 <END_RESULT>
2054 <RESULT>
2055 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2056 <END_RESULT>
2057 <END_TC>
2058
2059 :exmp.
2060
2061 .*---------------------------------------------------------------------*
2062 :h3.Adhoc - template variable for port type
2063 .*---------------------------------------------------------------------*
2064 :xmp tab=0.
2065
2066 <TC - Adhoc - template variable for port type>
2067
2068 <COMPILE>
2069 <VERDICT_LEAF PASS>
2070 <MODULE TTCN Temp Temp.ttcn>
2071 module Temp {
2072 type port MyPortType message { inout charstring }
2073 function F() {
2074 var template MyPortType tMyPort;
2075 }
2076 }
2077 <END_MODULE>
2078 <RESULT COUNT 1>
2079 (?im)template.+?variable.+?cannot.+?\bbe\b.+?defined.+?for.+?port.+?type
2080 <END_RESULT>
2081 <RESULT COUNT 1>
2082 (?is)\berror:
2083 <END_RESULT>
2084 <RESULT>
2085 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2086 <END_RESULT>
2087 <END_TC>
2088
2089 :exmp.
2090
2091 .*---------------------------------------------------------------------*
2092 :h3.Adhoc - timer array without default duration
2093 .*---------------------------------------------------------------------*
2094 :xmp tab=0.
2095
2096 <TC - Adhoc - timer array without default duration>
2097
2098 <COMPILE>
2099 <VERDICT_LEAF PASS>
2100 <MODULE TTCN Temp Temp.ttcn>
2101 module Temp {
2102 function F() {
2103 timer MyTimers[10];
2104 MyTimers.start;
2105 MyTimers[0].start;
2106 }
2107 }
2108 <END_MODULE>
2109 <RESULT COUNT 2>
2110 (?im)timer.+?does.+?not.+?have.+?default.+?duration
2111 <END_RESULT>
2112 <RESULT COUNT 1>
2113 (?im)Reference.+?\bto\b.+?timer.+?array.+?without.+?array.+?index
2114 <END_RESULT>
2115 <RESULT COUNT 3>
2116 (?is)\berror:
2117 <END_RESULT>
2118 <RESULT>
2119 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2120 <END_RESULT>
2121 <END_TC>
2122
2123 :exmp.
2124
2125 .*---------------------------------------------------------------------*
2126 :h3.Adhoc - timer array with empty array as default duration
2127 .*---------------------------------------------------------------------*
2128 :xmp tab=0.
2129
2130 <TC - Adhoc - timer array with empty array as default duration>
2131
2132 <COMPILE>
2133 <VERDICT_LEAF PASS>
2134 <MODULE TTCN Temp Temp.ttcn>
2135 module Temp {
2136 function F() {
2137 // Def_Timer::has_default_duration()
2138 timer MyFaultyTimers[10]:={};
2139 timer MyOkTimers[3] := { 1.0, 1.2, 2.78 };
2140 MyFaultyTimers[0].start;
2141 MyOkTimers[2].start;
2142 }
2143 }
2144 <END_MODULE>
2145 <RESULT COUNT 1>
2146 (?im)Too.+?few.+?elements.+?\bin\b.+?default.+?duration.+?\bof\b.+?timer.+?array
2147 <END_RESULT>
2148 <RESULT COUNT 1>
2149 (?is)\berror:
2150 <END_RESULT>
2151 <RESULT>
2152 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2153 <END_RESULT>
2154 <END_TC>
2155
2156 :exmp.
2157
2158 .*---------------------------------------------------------------------*
2159 :h3.Adhoc - timer array with default duration of type other then SEQOF
2160 .*---------------------------------------------------------------------*
2161 :xmp tab=0.
2162
2163 <TC - Adhoc - timer array with default duration of type other then SEQOF>
2164
2165 <COMPILE>
2166 <VERDICT_LEAF PASS>
2167 <MODULE TTCN Temp Temp.ttcn>
2168 module Temp {
2169 function F() {
2170 timer MyFaultyTimers1[10] := ":)";
2171 timer MyFaultyTimers2[Nonexi] := '0101'B;
2172 MyFaultyTimers1[0].start;
2173 MyFaultyTimers2[0].start;
2174 }
2175 }
2176 <END_MODULE>
2177 <RESULT COUNT 2>
2178 (?im)array.+?value.+?was.+?expected.+?\bas\b.+?default.+?duration.+?\bof\b.+?timer.+?array
2179 <END_RESULT>
2180 <RESULT COUNT 1>
2181 (?im)\bno\b.+?definition.+?Nonexi
2182 <END_RESULT>
2183 <RESULT COUNT 3>
2184 (?is)\berror:
2185 <END_RESULT>
2186 <RESULT>
2187 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2188 <END_RESULT>
2189 <END_TC>
2190
2191 :exmp.
2192
2193 .*---------------------------------------------------------------------*
2194 :h3.Adhoc - reference does not refer to a port type
2195 .*---------------------------------------------------------------------*
2196 :xmp tab=0.
2197
2198 <TC - Adhoc - reference does not refer to a port type>
2199
2200 <COMPILE>
2201 <VERDICT_LEAF PASS>
2202 <MODULE TTCN Temp Temp.ttcn>
2203 module Temp {
2204 type integer Int;
2205 const integer cInt:=0;
2206 type component MyComponent {
2207 port Int PInt;
2208 port cInt PcInt;
2209 }
2210 }
2211 <END_MODULE>
2212 <RESULT COUNT 1>
2213 (?im)type.+?reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?port.+?type
2214 <END_RESULT>
2215 <RESULT COUNT 1>
2216 (?im)reference.+?does.+?\bnot\b.+?refer.+?\bto\b.+?\ba\b\s*type
2217 <END_RESULT>
2218 <RESULT COUNT 2>
2219 (?is)\berror:
2220 <END_RESULT>
2221 <RESULT>
2222 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2223 <END_RESULT>
2224 <END_TC>
2225
2226 :exmp.
2227
2228 .*---------------------------------------------------------------------*
2229 :h3.Adhoc - port and signature cannot be the return type of a function
2230 .*---------------------------------------------------------------------*
2231 :xmp tab=0.
2232
2233 <TC - Adhoc - port and signature cannot be the return type of a function>
2234
2235 <COMPILE>
2236 <VERDICT_LEAF PASS>
2237 <MODULE TTCN Temp Temp.ttcn>
2238 module Temp {
2239 signature Sig();
2240 type port MyPort procedure { inout Sig }
2241 function F() return Sig { }
2242 function G() return MyPort { }
2243 }
2244 <END_MODULE>
2245 <RESULT COUNT 1>
2246 (?im)value.+?\bof\b.+?signature.+?cannot.+?\bbe\b.+?return.+?type.+?\bof\b.+?function
2247 <END_RESULT>
2248 <RESULT COUNT 1>
2249 (?im)port.+?type.+?cannot.+?\bbe\b.+?return.+?type.+?\bof\b.+?function
2250 <END_RESULT>
2251 <RESULT COUNT 4>
2252 (?is)\berror:
2253 <END_RESULT>
2254 <RESULT>
2255 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2256 <END_RESULT>
2257 <END_TC>
2258
2259 :exmp.
2260
2261 .*---------------------------------------------------------------------*
2262 :h3.Adhoc - starting a function with return type `default' on a PTC
2263 .*---------------------------------------------------------------------*
2264 :xmp tab=0.
2265
2266 <TC - Adhoc - starting a function with return type `default' on a PTC>
2267
2268 <COMPILE>
2269 <VERDICT_LEAF PASS>
2270 <MODULE TTCN Temp Temp.ttcn>
2271 module Temp {
2272 type component MyComponent { }
2273 type port P message { out RRrof; }
2274 type record of RR RRrof;
2275 type record RR { RR2 rr2 optional, aref ar, aref_S arS, aref_C arA }
2276 type record RR2 { RRrof rrrof optional, default d }
2277
2278 type altstep aref();
2279 type altstep aref_C() runs on MyComponent;
2280 type altstep aref_S() runs on self;
2281
2282 function F() runs on MyComponent return default { return null; }
2283
2284 testcase TC() runs on MyComponent {
2285 var MyComponent C;
2286 C.start(F());
2287 }
2288 }
2289 <END_MODULE>
2290 <RESULT COUNT 1>
2291 (?im)Default type cannot be sent or received on a port
2292 <END_RESULT>
2293 <RESULT COUNT 1>
2294 (?im)Altstep type .+ with 'runs on self' clause cannot be sent or received on a port
2295 <END_RESULT>
2296 <RESULT COUNT 1>
2297 (?im)Default type cannot be the return type or embedded in the return type of function .+ if it is started on a parallel test component
2298 <END_RESULT>
2299 <RESULT COUNT 3>
2300 (?is)\berror:
2301 <END_RESULT>
2302 <RESULT>
2303 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2304 <END_RESULT>
2305 <END_TC>
2306
2307 :exmp.
2308
2309 .*---------------------------------------------------------------------*
2310 :h3.Adhoc - port and signature cannot be the return type of an external function
2311 .*---------------------------------------------------------------------*
2312 :xmp tab=0.
2313
2314 <TC - Adhoc - port and signature cannot be the return type of an external function>
2315
2316 <COMPILE>
2317 <VERDICT_LEAF PASS>
2318 <MODULE TTCN Temp Temp.ttcn>
2319 module Temp {
2320 signature Sig();
2321 type port MyPort procedure { inout Sig }
2322 external function F() return Sig;
2323 external function G() return MyPort;
2324 }
2325 <END_MODULE>
2326 <RESULT COUNT 1>
2327 (?im)value.+?\bof\b.+?signature.+?cannot.+?\bbe\b.+?return.+?type.+?\bof\b.+?external.+?function
2328 <END_RESULT>
2329 <RESULT COUNT 1>
2330 (?im)port.+?type.+?cannot.+?\bbe\b.+?return.+?type.+?\bof\b.+?external.+?function
2331 <END_RESULT>
2332 <RESULT COUNT 2>
2333 (?is)\berror:
2334 <END_RESULT>
2335 <RESULT>
2336 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2337 <END_RESULT>
2338 <END_TC>
2339
2340 :exmp.
2341
2342 .*---------------------------------------------------------------------*
2343 :h3.Adhoc - reference to omit value
2344 .*---------------------------------------------------------------------*
2345 :xmp tab=0.
2346
2347 <TC - Adhoc - reference to omit value>
2348
2349 <COMPILE>
2350 <VERDICT_LEAF PASS>
2351 <MODULE TTCN Temp Temp.ttcn>
2352 module Temp {
2353 type record MyType1 {
2354 integer I,
2355 float F optional
2356 }
2357 type record MyType2 {
2358 integer I optional,
2359 float F
2360 }
2361 template MyType1 T1 := { 1, omit };
2362 // TR-702: Optional field in record type
2363 template MyType2 T2 := { omit, T1.F };
2364 }
2365 <END_MODULE>
2366 <RESULT COUNT 1>
2367 (?im)error.+?omit.+?not.+?allowed.+?context
2368 <END_RESULT>
2369 <RESULT COUNT 1>
2370 (?is)\berror:
2371 <END_RESULT>
2372 <RESULT>
2373 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2374 <END_RESULT>
2375 <END_TC>
2376
2377 :exmp.
2378
2379 .*---------------------------------------------------------------------*
2380 :h3.Adhoc - reference to inactive template field
2381 .*---------------------------------------------------------------------*
2382 :xmp tab=0.
2383
2384 <TC - Adhoc - reference to inactive template field>
2385
2386 <COMPILE>
2387 <VERDICT_LEAF PASS>
2388 <MODULE TTCN Temp Temp.ttcn>
2389 module Temp {
2390 type union MyType {
2391 integer I,
2392 float F
2393 }
2394 template MyType T1 := { I := 1 }
2395 template float T2 := T1.F;
2396 }
2397 <END_MODULE>
2398 <RESULT COUNT 1>
2399 (?im)reference.+?\bto\b.+?inactive.+?field.+?\bin\b.+?template
2400 <END_RESULT>
2401 <RESULT COUNT 1>
2402 (?is)\berror:
2403 <END_RESULT>
2404 <RESULT>
2405 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2406 <END_RESULT>
2407 <END_TC>
2408
2409 :exmp.
2410
2411 .*---------------------------------------------------------------------*
2412 :h3.Adhoc - reference to field of value list match
2413 .*---------------------------------------------------------------------*
2414 :xmp tab=0.
2415
2416 <TC - Adhoc - reference to field of value list match>
2417
2418 <COMPILE>
2419 <VERDICT_LEAF PASS>
2420 <MODULE TTCN Temp Temp.ttcn>
2421 module Temp {
2422 type union MyType {
2423 integer I,
2424 float F
2425 }
2426 template MyType T1 := ({ I := 1 }, { I := 2 }, { F := 3.0 });
2427 template float T2 := T1.F;
2428 }
2429 <END_MODULE>
2430 <RESULT COUNT 1>
2431 (?im)reference.+?\bto\b.+?field.+?\bof\b.+?value.+?list.+?match
2432 <END_RESULT>
2433 <RESULT COUNT 1>
2434 (?is)\berror:
2435 <END_RESULT>
2436 <RESULT>
2437 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2438 <END_RESULT>
2439 <END_TC>
2440
2441 :exmp.
2442
2443 .*---------------------------------------------------------------------*
2444 :h3.Adhoc - valueof operation on field of a template which has no fields
2445 .*---------------------------------------------------------------------*
2446 :xmp tab=0.
2447
2448 <TC - Adhoc - valueof operation on field of a template which has no fields>
2449
2450 <COMPILE>
2451 <VERDICT_LEAF PASS>
2452 <MODULE TTCN Temp Temp.ttcn>
2453 module Temp {
2454 template integer tI := 1;
2455 function F() {
2456 // TR-691: Three error messages for valueof operation on template's
2457 // nonexistent filed
2458 var integer I := valueof(tI.Nonexi);
2459 }
2460 }
2461 <END_MODULE>
2462 <RESULT COUNT 1>
2463 (?im)invalid.+?field.+?reference.+?integer.+?does.+?not.+?have.+?fields
2464 <END_RESULT>
2465 <RESULT COUNT 1>
2466 (?is)\berror:
2467 <END_RESULT>
2468 <RESULT>
2469 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2470 <END_RESULT>
2471 <RESULT IF_FAIL POSITIVE>
2472 (?im)invalid.+?field.+?reference.+?integer.+?does.+?not.+?have.+?fields
2473 <END_RESULT>
2474 <END_TC>
2475
2476 :exmp.
2477
2478 .*---------------------------------------------------------------------*
2479 :h3.Adhoc - referenced template array
2480 .*---------------------------------------------------------------------*
2481 :xmp tab=0.
2482
2483 <TC - Adhoc - referenced template array>
2484
2485 <COMPILE>
2486 <VERDICT_LEAF FAIL>
2487 <MODULE TTCN Temp Temp.ttcn>
2488 module Temp {
2489 type set of integer RI;
2490 template RI tI := { 0, 1, 2 }
2491 const charstring cCS := "foobar";
2492 const bitstring cBS := '0010'B;
2493 type record OmitType { integer Omit optional }
2494 template OmitType OmitRec := { omit };
2495 type record of charstring recofCharstring;
2496
2497 function F() {
2498 var integer I := valueof(tI[-1]);
2499 var integer J := valueof(tI[1274]);
2500
2501 // TR-692: Strange error messages with valueof operation used on
2502 // record of templates
2503 var integer K := valueof(tI[Nonexi]);
2504 var integer L := valueof(tI[valueof(OmitRec.Omit)]);
2505 var integer M := valueof(tI[omit]);
2506 var integer N := valueof(OmitRec.Omit);
2507
2508 if(match(tI[cBS], I)) { }
2509
2510 var template recofCharstring T:= {"first", "second"};
2511 const charstring temp := valueof(T[0]);
2512 }
2513 }
2514 <END_MODULE>
2515 <RESULT COUNT 1>
2516 (?im)non-negative.+?integer.+?value.+?expected
2517 <END_RESULT>
2518 <RESULT COUNT 1>
2519 (?im)index.+?overflow
2520 <END_RESULT>
2521 <RESULT COUNT 1>
2522 (?im)\bno\b.+?definition.+?Nonexi
2523 <END_RESULT>
2524 <RESULT COUNT 2>
2525 (?im)specific.+?value.+?expected.+?instead.+?\bof\b.+?omit
2526 <END_RESULT>
2527 <RESULT COUNT 2>
2528 (?im)value.+?\bor\b.+?expression.+?\bof\b.+?type.+?integer.+?expected
2529 <END_RESULT>
2530 <RESULT COUNT 1>
2531 (?im)reference.+?\bto\b.+?value.+?expected.+?instead.+?\bof\b.+?template
2532 <END_RESULT>
2533 <RESULT COUNT 8>
2534 (?is)\berror:
2535 <END_RESULT>
2536 <RESULT>
2537 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2538 <END_RESULT>
2539 <RESULT IF_FAIL COUNT 1>
2540 (?im)non-negative.+?integer.+?value.+?expected
2541 <END_RESULT>
2542 <RESULT IF_FAIL COUNT 1>
2543 (?im)index.+?overflow
2544 <END_RESULT>
2545 <RESULT IF_FAIL COUNT 1>
2546 (?im)\bno\b.+?definition.+?Nonexi
2547 <END_RESULT>
2548 <RESULT IF_FAIL COUNT 2>
2549 (?im)specific.+?value.+?expected.+?instead.+?\bof\b.+?omit
2550 <END_RESULT>
2551 <RESULT IF_FAIL COUNT 2>
2552 (?im)value.+?\bor\b.+?expression.+?\bof\b.+?type.+?integer.+?expected
2553 <END_RESULT>
2554 <RESULT IF_FAIL COUNT 2>
2555 (?im)reference.+?\bto\b.+?value.+?expected.+?instead.+?\bof\b.+?template
2556 <END_RESULT>
2557 <END_TC>
2558
2559 :exmp.
2560
2561 .*---------------------------------------------------------------------*
2562 :h3.Adhoc - too many/few elements in value list for record template
2563 .*---------------------------------------------------------------------*
2564 :xmp tab=0.
2565
2566 <TC - Adhoc - too many/few elements in value list for record template>
2567
2568 <COMPILE>
2569 <VERDICT_LEAF PASS>
2570 <MODULE TTCN Temp Temp.ttcn>
2571 module Temp {
2572 type record MyType {
2573 integer I,
2574 float F
2575 }
2576 template MyType T1 := { 0 }
2577 template MyType T2 := { 0, 1.0, 2 }
2578 }
2579 <END_MODULE>
2580 <RESULT COUNT 0>
2581 (?im)\berror\b.+?too.+?few.+?elements.+?in.+?value.+?list
2582 <END_RESULT>
2583 <RESULT COUNT 1>
2584 (?im)\berror\b.+?too.+?many.+?elements.+?in.+?value.+?list
2585 <END_RESULT>
2586 <RESULT COUNT 1>
2587 (?is)\berror:
2588 <END_RESULT>
2589 <RESULT>
2590 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2591 <END_RESULT>
2592 <END_TC>
2593 :exmp.
2594
2595
2596 .*---------------------------------------------------------------------*
2597 :h3.TTCN-3:: IsValue - for a type reference
2598 .*---------------------------------------------------------------------*
2599 :xmp tab=0.
2600 <TC - TTCN-3::IsValue - for a type reference>
2601
2602 <COMPILE>
2603 <VERDICT_LEAF PASS>
2604 <MODULE TTCN ModuleA ModuleA.ttcn>
2605 module ModuleA {
2606
2607 type record length (10) of integer int10;
2608
2609 type component C1
2610 {
2611 }
2612
2613 testcase tc_isvalue_const() runs on C1
2614 {
2615 if ( isvalue(int10) ) {
2616 setverdict(pass);
2617 } else {
2618 setverdict(fail);
2619 }
2620 }
2621 }
2622 <END_MODULE>
2623 <RESULT IF_PASS COUNT 1>
2624 (?im)\bReference to a value or template was expected instead of type `@ModuleA.int10'
2625 <END_RESULT>
2626 <RESULT IF_PASS COUNT 1>
2627 (?is)\berror:
2628 <END_RESULT>
2629 <RESULT IF_PASS POSITIVE>
2630 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2631 <END_RESULT>
2632 <END_TC>
2633 :exmp.
2634
2635
2636 .*---------------------------------------------------------------------*
2637 :h3.TTCN-3:: IsValue - for a port reference
2638 .*---------------------------------------------------------------------*
2639 :xmp tab=0.
2640 <TC - TTCN-3::IsValue - for a port reference>
2641
2642 <COMPILE>
2643 <VERDICT_LEAF PASS>
2644 <MODULE TTCN ModuleA ModuleA.ttcn>
2645 module ModuleA {
2646
2647 type record length (10) of integer int10;
2648
2649 type port P1 message
2650 {
2651 out integer;
2652 }
2653
2654 type component C1
2655 {
2656 port P1 p1;
2657 }
2658
2659 testcase tc_isvalue_const() runs on C1
2660 {
2661 var C1 c1;
2662
2663 if ( isvalue(p1) ) {
2664 setverdict(pass);
2665 } else {
2666 setverdict(fail);
2667 }
2668 }
2669 }
2670 <END_MODULE>
2671 <RESULT IF_PASS COUNT 1>
2672 (?im)\bReference to a value or template was expected instead of port `@ModuleA.C1.p1'
2673 <END_RESULT>
2674 <RESULT IF_PASS COUNT 1>
2675 (?is)\berror:
2676 <END_RESULT>
2677 <RESULT IF_PASS POSITIVE>
2678 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2679 <END_RESULT>
2680
2681 <END_TC>
2682 :exmp.
2683
2684
2685 .*---------------------------------------------------------------------*
2686 :h3.TTCN-3:: IsValue - for a testcase reference
2687 .*---------------------------------------------------------------------*
2688 :xmp tab=0.
2689 <TC - TTCN-3::IsValue - for a testcase reference>
2690
2691 <COMPILE>
2692 <VERDICT_LEAF PASS>
2693 <MODULE TTCN ModuleA ModuleA.ttcn>
2694 module ModuleA {
2695
2696 type record length (10) of integer int10;
2697
2698 type component C1
2699 {
2700 }
2701
2702 testcase tc_isvalue_const() runs on C1
2703 {
2704 var boolean dontcare1 := isvalue(tc_isvalue_const);
2705 }
2706 }
2707 <END_MODULE>
2708 <RESULT IF_PASS COUNT 1>
2709 (?im)\bReference to parameterized definition `tc_isvalue_const' without actual parameter list
2710 <END_RESULT>
2711 <RESULT IF_PASS COUNT 1>
2712 (?im)\bReference to a value or template was expected instead of testcase `@ModuleA.tc_isvalue_const'
2713 <END_RESULT>
2714 <RESULT IF_PASS COUNT 2>
2715 (?is)\berror:
2716 <END_RESULT>
2717 <RESULT IF_PASS POSITIVE>
2718 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2719 <END_RESULT>
2720
2721 <END_TC>
2722 :exmp.
2723
2724
2725
2726 .*---------------------------------------------------------------------*
2727 :h3.Adhoc:: Function reference - used in expression, no return value
2728 .*---------------------------------------------------------------------*
2729 :xmp tab=0.
2730 <TC - Adhoc::Function reference - used in expression, no return value>
2731 <COMPILE>
2732 <VERDICT_LEAF FAIL>
2733 <MODULE TTCN x x.ttcn>
2734 module x {
2735 // no return value:
2736 type function f_FT();
2737 // a function which happens to be compatible with f_FT
2738 function f_str(){}
2739 control {
2740 var f_FT f := refers(f_str);
2741 var charstring vl_result := f.apply() & "";
2742 }
2743 }
2744 <END_MODULE>
2745 <RESULT IF_FAIL COUNT 1>
2746 (?is)\berror: Reference.+?value.+?expected.+?invocation.+?behavior.+?no return type\b
2747 <END_RESULT>
2748 <RESULT IF_FAIL POSITIVE>
2749 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2750 <END_RESULT>
2751 <END_TC>
2752 :exmp.
2753
2754 .*---------------------------------------------------------------------*
2755 :h3.Adhoc:: Function reference - incompatible function type used for record func.ref. value
2756 .*---------------------------------------------------------------------*
2757 :xmp tab=0.
2758 <TC - Adhoc::Function reference - incompatible function type used for record func.ref. value>
2759 <COMPILE>
2760 <VERDICT_LEAF FAIL>
2761 <MODULE TTCN x x.ttcn>
2762 module x {
2763 type record adat_rekord {
2764 function (integer par1, integer par2) return integer muv_f,
2765 function (in integer par) return verdicttype ell_f
2766 };
2767 function fn1(integer par1, integer par2) return float { return 1.1; }
2768 function fn2(in integer par) return verdicttype { return pass; }
2769 function fff()
2770 {
2771 var adat_rekord ar := { refers(fn1), refers(fn2) }
2772 }
2773 }
2774 <END_MODULE>
2775 <RESULT IF_FAIL COUNT 1>
2776 (?is)\berror:
2777 <END_RESULT>
2778 <RESULT IF_FAIL POSITIVE>
2779 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2780 <END_RESULT>
2781 <END_TC>
2782 :exmp.
2783
2784 .*---------------------------------------------------------------------*
2785 :h3.Adhoc:: Function reference - bogus dereference
2786 .*---------------------------------------------------------------------*
2787 :xmp tab=0.
2788 <TC - Adhoc::Function reference - bogus dereference>
2789 <COMPILE>
2790 <VERDICT_LEAF PASS>
2791 <MODULE TTCN deref_bogus deref_bogus.ttcn>
2792 module deref_bogus {
2793 control {
2794 execute(derefers(Noexi)())
2795 }
2796 }
2797 <END_MODULE>
2798 <RESULT COUNT 1>
2799 (?im)There.+?is.+?no.+?local.+?imported.+?definition.+?name
2800 <END_RESULT>
2801 <RESULT COUNT 1>
2802 (?is)\berror:
2803 <END_RESULT>
2804 <RESULT COUNT 1>
2805 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2806 <END_RESULT>
2807 <END_TC>
2808 :exmp.
2809
2810 .*---------------------------------------------------------------------*
2811 :h3.Adhoc:: Named actual parameters - no such parameter in function
2812 .*---------------------------------------------------------------------*
2813 :xmp tab=0.
2814 <TC - Adhoc::Named actual parameters - no such parameter in function>
2815 <COMPILE>
2816 <VERDICT_LEAF PASS>
2817 <MODULE TTCN nosuchname nosuchname.ttcn>
2818 module nosuchname {
2819 type component C1 { }
2820 function f1(in integer par1, in float par2, in charstring par3,
2821 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
2822 {
2823 }
2824
2825 testcase tc1() runs on C1
2826 {
2827 f1(1, 2.2, "3", pardon := 3);
2828 }
2829 }
2830 <END_MODULE>
2831 <RESULT COUNT 1>
2832 (?im)Function\s+`\S+'\s+has\s+no\s+formal\s+parameter
2833 <END_RESULT>
2834 <RESULT COUNT 1>
2835 (?is)\berror:
2836 <END_RESULT>
2837 <RESULT COUNT 1>
2838 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2839 <END_RESULT>
2840 <END_TC>
2841 :exmp.
2842
2843 .*---------------------------------------------------------------------*
2844 :h3.Adhoc:: Named actual parameters - no such parameter in altstep
2845 .*---------------------------------------------------------------------*
2846 :xmp tab=0.
2847 <TC - Adhoc::Named actual parameters - no such parameter in altstep>
2848 <COMPILE>
2849 <VERDICT_LEAF PASS>
2850 <MODULE TTCN nosuchname_altstep nosuchname_altstep.ttcn>
2851 module nosuchname_altstep {
2852 type component C1 { }
2853 altstep f1(in integer par1, in float par2, in charstring par3,
2854 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
2855 {
2856 [] any timer.timeout { setverdict(pass); }
2857 }
2858
2859 testcase tc1() runs on C1
2860 {
2861 f1(1, 2.2, "3", pardon := 3);
2862 }
2863 }
2864 <END_MODULE>
2865 <RESULT COUNT 1>
2866 (?im)Altstep\s+`\S+'\s+has\s+no\s+formal\s+parameter
2867 <END_RESULT>
2868 <RESULT COUNT 1>
2869 (?is)\berror:
2870 <END_RESULT>
2871 <RESULT COUNT 1>
2872 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2873 <END_RESULT>
2874 <END_TC>
2875 :exmp.
2876
2877 .*---------------------------------------------------------------------*
2878 :h3.Adhoc:: Named actual parameters - no such parameter in testcase
2879 .*---------------------------------------------------------------------*
2880 :xmp tab=0.
2881 <TC - Adhoc::Named actual parameters - no such parameter in testcase>
2882 <COMPILE>
2883 <VERDICT_LEAF PASS>
2884 <MODULE TTCN nosuchname_testcase nosuchname_testcase.ttcn>
2885 module nosuchname_testcase {
2886 type component C1 { }
2887 testcase f1(in integer par1, in float par2, in charstring par3,
2888 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H) runs on C1
2889 {
2890 alt{
2891 [] any timer.timeout { setverdict(pass); }
2892 }
2893 }
2894
2895 control
2896 {
2897 execute(f1(1, 2.2, "3", pardon := 3));
2898 }
2899 }
2900 <END_MODULE>
2901 <RESULT COUNT 1>
2902 (?im)Testcase\s+`\S+'\s+has\s+no\s+?formal\s+?parameter
2903 <END_RESULT>
2904 <RESULT COUNT 1>
2905 (?is)\berror:
2906 <END_RESULT>
2907 <RESULT COUNT 1>
2908 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2909 <END_RESULT>
2910 <END_TC>
2911 :exmp.
2912
2913 .*---------------------------------------------------------------------*
2914 :h3.Adhoc:: Named actual parameters - not enough parameters in function
2915 .*---------------------------------------------------------------------*
2916 :xmp tab=0.
2917 <TC - Adhoc::Named actual parameters - not enough parameters in function>
2918 <COMPILE>
2919 <VERDICT_LEAF PASS>
2920 <MODULE TTCN notenough notenough.ttcn>
2921 module notenough {
2922 type component C1 { }
2923 function f1(in integer par1, in float par2, in charstring par3,
2924 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
2925 {
2926 }
2927
2928 testcase tc1() runs on C1
2929 {
2930 f1();
2931 }
2932 }
2933 <END_MODULE>
2934 <RESULT COUNT 1>
2935 (?im)Too.+?few.+?parameters:.+?least.+?expected.+?instead
2936 <END_RESULT>
2937 <RESULT COUNT 1>
2938 (?is)\berror:
2939 <END_RESULT>
2940 <RESULT COUNT 1>
2941 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2942 <END_RESULT>
2943 <END_TC>
2944 :exmp.
2945
2946 .*---------------------------------------------------------------------*
2947 :h3.Adhoc:: Named actual parameters - not enough parameters in altstep
2948 .*---------------------------------------------------------------------*
2949 :xmp tab=0.
2950 <TC - Adhoc::Named actual parameters - not enough parameters in altstep>
2951 <COMPILE>
2952 <VERDICT_LEAF PASS>
2953 <MODULE TTCN notenough_altstep notenough_altstep.ttcn>
2954 module notenough_altstep {
2955 type component C1 { }
2956 altstep f1(in integer par1, in float par2, in charstring par3,
2957 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
2958 {
2959 [] any timer.timeout { setverdict(pass); }
2960 }
2961
2962 testcase tc1() runs on C1
2963 {
2964 f1();
2965 }
2966 }
2967 <END_MODULE>
2968 <RESULT COUNT 1>
2969 (?im)Too.+?few.+?parameters:.+?least.+?expected.+?instead
2970 <END_RESULT>
2971 <RESULT COUNT 1>
2972 (?is)\berror:
2973 <END_RESULT>
2974 <RESULT COUNT 1>
2975 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
2976 <END_RESULT>
2977 <END_TC>
2978 :exmp.
2979
2980 .*---------------------------------------------------------------------*
2981 :h3.Adhoc:: Named actual parameters - parameter overriding in function
2982 .*---------------------------------------------------------------------*
2983 :xmp tab=0.
2984 <TC - Adhoc::Named actual parameters - parameter overriding in function>
2985 <COMPILE>
2986 <VERDICT_LEAF PASS>
2987 <MODULE TTCN override_override override_override.ttcn>
2988 module override_override {
2989 type component C1 { }
2990 function f1(in integer par1, in float par2, in charstring par3,
2991 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
2992 {
2993 }
2994
2995 testcase tc1() runs on C1
2996 {
2997 f1(1, 2.2, "3", par1 := 42, par4 := true);
2998 }
2999 }
3000 <END_MODULE>
3001 <RESULT COUNT 1>
3002 (?im)Formal parameter `\S+' assigned more than once
3003 <END_RESULT>
3004 <RESULT COUNT 1>
3005 (?is)\berror:
3006 <END_RESULT>
3007 <RESULT COUNT 1>
3008 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3009 <END_RESULT>
3010 <END_TC>
3011 :exmp.
3012
3013 .*---------------------------------------------------------------------*
3014 :h3.Adhoc:: Named actual parameters - parameter overriding in altstep
3015 .*---------------------------------------------------------------------*
3016 :xmp tab=0.
3017 <TC - Adhoc::Named actual parameters - parameter overriding in altstep>
3018 <COMPILE>
3019 <VERDICT_LEAF PASS>
3020 <MODULE TTCN override_altstep override_altstep.ttcn>
3021 module override_altstep {
3022 type component C1 { }
3023 altstep f1(in integer par1, in float par2, in charstring par3,
3024 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3025 {
3026 [] any timer.timeout { setverdict(pass); }
3027 }
3028
3029 testcase tc1() runs on C1
3030 {
3031 f1(1, 2.2, "3", par1 := 42, par4 := true);
3032 }
3033 }
3034 <END_MODULE>
3035 <RESULT COUNT 1>
3036 (?im)Formal parameter `\S+' assigned more than once
3037 <END_RESULT>
3038 <RESULT COUNT 1>
3039 (?is)\berror:
3040 <END_RESULT>
3041 <RESULT COUNT 1>
3042 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3043 <END_RESULT>
3044 <END_TC>
3045 :exmp.
3046
3047 .*---------------------------------------------------------------------*
3048 :h3.Adhoc:: Named actual parameters - too many parameters in function
3049 .*---------------------------------------------------------------------*
3050 :xmp tab=0.
3051 <TC - Adhoc::Named actual parameters - too many parameters in function>
3052 <COMPILE>
3053 <VERDICT_LEAF PASS>
3054 <MODULE TTCN toomany toomany.ttcn>
3055 module toomany {
3056 type component C1 { }
3057 function f1(in integer par1, in float par2, in charstring par3,
3058 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3059 {
3060 }
3061
3062 testcase tc1() runs on C1
3063 {
3064 f1(13, 0.99, "foo", true, 'BAADF00D'H, -);
3065 }
3066 }
3067 <END_MODULE>
3068 <RESULT COUNT 1>
3069 (?im)Too.+?many.+?parameters.+?most.+?was.+?expected.+?instead
3070 <END_RESULT>
3071 <RESULT COUNT 1>
3072 (?is)\berror:
3073 <END_RESULT>
3074 <RESULT COUNT 1>
3075 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3076 <END_RESULT>
3077 <END_TC>
3078 :exmp.
3079
3080 .*---------------------------------------------------------------------*
3081 :h3.Adhoc:: Named actual parameters - too many parameters in altstep
3082 .*---------------------------------------------------------------------*
3083 :xmp tab=0.
3084 <TC - Adhoc::Named actual parameters - too many parameters in altstep>
3085 <COMPILE>
3086 <VERDICT_LEAF PASS>
3087 <MODULE TTCN toomany_altstep toomany_altstep.ttcn>
3088 module toomany_altstep {
3089 type component C1 { }
3090 altstep f1(in integer par1, in float par2, in charstring par3,
3091 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3092 {
3093 [] any timer.timeout { setverdict(pass); }
3094 }
3095
3096 testcase tc1() runs on C1
3097 {
3098 f1(13, 0.99, "foo", true, 'BAADF00D'H, -);
3099 }
3100 }
3101 <END_MODULE>
3102 <RESULT COUNT 1>
3103 (?im)Too.+?many.+?parameters.+?most.+?was.+?expected.+?instead
3104 <END_RESULT>
3105 <RESULT COUNT 1>
3106 (?is)\berror:
3107 <END_RESULT>
3108 <RESULT COUNT 1>
3109 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3110 <END_RESULT>
3111 <END_TC>
3112 :exmp.
3113
3114 .*---------------------------------------------------------------------*
3115 :h3.Adhoc:: Named actual parameters - same parameter more than once in function
3116 .*---------------------------------------------------------------------*
3117 :xmp tab=0.
3118 <TC - Adhoc::Named actual parameters - same parameter more than once in function>
3119 <COMPILE>
3120 <VERDICT_LEAF PASS>
3121 <MODULE TTCN twicetobesure twicetobesure.ttcn>
3122 module twicetobesure {
3123 type component C1 { }
3124 function f1(in integer par1, in float par2, in charstring par3,
3125 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3126 {
3127 }
3128
3129 testcase tc1() runs on C1
3130 {
3131 f1(1, 1.1, "!!!!11one!!", par4 := true, par4 := true);
3132 }
3133 }
3134 <END_MODULE>
3135 <RESULT COUNT 1>
3136 (?im)Formal.+?parameter.+?assigned.+?more.+?than.+?once
3137 <END_RESULT>
3138 <RESULT COUNT 1>
3139 (?is)\berror:
3140 <END_RESULT>
3141 <RESULT COUNT 1>
3142 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3143 <END_RESULT>
3144 <END_TC>
3145 :exmp.
3146
3147 .*---------------------------------------------------------------------*
3148 :h3.Adhoc:: Named actual parameters - same parameter more than once in altstep
3149 .*---------------------------------------------------------------------*
3150 :xmp tab=0.
3151 <TC - Adhoc::Named actual parameters - same parameter more than once in altstep>
3152 <COMPILE>
3153 <VERDICT_LEAF PASS>
3154 <MODULE TTCN twicetobesure_altstep twicetobesure_altstep.ttcn>
3155 module twicetobesure_altstep {
3156 type component C1 { }
3157 altstep f1(in integer par1, in float par2, in charstring par3,
3158 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3159 {
3160 [] any timer.timeout { setverdict(pass); }
3161 }
3162
3163 testcase tc1() runs on C1
3164 {
3165 f1(1, 1.1, "!!!!11one!!", par4 := true, par4 := true);
3166 }
3167 }
3168 <END_MODULE>
3169 <RESULT COUNT 1>
3170 (?im)Formal.+?parameter.+assigned.+?more.+?than.+?once
3171 <END_RESULT>
3172 <RESULT COUNT 1>
3173 (?is)\berror:
3174 <END_RESULT>
3175 <RESULT COUNT 1>
3176 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3177 <END_RESULT>
3178 <END_TC>
3179 :exmp.
3180
3181 .*---------------------------------------------------------------------*
3182 :h3.Adhoc:: Named actual parameters - wrong type for parameters in function
3183 .*---------------------------------------------------------------------*
3184 :xmp tab=0.
3185 <TC - Adhoc::Named actual parameters - wrong type for parameters in function>
3186 <COMPILE>
3187 <VERDICT_LEAF PASS>
3188 <MODULE TTCN wrongtype wrongtype.ttcn>
3189 module wrongtype {
3190 type component C1 { }
3191 function f1(in integer par1, in float par2, in charstring par3,
3192 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3193 {
3194 }
3195
3196 testcase tc1() runs on C1
3197 {
3198 f1(1, 2.2, par3 := true, par4 := "true");
3199 }
3200 }
3201 <END_MODULE>
3202 <RESULT COUNT 1>
3203 (?im)boolean.+?value.+?expected
3204 <END_RESULT>
3205 <RESULT COUNT 1>
3206 (?im)character.+?string.+?value.+?was.+?expected
3207 <END_RESULT>
3208 <RESULT COUNT 2>
3209 (?is)\berror:
3210 <END_RESULT>
3211 <RESULT COUNT 1>
3212 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3213 <END_RESULT>
3214 <END_TC>
3215 :exmp.
3216
3217 .*---------------------------------------------------------------------*
3218 :h3.Adhoc:: Named actual parameters - TR922
3219 .*---------------------------------------------------------------------*
3220 :xmp tab=0.
3221 <TC - Adhoc::Named actual parameters - TR922>
3222 <COMPILE>
3223 <VERDICT_LEAF PASS>
3224 <MODULE TTCN TR922 TR922.ttcn>
3225 module TR922 {
3226 type component CT{}
3227
3228 // a do-nothing function
3229 function twoparfn(in integer foo, in integer bar){}
3230
3231 // a function reference
3232 type function twopar(in integer foo, in integer bar);
3233 // an altstep reference
3234 type altstep twoalt(in integer foo, in integer bar);
3235 // a testcase reference
3236 type testcase twotc(in integer foo, in integer bar) runs on CT;
3237
3238 type record of integer integers;
3239
3240 function f0()
3241 {
3242 twoparfn( 42, );
3243
3244 // this is the part the compiler accidentally stumbles upon
3245 // and considers a named parameter
3246 var integers not_a_named_param := {};
3247 some_random_function(some, random, parameter, list);
3248 }
3249
3250 function f1()
3251 {
3252 var twopar fn := null;
3253 fn.apply( 42, );
3254
3255 // this is the part the compiler accidentally stumbles upon
3256 // and considers a named parameter
3257 var integers not_a_named_param := {};
3258 some_random_function(some, random, parameter, list);
3259 }
3260
3261 function f2()
3262 {
3263
3264 var twoalt alt2;
3265 alt2.apply(42,);
3266
3267 // this is the part the compiler accidentally stumbles upon
3268 // and considers a named parameter
3269 var integers not_a_named_param := {};
3270 some_random_function(some, random, parameter, list);
3271
3272 }
3273
3274 function f3()
3275 {
3276 var twotc tc2 := null;
3277 execute(derefers(tc2)(42,)));
3278
3279 // this is the part the compiler accidentally stumbles upon
3280 // and considers a named parameter
3281 var integers not_a_named_param := {};
3282 some_random_function(some, random, parameter, list);
3283 }
3284
3285 control
3286 {
3287 f0();
3288 f1();
3289 f2();
3290 f3();
3291 }
3292
3293 }
3294 <END_MODULE>
3295 <RESULT COUNT 4>
3296 syntax error, unexpected '\)'
3297 <END_RESULT>
3298 <RESULT COUNT 4>
3299 syntax error, unexpected ';', expecting '\)' or ','
3300 <END_RESULT>
3301 <RESULT COUNT 8>
3302 (?is)\berror:
3303 <END_RESULT>
3304 <RESULT COUNT 1>
3305 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3306 <END_RESULT>
3307 <END_TC>
3308 :exmp.
3309
3310 .*---------------------------------------------------------------------*
3311 :h3.Adhoc:: Named actual parameters - wrong type for the parameters in altstep
3312 .*---------------------------------------------------------------------*
3313 :xmp tab=0.
3314 <TC - Adhoc::Named actual parameters - wrong type for the parameters in altstep>
3315 <COMPILE>
3316 <VERDICT_LEAF PASS>
3317 <MODULE TTCN wrongtype_altstep wrongtype_altstep.ttcn>
3318 module wrongtype_altstep {
3319 type component C1 { }
3320 altstep f1(in integer par1, in float par2, in charstring par3,
3321 in boolean par4 := false, in hexstring par5 := 'DECAFBAD'H)
3322 {
3323 [] any timer.timeout { setverdict(pass); }
3324 }
3325
3326 testcase tc1() runs on C1
3327 {
3328 f1(1, 2.2, par3 := true, par4 := "true");
3329 }
3330 }
3331 <END_MODULE>
3332 <RESULT COUNT 1>
3333 (?im)boolean.+?value.+?expected
3334 <END_RESULT>
3335 <RESULT COUNT 1>
3336 (?im)character.+?string.+?value.+?was.+?expected
3337 <END_RESULT>
3338 <RESULT COUNT 2>
3339 (?is)\berror:
3340 <END_RESULT>
3341 <RESULT COUNT 1>
3342 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3343 <END_RESULT>
3344 <END_TC>
3345 :exmp.
3346
3347 .*---------------------------------------------------------------------*
3348 :h3.Adhoc:: Assignment notation with array indices - unsuitable type indices
3349 .*---------------------------------------------------------------------*
3350 :xmp tab=0.
3351 <TC - Adhoc::Assignment notation with array indices - unsuitable type indices>
3352 <COMPILE>
3353 <VERDICT_LEAF PASS>
3354 <MODULE TTCN unsuitable_indices unsuitable_indices.ttcn>
3355 module unsuitable_indices
3356 {
3357 type component empty { }
3358 type record of integer intlist
3359 type set of integer intsetof
3360 type integer intarr[1]
3361 type record intrec { integer f1, integer f2 }
3362 type set intset { integer f1, integer f2 }
3363 testcase tc () runs on empty
3364 {
3365 var float float_val := 1.0
3366 var float neg_float_val := -1.0
3367 var integer neg_int_val := -1
3368 template intlist a := { 1, 2, 3 }
3369 template intlist a_m1 modifies a := { [1.0] := 0 }
3370 template intlist a_m2 modifies a := { [float_val] := 0 }
3371 template intlist a_m3 modifies a := { [neg_float_val] := 0 }
3372 template intlist a_m4 modifies a := { [-1] := 0 }
3373 template intlist a_m5 modifies a := { [neg_int_val] := 0 }
3374 template intlist a_m6 modifies a := { [-1.0] := 0 }
3375 var intlist ilist := { 1, 2, 3 }
3376 ilist := { [1.0] := 0 }
3377 ilist := { [float_val] := 0 }
3378 ilist := { [neg_float_val] := 0 }
3379 ilist := { [-1] := 0 }
3380 ilist := { [neg_int_val] := 0 }
3381 ilist := { [-1.0] := 0 }
3382 var intsetof iset := { 1, 2, 3 }
3383 iset := { [1.0] := 0 }
3384 iset := { [float_val] := 0 }
3385 iset := { [neg_float_val] := 0 }
3386 iset := { [-1] := 0 }
3387 iset := { [neg_int_val] := 0 }
3388 iset := { [-1.0] := 0 }
3389 var intarr iarr := { 1 }
3390 iarr := { [1.0] := 0 }
3391 iarr := { [float_val] := 0 }
3392 iarr := { [neg_float_val] := 0 }
3393 iarr := { [-1] := 0 }
3394 iarr := { [neg_int_val] := 0 }
3395 iarr := { [-1.0] := 0 }
3396 var intrec ir := { [0] := 0, [1] := 1 }
3397 var intset is := { [0] := 0, [1] := 1 }
3398 }
3399 }
3400 <END_MODULE>
3401 <RESULT COUNT 16>
3402 (?is)\berror:.+?A.+?value.+?or.+?expression.+?type.+?integer.+?was.+?expected
3403 <END_RESULT>
3404 <RESULT COUNT 3>
3405 (?is)\berror:.+?A.+?non-negative.+?integer.+?expected.+?indexing.+?instead.+?of
3406 <END_RESULT>
3407 <RESULT COUNT 1>
3408 (?is)\berror:.+?Indexed assignment notation cannot be used for record type
3409 <END_RESULT>
3410 <RESULT COUNT 1>
3411 (?is)\berror:.+?Value list notation cannot be used for set type
3412 <END_RESULT>
3413 <RESULT COUNT 1>
3414 (?is)\berror:.+?Array index underflow: the index value must be at least `0' instead of `-1'
3415 <END_RESULT>
3416 <RESULT COUNT 22>
3417 (?is)\berror:
3418 <END_RESULT>
3419 <RESULT COUNT 1>
3420 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
3421 <END_RESULT>
3422 <END_TC>
3423 :exmp.
3424
3425 .*---------------------------------------------------------------------*
3426 :h3.Adhoc:: Arrays with indexed assignment notation - Variables
3427 .*---------------------------------------------------------------------*
3428 :xmp tab=0.
3429 <TC - Adhoc::Arrays with indexed assignment notation - Variables>
3430 <COMPILE>
3431 <VERDICT_LEAF PASS>
3432 <MODULE TTCN IndexedArrayVariables IndexedArrayVariables.ttcn>
3433 module IndexedArrayVariables {
3434 type component Empty { }
3435 type integer intarr1[1]
3436 type integer intarr2[1..2]
3437 testcase tc() runs on Empty
3438 {
3439 // With one dynamic index.
3440 var integer i := 1
3441 var intarr1 a1 := { [1] := 0 } // Overflow.
3442 var intarr1 a2 := { [2] := 0 } // Overflow.
3443 var intarr1 a3 := { [0] := 0, [1] := 1 } // Overflow and too many elements.
3444 var intarr1 a4 := { [0] := 0, [0] := 0 } // Same index.
3445 var intarr1 a5 := { [0] := 0, [i] := 0, [0] := 0 } // Same index.
3446 var intarr2 a6 := { [0] := 0 } // Underflow.
3447 var intarr2 a7 := { [6] := 6 } // Overflow.
3448 var intarr2 a8 := { [0] := 0, [1] := 1, [2] := 2 } // Underflow and too many elements.
3449 var intarr2 a9 := { [1] := 1, [2] := 2, [3] := 4 } // Overflow and too many elements.
3450 var intarr2 a10 := { [1] := 1, [1] := 1 } // Same index.
3451 }
3452 }
3453 <END_MODULE>
3454 <RESULT COUNT 2>
3455 (?is)\berror: Array index overflow: the index value must be at most `0' instead of `1'
3456 <END_RESULT>
3457 <RESULT COUNT 1>
3458 (?is)\berror: Array index overflow: the index value must be at most `0' instead of `2'
3459 <END_RESULT>
3460 <RESULT COUNT 1>
3461 (?is)\berror: Duplicate index value `0' for components `2' and `1'
3462 <END_RESULT>
3463 <RESULT COUNT 1>
3464 (?is)\berror: Duplicate index value `0' for components `3' and `1'
3465 <END_RESULT>
3466 <RESULT COUNT 2>
3467 (?is)\berror: Array index underflow: the index value must be at least `1' instead of `0'
3468 <END_RESULT>
3469 <RESULT COUNT 1>
3470 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `6'
3471 <END_RESULT>
3472 <RESULT COUNT 1>
3473 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `3'
3474 <END_RESULT>
3475 <RESULT COUNT 1>
3476 (?is)\berror: Duplicate index value `1' for components `2' and `1'
3477 <END_RESULT>
3478 <RESULT COUNT 10>
3479 (?is)\berror:
3480 <END_RESULT>
3481 <RESULT COUNT 1>
3482 (?im)\bnotify: Errors found in the input module. Code will not be generated.
3483 <END_RESULT>
3484 <END_TC>
3485 :exmp.
3486
3487 .*---------------------------------------------------------------------*
3488 :h3.Adhoc:: Arrays with indexed assignment notation - Constants
3489 .*---------------------------------------------------------------------*
3490 :xmp tab=0.
3491 <TC - Adhoc::Arrays with indexed assignment notation - Constants>
3492 <COMPILE>
3493 <VERDICT_LEAF PASS>
3494 <MODULE TTCN IndexedArrayConstants IndexedArrayConstants.ttcn>
3495 module IndexedArrayConstants {
3496 type component Empty { }
3497 type integer intarr1[2]
3498 type integer intarr2[2..4]
3499 testcase tc() runs on Empty
3500 {
3501 const intarr1 a1 := { [3] := 0 } // Overflow.
3502 const intarr1 a2 := { [0] := 0 } // Holes are not allowed.
3503 const intarr1 a3 := { [0] := 0, [1] := 1, [2] := 2 } // Overflow and too many elements.
3504 const intarr1 a4 := { [0] := 0, [0] := 0 } // Same index.
3505 const intarr2 a5 := { [0] := 0 } // Underflow.
3506 const intarr2 a6 := { [6] := 6 } // Overflow.
3507 const intarr2 a7 := { [0] := 0, [1] := 1, [2] := 2 } // Underflow.
3508 }
3509 }
3510 <END_MODULE>
3511 <RESULT COUNT 1>
3512 (?is)\berror: Array index overflow: the index value must be at most `1' instead of `3'
3513 <END_RESULT>
3514 <RESULT COUNT 1>
3515 (?is)\berror: It's not allowed to create hole\(s\) in constant values
3516 <END_RESULT>
3517 <RESULT COUNT 1>
3518 (?is)\berror: Array index overflow: the index value must be at most `1' instead of `2'
3519 <END_RESULT>
3520 <RESULT COUNT 1>
3521 (?is)\berror: Duplicate index value `0' for components `2' and `1'
3522 <END_RESULT>
3523 <RESULT COUNT 2>
3524 (?is)\berror: Array index underflow: the index value must be at least `2' instead of `0'
3525 <END_RESULT>
3526 <RESULT COUNT 1>
3527 (?is)\berror: Array index overflow: the index value must be at most `4' instead of `6'
3528 <END_RESULT>
3529 <RESULT COUNT 1>
3530 (?is)\berror: Array index underflow: the index value must be at least `2' instead of `1'
3531 <END_RESULT>
3532 <RESULT COUNT 8>
3533 (?is)\berror:
3534 <END_RESULT>
3535 <RESULT COUNT 1>
3536 (?im)\bnotify: Errors found in the input module. Code will not be generated.
3537 <END_RESULT>
3538 <END_TC>
3539 :exmp.
3540
3541 .*---------------------------------------------------------------------*
3542 :h3.Adhoc:: Arrays with indexed assignment notation - Templates
3543 .*---------------------------------------------------------------------*
3544 :xmp tab=0.
3545 <TC - Adhoc::Arrays with indexed assignment notation - Templates>
3546 <COMPILE>
3547 <VERDICT_LEAF PASS>
3548 <MODULE TTCN IndexedArrayTemplates IndexedArrayTemplates.ttcn>
3549 module IndexedArrayTemplates {
3550 type component Empty { }
3551 type integer intarr1[1]
3552 type integer intarr2[1..2]
3553 testcase tc() runs on Empty
3554 {
3555 template intarr1 a1 := { 1 }
3556 template intarr1 a2 modifies a1 := { [1] := 0 } // Overflow.
3557 template intarr1 a3 modifies a1 := { [0] := 0, [1] := 1 } // Overflow and too many elements.
3558 template intarr1 a4 modifies a1 := { [0] := 0, [1] := 1 } // Overflow and too many elements.
3559 template intarr1 a5 modifies a1 := { [0] := 0, [0] := 0 } // Same index.
3560 template intarr2 a6 := { [0] := 0 } // Underflow.
3561 template intarr2 a7 := { [6] := 6 } // Overflow.
3562 template intarr2 a8 := { [0] := 0, [1] := 1, [2] := 2 } // Underflow and too many elements.
3563 template intarr2 a9 := { [1] := 1, [2] := 2, [3] := 4 } // Overflow and too many elements.
3564 }
3565 }
3566 <END_MODULE>
3567 <RESULT COUNT 3>
3568 (?is)\berror: Array index overflow: the index value must be at most `0' instead of `1'
3569 <END_RESULT>
3570 <RESULT COUNT 1>
3571 (?is)\berror: Duplicate index value `0' for components `2' and `1'
3572 <END_RESULT>
3573 <RESULT COUNT 2>
3574 (?is)\berror: Array index underflow: the index value must be at least `1' instead of `0'
3575 <END_RESULT>
3576 <RESULT COUNT 1>
3577 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `6'
3578 <END_RESULT>
3579 <RESULT COUNT 1>
3580 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `3'
3581 <END_RESULT>
3582 <RESULT COUNT 8>
3583 (?is)\berror:
3584 <END_RESULT>
3585 <RESULT COUNT 1>
3586 (?im)\bnotify: Errors found in the input module. Code will not be generated.
3587 <END_RESULT>
3588 <END_TC>
3589 :exmp.
3590
3591 .*---------------------------------------------------------------------*
3592 :h3.Adhoc:: Arrays with indexed assignment notation - Timers
3593 .*---------------------------------------------------------------------*
3594 :xmp tab=0.
3595 <TC - Adhoc::Arrays with indexed assignment notation - Timers>
3596 <COMPILE>
3597 <VERDICT_LEAF PASS>
3598 <MODULE TTCN IndexedArrayTimers IndexedArrayTimers.ttcn>
3599 module IndexedArrayTimers {
3600 type component Empty { }
3601 testcase tc() runs on Empty
3602 {
3603 timer a1[1] := { [0] := 0.0, [1] := 1.0 } // Overflow.
3604 timer a2[1] := { [0] := 0.0, [0] := 0.0 } // Same index.
3605 timer a3[1..2] := { [0] := 0.0 } // Underflow.
3606 timer a4[1..2] := { [3] := 3.0 } // Overflow.
3607 timer a5[1..2] := { [0] := 0.0, [1] := 1.0, [2] := 2.0 } // Underflow and too many elements.
3608 timer a6[1..2] := { [2] := 2.0, [3] := 3.0, [4] := 4.0 } // Overflow and too many elements.
3609 }
3610 }
3611 <END_MODULE>
3612 <RESULT COUNT 1>
3613 (?is)\berror: Array index overflow: the index value must be at most `0' instead of `1'
3614 <END_RESULT>
3615 <RESULT COUNT 1>
3616 (?is)\berror: Duplicate index value `0' for timer array elements `2' and `1'
3617 <END_RESULT>
3618 <RESULT COUNT 2>
3619 (?is)\berror: Array index underflow: the index value must be at least `1' instead of `0'
3620 <END_RESULT>
3621 <RESULT COUNT 2>
3622 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `3'
3623 <END_RESULT>
3624 <RESULT COUNT 1>
3625 (?is)\berror: Array index overflow: the index value must be at most `2' instead of `4'
3626 <END_RESULT>
3627 <RESULT COUNT 7>
3628 (?is)\berror:
3629 <END_RESULT>
3630 <RESULT COUNT 1>
3631 (?im)\bnotify: Errors found in the input module. Code will not be generated.
3632 <END_RESULT>
3633 <END_TC>
3634 :exmp.
3635
3636 .*---------------------------------------------------------------------*
3637 :h3.Adhoc:: replace() predefined function - bad arguments
3638 .*---------------------------------------------------------------------*
3639 :xmp tab=0.
3640 <TC - Adhoc::replace() predefined function - bad arguments>
3641 <COMPILE>
3642 <VERDICT_LEAF PASS>
3643 <MODULE TTCN bad_arguments bad_arguments.ttcn>
3644 module bad_arguments
3645 {
3646 type component empty { }
3647 type record of integer intlist
3648 testcase tc () runs on empty
3649 {
3650 var integer a := 0
3651 var charstring cs_1 := "My name is JJ"
3652 var bitstring bs_1 := '11'B
3653 var charstring cs_2 := replace("My name is JJ", -1, 2, "xx")
3654 var intlist il1 := { 1, 2, 3 }
3655 cs_2 := replace("My name is JJ", 1, 2, '11'B)
3656 cs_2 := replace("My name is JJ", 100, 2, "x")
3657 cs_2 := replace("My name is JJ", a, 100, "x")
3658 cs_2 := replace(cs_1, 1, 2, bs_1)
3659 cs_2 := replace(cs_1, 1.0, 2, "xx")
3660 il1 := replace(il1, 1, 1, cs_1[10])
3661 }
3662 }
3663 <END_MODULE>
3664 <RESULT COUNT 1>
3665 (?is)\berror:.+?Second operand of operation `replace\(\)' should not be negative
3666 <END_RESULT>
3667 <RESULT COUNT 2>
3668 (?is)\berror:.+?Fourth operand of operation `replace\(\)' is of type `bitstring', but a value of type `charstring' was expected here
3669 <END_RESULT>
3670 <RESULT COUNT 1>
3671 (?is)\berror:.+?Fourth operand of operation `replace\(\)' is of type `charstring', but a value of type `\@bad_arguments.intlist' was expected here
3672 <END_RESULT>
3673 <RESULT COUNT 1>
3674 (?is)\berror:.+?The sum of second operand `index' \(100\) and third operand `len' \(2\) is greater than the length of the first operand \(13\)
3675 <END_RESULT>
3676 <RESULT COUNT 1>
3677 (?is)\berror:.+?Third operand `len' \(100\) is greater than the length of the first operand \(13\)
3678 <END_RESULT>
3679 <RESULT COUNT 1>
3680 (?is)\berror:.+?Second operand of operation `replace\(\)' should be integer value
3681 <END_RESULT>
3682 <END_TC>
3683 :exmp.
3684
3685 .*---------------------------------------------------------------------*
3686 :h3.Adhoc:: runs on self + refers in component type definition
3687 .*---------------------------------------------------------------------*
3688 :xmp tab=0.
3689 <TC - runs on self + refers in component type definition>
3690 <COMPILE>
3691 <VERDICT_LEAF PASS>
3692 <MODULE TTCN MTTSM00016005 MTTSM00016005.ttcn>
3693 module MTTSM00016005
3694 {
3695 type function FT_f_runsOnSelf() runs on self;
3696 type component C { const integer ci:=1; }
3697 type component D extends My_RunsOnSelf_CT { const integer di:=9; }
3698 type component E {const integer ei:=0; }
3699 type component My_RunsOnSelf_CT extends C {
3700 var FT_f_runsOnSelf v_f_runsOnSelf := refers(f_runsOnSomething);
3701 var FT_f_runsOnSelf v_f_runsOnSelf2 := refers(f_runsOnC);
3702 var FT_f_runsOnSelf v_f_runsOnSelf3 := refers(f_runsOnD);
3703 var FT_f_runsOnSelf v_f_runsOnSelf4 := refers(f_runsOnE);
3704 }
3705
3706 function f_runsOnSomething() runs on My_RunsOnSelf_CT { }
3707 function f_runsOnC() runs on C { }
3708 function f_runsOnD() runs on D { }
3709 function f_runsOnE() runs on E { }
3710 control { }
3711 }
3712 <END_MODULE>
3713 <RESULT COUNT 1>
3714 (?is)\berror: Runs on clause mismatch: type `.+FT_f_runsOnSelf' has a 'runs on self' clause and the current component definition is of type `.+My_RunsOnSelf_CT', but function `.+f_runsOnD' runs on `.+D'
3715 <END_RESULT>
3716 <RESULT COUNT 1>
3717 (?is)\berror: Runs on clause mismatch: type `.+FT_f_runsOnSelf' has a 'runs on self' clause and the current component definition is of type `.+My_RunsOnSelf_CT', but function `.+f_runsOnE' runs on `.+E'
3718 <END_RESULT>
3719 <END_TC>
3720 :exmp.
3721
3722 .*---------------------------------------------------------------------*
3723 :h3.Adhoc:: large integers - array definitions
3724 .*---------------------------------------------------------------------*
3725 :xmp tab=0.
3726 <TC - large integers - arrays and large integers>
3727 <COMPILE>
3728 <VERDICT_LEAF PASS>
3729 <MODULE TTCN LargeIntArr LargeIntArr.ttcn>
3730 module LargeIntArr
3731 {
3732 type integer intarr1[2222222222222222222222222222222]
3733 type integer intarr2[1111111111111111111111111111111..2222222222222222222222222222222]
3734 type integer intarr3[1111111111111111111111111111111..1]
3735 type integer intarr4[2..2222222222222222222222222222222]
3736 control {
3737 }
3738 }
3739 <END_MODULE>
3740 <RESULT COUNT 1>
3741 (?is)\berror: The array size should be less than `2147483647' instead of `2222222222222222222222222222222'
3742 <END_RESULT>
3743 <RESULT COUNT 2>
3744 (?is)\berror: The lower bound of an array index should be less than `2147483647' instead of `1111111111111111111111111111111'
3745 <END_RESULT>
3746 <RESULT COUNT 2>
3747 (?is)\berror: The upper bound of an array index should be less than `2147483647' instead of `2222222222222222222222222222222'
3748 <END_RESULT>
3749 <END_TC>
3750 :exmp.
3751
3752 .*---------------------------------------------------------------------*
3753 :h3.Adhoc:: large integers - array indexing
3754 .*---------------------------------------------------------------------*
3755 :xmp tab=0.
3756 <TC - large integers - array indexing>
3757 <COMPILE>
3758 <VERDICT_LEAF PASS>
3759 <MODULE TTCN LargeIntIndexing LargeIntIndexing.ttcn>
3760 module LargeIntIndexing
3761 {
3762 type integer intarr4[4]
3763 control {
3764 const integer ci1 := 11111111111111111111111111111111111111
3765 var intarr4 iarr1 := {1, 2, 3, 4}
3766 var intarr4 iarr2 := {1, 2, 3, -444444444444444444444444444}
3767 iarr2[ci1] := 1
3768 iarr2[12345678910111213141516] := 1
3769 }
3770 }
3771 <END_MODULE>
3772 <RESULT COUNT 1>
3773 (?is)\berror: Array index overflow: the index value must be at most `3' instead of `11111111111111111111111111111111111111'
3774 <END_RESULT>
3775 <RESULT COUNT 1>
3776 (?is)\berror: Array index overflow: the index value must be at most `3' instead of `12345678910111213141516'
3777 <END_RESULT>
3778 <END_TC>
3779 :exmp.
3780
3781 .*---------------------------------------------------------------------*
3782 :h3.Adhoc:: large integers - universal charstring elements
3783 .*---------------------------------------------------------------------*
3784 :xmp tab=0.
3785 <TC - large integers - universal charstring elements>
3786 <COMPILE>
3787 <VERDICT_LEAF PASS>
3788 <MODULE TTCN LargeIntUni LargeIntUni.ttcn>
3789 module LargeIntUni
3790 {
3791 control {
3792 var universal charstring vus1 := char(11111111111111111111111111111111, 0, 0, 0) & char(1, 1, 1, 1)
3793 var universal charstring vus2 := char(-11111111111111111111111111111111, 0, 0, 0) & char(1, 1, 1, 1)
3794 var universal charstring vus3 := char(11111111111111111111111111111111, 12345678910111213141516171819202, 0, 0) & char(1, 1, 1, -1) & char(11111111111111111111111111111111, 22222222222222222222222222222222, 33333333333333333333333333333333, 44444444444444444444444444444444)
3795 }
3796 }
3797 <END_MODULE>
3798 <RESULT COUNT 4>
3799 (?is)\berror: The first number of quadruple \(group\) must be within the range 0 .. 127 instead of 11111111111111111111111111111111
3800 <END_RESULT>
3801 <RESULT COUNT 2>
3802 (?is)\berror: at or before token `-': syntax error, unexpected '-', expecting Number
3803 <END_RESULT>
3804 <RESULT COUNT 1>
3805 (?is)\berror: The second number of quadruple \(plane\) must be within the range 0 .. 255 instead of 12345678910111213141516171819202
3806 <END_RESULT>
3807 <RESULT COUNT 1>
3808 (?is)\berror: The second number of quadruple \(plane\) must be within the range 0 .. 255 instead of 22222222222222222222222222222222
3809 <END_RESULT>
3810 <RESULT COUNT 1>
3811 (?is)\berror: The third number of quadruple \(row\) must be within the range 0 .. 255 instead of 33333333333333333333333333333333
3812 <END_RESULT>
3813 <RESULT COUNT 1>
3814 (?is)\berror: The fourth number of quadruple \(cell\) must be within the range 0 .. 255 instead of 44444444444444444444444444444444
3815 <END_RESULT>
3816 <END_TC>
3817 :exmp.
3818
3819 .*---------------------------------------------------------------------*
3820 :h3.Adhoc:: large integers - timer arrays
3821 .*---------------------------------------------------------------------*
3822 :xmp tab=0.
3823 <TC - large integers - timer arrays>
3824 <COMPILE>
3825 <VERDICT_LEAF PASS>
3826 <MODULE TTCN LargeIntTimer LargeIntTimer.ttcn>
3827 module LargeIntTimer
3828 {
3829 control {
3830 const integer ci1 := 11111111111111111111111111111111111111
3831 var integer vi1 := ci1
3832 timer tarr1[1] := {[11111111111111111111111111111111111111] := 1}
3833 timer tarr2[vi1] := {[22222222222222222222222222222222222222] := 1, [vi1] := vi1, [vi1 + 1] := 11111111111111111111111111111111111111}
3834 }
3835 }
3836 <END_MODULE>
3837 <RESULT COUNT 1>
3838 (?is)\berror: Array index overflow: the index value must be at most `0' instead of `11111111111111111111111111111111111111'
3839 <END_RESULT>
3840 <RESULT COUNT 1>
3841 (?is)\berror: Reference to a constant value was expected instead of variable `vi1'
3842 <END_RESULT>
3843 <RESULT COUNT 4>
3844 (?is)\berror: A value or expression of type float was expected
3845 <END_RESULT>
3846 <RESULT COUNT 1>
3847 (?is)\berror: An integer value less than `2147483647' was expected for indexing timer array instead of `22222222222222222222222222222222222222'
3848 <END_RESULT>
3849 <END_TC>
3850 :exmp.
3851
3852 .*---------------------------------------------------------------------*
3853 :h3.Adhoc:: large integers - indexed notation
3854 .*---------------------------------------------------------------------*
3855 :xmp tab=0.
3856 <TC - large integers - indexed notation>
3857 <COMPILE>
3858 <VERDICT_LEAF PASS>
3859 <MODULE TTCN LargeIntIndexed LargeIntIndexed.ttcn>
3860 module LargeIntIndexed
3861 {
3862 type record of integer intlist
3863 type set of integer intset
3864 type integer intarr4[4]
3865 template intlist itemp1 := {11111111111111111111111111111111, 11, 111}
3866 template intlist itemp2 := {[11111111111111111111111111111111] := 1}
3867 template intlist itemp3 := {[valueof(itemp1[1])] := 1, [1] := 1, [11111111111111111111111111111111] := 1, [11] := 1, [11111111111111111111111111111111] := 1 }
3868 template intset itemp4 := {[11111111111111111111111111111111] := 1}
3869 template intset itemp5 := {[valueof(itemp1[1])] := 1, [1] := 1, [11111111111111111111111111111111] := 1, [11] := 1, [11111111111111111111111111111111] := 1 }
3870 template intarr4 itemp6 := {[12345678910111213141516171819202] := 1}
3871 template intarr4 itemp7 := {[0] := 1, [12345678910111213141516171819202] := 1, [11111111111111111111111111111111] := 1, [1] := 1, [1] := 1}
3872 control {
3873 }
3874 }
3875 <END_MODULE>
3876 <RESULT COUNT 3>
3877 (?is)\berror: An integer value less than `2147483647' was expected for indexing type `.+?intlist' instead of `11111111111111111111111111111111'
3878 <END_RESULT>
3879 <RESULT COUNT 3>
3880 (?is)\berror: An integer value less than `2147483647' was expected for indexing type `.+?intset' instead of `11111111111111111111111111111111'
3881 <END_RESULT>
3882 <RESULT COUNT 2>
3883 (?is)\berror: Array index overflow: the index value must be at most `3' instead of `12345678910111213141516171819202'
3884 <END_RESULT>
3885 <RESULT COUNT 1>
3886 (?is)\berror: Array index overflow: the index value must be at most `3' instead of `11111111111111111111111111111111'
3887 <END_RESULT>
3888 <RESULT COUNT 1>
3889 (?is)\berror: Duplicate index value `1' for components `5' and `4'
3890 <END_RESULT>
3891 <END_TC>
3892 :exmp.
3893
3894 .*---------------------------------------------------------------------*
3895 :h3.Adhoc:: large integers - the substr() predefined function
3896 .*---------------------------------------------------------------------*
3897 :xmp tab=0.
3898 <TC - large integers - the substr() predefined function>
3899 <COMPILE>
3900 <VERDICT_LEAF PASS>
3901 <MODULE TTCN LargeIntSubstr LargeIntSubstr.ttcn>
3902 module LargeIntSubstr
3903 {
3904 control {
3905 var charstring cs1 := substr("example1", 11111111111111111111111111111111, 1)
3906 var charstring cs2 := substr("example2", 1, 11111111111111111111111111111111)
3907 var charstring cs3 := substr("example3", 12345678910111213141516171819202, 11111111111111111111111111111111)
3908 }
3909 }
3910 <END_MODULE>
3911 <RESULT COUNT 1>
3912 (?is)\berror: The sum of second operand `index' \(11111111111111111111111111111111\) and third operand `returncount' \(1\) is greater than the length of the first operand \(8\)
3913 <END_RESULT>
3914 <RESULT COUNT 1>
3915 (?is)\berror: The sum of second operand `index' \(1\) and third operand `returncount' \(11111111111111111111111111111111\) is greater than the length of the first operand \(8\)
3916 <END_RESULT>
3917 <RESULT COUNT 1>
3918 (?is)\berror: The sum of second operand `index' \(12345678910111213141516171819202\) and third operand `returncount' \(11111111111111111111111111111111\) is greater than the length of the first operand \(8\)
3919 <END_RESULT>
3920 <END_TC>
3921 :exmp.
3922
3923 .*---------------------------------------------------------------------*
3924 :h3.Adhoc:: large integers - enumerations
3925 .*---------------------------------------------------------------------*
3926 :xmp tab=0.
3927 <TC - large integers - enumerations>
3928 <COMPILE>
3929 <VERDICT_LEAF PASS>
3930 <MODULE TTCN LargeIntEnum LargeIntEnum.ttcn>
3931 module LargeIntEnum
3932 {
3933 type enumerated enum1 {first(1111111111111111111111111111)}
3934 control {
3935 }
3936 }
3937 <END_MODULE>
3938 <RESULT COUNT 1>
3939 (?is)\berror: The numeric value of enumeration `first' \(1111111111111111111111111111\) is too large for being represented in memory
3940 <END_RESULT>
3941 <END_TC>
3942 :exmp.
3943
3944 .*---------------------------------------------------------------------*
3945 :h3.Adhoc:: large integers - integer subtypes
3946 .*---------------------------------------------------------------------*
3947 :xmp tab=0.
3948 <TC - large integers - integer subtypes>
3949 <COMPILE>
3950 <VERDICT_LEAF PASS>
3951 <MODULE TTCN LargeIntSubtypes LargeIntSubtypes.ttcn>
3952 module LargeIntSubtypes
3953 {
3954 type integer int1 (12345678910111213141516171819..0)
3955 type integer int2 (0..12345678910111213141516171819)
3956 type integer int3 (12345678910111213141516171819..12345678910111213141516171819)
3957 type integer int4[4] (12345678910111213141516171819)
3958 control {
3959 }
3960 }
3961 <END_MODULE>
3962 <RESULT COUNT 1>
3963 (?is)\berror: lower boundary is bigger than upper boundary in integer subtype range
3964 <END_RESULT>
3965 <END_TC>
3966 :exmp.
3967
3968 .*---------------------------------------------------------------------*
3969 :h3.Adhoc:: large integers - value range templates
3970 .*---------------------------------------------------------------------*
3971 :xmp tab=0.
3972 <TC - large integers - value range templates>
3973 <COMPILE>
3974 <VERDICT_LEAF PASS>
3975 <MODULE TTCN LargeIntRange LargeIntRange.ttcn>
3976 module LargeIntRange
3977 {
3978 template integer itemp1 := (12345678910111213141516..1)
3979 template integer itemp2 := (12345678910111213141516..1234567891011121314151617)
3980 template integer itemp3 := (1..1234567891011121314151617)
3981 template integer itemp4 := (11111111111111111111111111)
3982 control {
3983 }
3984 }
3985 <END_MODULE>
3986 <RESULT COUNT 1>
3987 (?is)\berror: The lower boundary is higher than the upper boundary
3988 <END_RESULT>
3989 <END_TC>
3990 :exmp.
3991
3992 .*---------------------------------------------------------------------*
3993 :h3.Adhoc:: large integers - the replace() predefined function
3994 .*---------------------------------------------------------------------*
3995 :xmp tab=0.
3996 <TC - large integers - the replace() predefined function>
3997 <COMPILE>
3998 <VERDICT_LEAF PASS>
3999 <MODULE TTCN LargeIntReplace LargeIntReplace.ttcn>
4000 module LargeIntReplace
4001 {
4002 control {
4003 var charstring cs1 := "exampletext1"
4004 var charstring cs2 := "exampletext2"
4005 cs1 := replace("exampletext1", 11111111111111111111111111111111, 1, "hello")
4006 cs1 := replace("exampletext1", 1, 11111111111111111111111111111111, "hello")
4007 cs1 := replace("exampletext1", 11111111111111111111111111111111, 11111111111111111111111111111111, "hello")
4008 cs1 := replace("exampletext1", 11111111111111111111111111111111, 11111111111111111111111111111111, cs2)
4009 }
4010 }
4011 <END_MODULE>
4012 <RESULT COUNT 1>
4013 (?is)\berror: The sum of second operand `index' \(11111111111111111111111111111111\) and third operand `len' \(1\) is greater than the length of the first operand \(12\)
4014 <END_RESULT>
4015 <RESULT COUNT 1>
4016 (?is)\berror: The sum of second operand `index' \(1\) and third operand `len' \(11111111111111111111111111111111\) is greater than the length of the first operand \(12\)
4017 <END_RESULT>
4018 <RESULT COUNT 2>
4019 (?is)\berror: The sum of second operand `index' \(11111111111111111111111111111111\) and third operand `len' \(11111111111111111111111111111111\) is greater than the length of the first operand \(12\)
4020 <END_RESULT>
4021 <END_TC>
4022 :exmp.
4023
4024 .*---------------------------------------------------------------------*
4025 :h3.Adhoc:: large integers - other predefined functions
4026 .*---------------------------------------------------------------------*
4027 :xmp tab=0.
4028 <TC - large integers - other predefined functions>
4029 <COMPILE>
4030 <VERDICT_LEAF PASS>
4031 <MODULE TTCN LargeIntPredef LargeIntPredef.ttcn>
4032 module LargeIntPredef
4033 {
4034 control {
4035 var charstring cs1
4036 var bitstring bs1
4037 var hexstring hs1
4038 var octetstring os1
4039 var universal charstring us1
4040 var float r1
4041 bs1 := int2bit(1234567891011121314151617181920, 1)
4042 bs1 := int2bit(1, 1234567891011121314151617181920)
4043 bs1 := int2bit(1234567891011121314151617181920, 1234567891011121314151617181920)
4044 hs1 := int2hex(1234567891011121314151617181920, 1)
4045 hs1 := int2hex(1, 1234567891011121314151617181920)
4046 hs1 := int2hex(1234567891011121314151617181920, 1234567891011121314151617181920)
4047 os1 := int2oct(1234567891011121314151617181920, 1)
4048 os1 := int2oct(1, 1234567891011121314151617181920)
4049 os1 := int2oct(1234567891011121314151617181920, 1234567891011121314151617181920)
4050 cs1 := regexp("Hello, World!", "(Hello, World!)*", 1234567891011121314151617181920)
4051 cs1 := int2char(1234567891011121314151617181920)
4052 us1 := int2unichar(1234567891011121314151617181920)
4053 }
4054 }
4055 <END_MODULE>
4056 <RESULT COUNT 3>
4057 (?is)\berror: Value 1234567891011121314151617181920 does not fit in length 1
4058 <END_RESULT>
4059 <RESULT COUNT 6>
4060 (?is)\berror: The length of the resulting string is too large for being represented in memory
4061 <END_RESULT>
4062 <RESULT COUNT 1>
4063 (?is)\berror: The operand of operation `int2char\(\)' should be in range 0..127
4064 <END_RESULT>
4065 <RESULT COUNT 1>
4066 (?is)\berror: First operand of operation `int2unichar\(\)' should be in range 0..2147483647
4067 <END_RESULT>
4068 <RESULT COUNT 1>
4069 (?is)\berror: The the third operand of `regexp\(\)' is too large: The requested group index is 1234567891011121314151617181920, but the pattern contains only 1 group
4070 <END_RESULT>
4071 <END_TC>
4072 :exmp.
4073
4074 .*---------------------------------------------------------------------*
4075 :h3.Adhoc:: large integers - length restrictions
4076 .*---------------------------------------------------------------------*
4077 :xmp tab=0.
4078 <TC - large integers - length restrictions>
4079 <COMPILE>
4080 <VERDICT_LEAF PASS>
4081 <MODULE TTCN LargeIntLenRest LargeIntLenRest.ttcn>
4082 module LargeIntLenRest
4083 {
4084 type record of integer intlist
4085 type set of integer intset
4086 type integer intarr[1]
4087 template intlist ilent1 := {1, 2, 3} length(12345678910111213141516)
4088 template intlist ilent2 := {1, 12345678910111213141516} length(1..12345678910111213141516)
4089 template intlist ilent3 := {1, 2, 3} length(-2..-12345678910111213141516)
4090 template intlist ilent4 := {1, 2, 3} length(12345678910111213141516..1)
4091 template intlist ilent5 := {1, 2, 3} length(12345678910111213141516..12345678910111213141516)
4092 template intarr iat1 := {1} length(1111111111111111111111111111)
4093 template intarr iat2 := {1} length(1..1111111111111111111111111111)
4094 template intarr iat3 := {1} length(1111111111111111111111111111..1)
4095 template intarr iat4 := {1} length(1111111111111111111111111111..1111111111111111111111111111)
4096 control {
4097 }
4098 }
4099 <END_MODULE>
4100 <RESULT COUNT 1>
4101 (?is)\berror: There are fewer \(3\) elements in the template than it is allowed by the length restriction \(12345678910111213141516\)
4102 <END_RESULT>
4103 <RESULT COUNT 2>
4104 (?is)\berror: There are fewer \(3\) elements in the template than it is allowed by the length restriction \(at least 12345678910111213141516\)
4105 <END_RESULT>
4106 <RESULT COUNT 1>
4107 (?is)\berror: The upper boundary of the length restriction must be a non-negative integer value instead of -12345678910111213141516
4108 <END_RESULT>
4109 <RESULT COUNT 1>
4110 (?is)\berror: The lower boundary of the length restriction must be a non-negative integer value instead of -2
4111 <END_RESULT>
4112 <RESULT COUNT 1>
4113 (?is)\berror: The upper boundary of the length restriction \(1\) cannot be smaller than the lower boundary \(1111111111111111111111111111\)
4114 <END_RESULT>
4115 <RESULT COUNT 2>
4116 (?is)\berror: An integer value less than `2147483647' was expected as the upper boundary of the length restriction instead of `1111111111111111111111111111'
4117 <END_RESULT>
4118 <RESULT COUNT 2>
4119 (?is)\berror: An integer value less than `2147483647' was expected as the lower boundary of the length restriction instead of `1111111111111111111111111111'
4120 <END_RESULT>
4121 <RESULT COUNT 1>
4122 (?is)\berror: The number of elements allowed by the length restriction \(1111111111111111111111111111\) contradicts the array size \(1\)
4123 <END_RESULT>
4124 <END_TC>
4125 :exmp.
4126
4127 .*---------------------------------------------------------------------*
4128 :h3.Adhoc:: large integers - basic operations
4129 .*---------------------------------------------------------------------*
4130 :xmp tab=0.
4131 <TC - large integers - basic operations>
4132 <COMPILE>
4133 <VERDICT_LEAF PASS>
4134 <MODULE TTCN LargeIntBasic LargeIntBasic.ttcn>
4135 module LargeIntBasic
4136 {
4137 control {
4138 var bitstring bs1
4139 var charstring cs1
4140 bs1 := bs1 << 1234567891011121314151617181920
4141 bs1 := bs1 >> 1234567891011121314151617181920
4142 cs1 := cs1 <@ 1234567891011121314151617181920
4143 cs1 := cs1 @> 1234567891011121314151617181920
4144 }
4145 }
4146 <END_MODULE>
4147 <RESULT COUNT 1>
4148 (?is)\berror: Right operand of operation `<<' should be less than `2147483647' instead of `1234567891011121314151617181920'
4149 <END_RESULT>
4150 <RESULT COUNT 1>
4151 (?is)\berror: Right operand of operation `>>' should be less than `2147483647' instead of `1234567891011121314151617181920'
4152 <END_RESULT>
4153 <RESULT COUNT 1>
4154 (?is)\berror: Right operand of operation `<@' should be less than `2147483647' instead of `1234567891011121314151617181920'
4155 <END_RESULT>
4156 <RESULT COUNT 1>
4157 (?is)\berror: Right operand of operation `@>' should be less than `2147483647' instead of `1234567891011121314151617181920'
4158 <END_RESULT>
4159 <END_TC>
4160 :exmp.
4161
4162 .*---------------------------------------------------------------------*
4163 :h3.Adhoc:: TR 921 - indexing string type template variables
4164 .*---------------------------------------------------------------------*
4165 :xmp tab=0.
4166 <TC - TR 921 - indexing string type template variables>
4167 <COMPILE>
4168 <VERDICT_LEAF PASS>
4169 <MODULE TTCN TR921 TR921.ttcn>
4170 module TR921
4171 {
4172 control {
4173 var template octetstring ost := '11'O
4174 var template charstring cst := "11"
4175 var template bitstring bst := '11'B
4176 var template hexstring hst := '11'H
4177 var template universal charstring ust := "11"
4178 // Octetstring.
4179 ost[0] := '11'O
4180 ost := ost[1]
4181 if ('11'O == ost[0]) { }
4182 if (ost[0] == '11'O) { }
4183 log(ost[0]);
4184 // Charstring.
4185 cst[0] := "11"
4186 cst := cst[1]
4187 if ("11" == cst[0]) { }
4188 if (cst[0] == "11") { }
4189 log(cst[0]);
4190 // Bitstring.
4191 bst[0] := '11'B
4192 bst := bst[1]
4193 if ('11'B == bst[0]) { }
4194 if (bst[0] == '11'B) { }
4195 log(bst[0]);
4196 // Hexstring.
4197 hst[0] := '11'H
4198 hst := hst[1]
4199 if ('11'H == hst[0]) { }
4200 if (hst[0] == '11'H) { }
4201 log(hst[0]);
4202 // Universal charstring.
4203 ust[0] := "11"
4204 ust := ust[1]
4205 if ("11" == ust[0]) { }
4206 if (ust[0] == "11") { }
4207 log(ust[0]);
4208 }
4209 }
4210 <END_MODULE>
4211 <RESULT COUNT 2>
4212 (?is)\berror: Reference to a value was expected instead of template variable `ost'
4213 <END_RESULT>
4214 <RESULT COUNT 2>
4215 (?is)\berror: Reference to template variable `ost' can not be indexed
4216 <END_RESULT>
4217 <RESULT COUNT 2>
4218 (?is)\berror: Reference to a value was expected instead of template variable `cst'
4219 <END_RESULT>
4220 <RESULT COUNT 2>
4221 (?is)\berror: Reference to template variable `cst' can not be indexed
4222 <END_RESULT>
4223 <RESULT COUNT 2>
4224 (?is)\berror: Reference to a value was expected instead of template variable `bst'
4225 <END_RESULT>
4226 <RESULT COUNT 2>
4227 (?is)\berror: Reference to template variable `bst' can not be indexed
4228 <END_RESULT>
4229 <RESULT COUNT 2>
4230 (?is)\berror: Reference to a value was expected instead of template variable `hst'
4231 <END_RESULT>
4232 <RESULT COUNT 2>
4233 (?is)\berror: Reference to template variable `hst' can not be indexed
4234 <END_RESULT>
4235 <RESULT COUNT 2>
4236 (?is)\berror: Reference to a value was expected instead of template variable `ust'
4237 <END_RESULT>
4238 <RESULT COUNT 2>
4239 (?is)\berror: Reference to template variable `ust' can not be indexed
4240 <END_RESULT>
4241 <END_TC>
4242 :exmp.
4243
4244 .*---------------------------------------------------------------------*
4245 :h3.Adhoc:: pattern concatenation - pattern concatenation mistakes
4246 .*---------------------------------------------------------------------*
4247 :xmp tab=0.
4248 <TC - pattern concatenation - pattern concatenation mistakes>
4249 <COMPILE>
4250 <VERDICT_LEAF PASS>
4251 <MODULE TTCN PatternCat PatternCat.ttcn>
4252 module PatternCat
4253 {
4254 function myfunc(in integer i) return charstring { return "xyz" }
4255 function myfuncp(in integer i) return charstring { return "xyz" }
4256 type record srec { charstring s }
4257 type record of srec slist
4258
4259 control {
4260 var integer myvar := 123
4261 var charstring cs := "xyz"
4262 var octetstring os := '0123'O
4263 var slist mylist
4264 var srec myrec := { "xyz" }
4265 mylist[0].s := "xyz"
4266
4267 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & 12 }
4268 { var template charstring myt := pattern "valami" & cs & "megegyszer" & 12 & "utoljara" }
4269 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & refers(myfunc) }
4270 { var template charstring myt := pattern "valami" & cs & "megegyszer" & refers(myfunc) & "utoljara" }
4271 { var template charstring myt := pattern "valami" & cs & "megegyszer" & myfunc() & "utoljara" }
4272 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & myfunc() }
4273 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & myfuncp(1) }
4274 { var template charstring myt := pattern "valami" & cs & "megegyszer" & myfuncp(1) & "utoljara" }
4275 { var template charstring myt := pattern "valami" & cs & "megegyszer" & myfuncp(myvar) & "utoljara" }
4276 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & myfuncp(myvar) }
4277 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & myvar }
4278 { var template charstring myt := pattern "valami" & cs & "megegyszer" & myvar & "utoljara" }
4279 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & slist }
4280 { var template charstring myt := pattern "valami" & cs & "megegyszer" & slist & "utoljara" }
4281 { var template charstring myt := pattern "valami" & cs & "megegyszer" & "utoljara" & os }
4282 { var template charstring myt := pattern "valami" & cs & "megegyszer" & os & "utoljara" }
4283 }
4284 }
4285 <END_MODULE>
4286 <RESULT COUNT 2>
4287 (?is)\berror: at or before token `12': syntax error, unexpected Number, expecting Identifier or Cstring
4288 <END_RESULT>
4289 <RESULT COUNT 2>
4290 (?is)\berror: at or before token `refers': syntax error, unexpected RefersKeyword, expecting Identifier or Cstring
4291 <END_RESULT>
4292 <RESULT COUNT 6>
4293 (?is)\berror: at or before token `\(': syntax error, unexpected '\('
4294 <END_RESULT>
4295 <END_TC>
4296 :exmp.
4297
4298 .*---------------------------------------------------------------------*
4299 :h3.Adhoc:: Type Compatibility - Sample tests for structured types
4300 .*---------------------------------------------------------------------*
4301 :xmp tab=0.
4302 <TC - Type Compatibility - Sample test for structured types>
4303 <COMPILE>
4304 <VERDICT_LEAF PASS>
4305 <MODULE TTCN Compat1 Compat1.ttcn>
4306 module Compat1 {
4307 type record myrec1 { integer a }
4308 type record myrec2 { integer a }
4309 type record length(2) of integer myrecof1
4310 type record of integer myrecof2
4311 type record length(4) of integer myrecof3
4312 template myrecof3 t_myrecof3 := { 1, 2, 3, 4 }
4313 type integer myarr1[4]
4314 type union myuni1 {
4315 myrecof1 f1,
4316 myrecof2 f2
4317 }
4318 type union myuni2 {
4319 myrecof2 f1,
4320 myrecof1 f2
4321 }
4322
4323 control {
4324 var myrec1 r1 := { 1 }
4325 var myrec2 r2
4326
4327 r2 := r1
4328 var myrecof1 ro1 := { 1, 2 }
4329 var myrecof2 ro2 := { }
4330 var myrecof3 ro3 := { 1, 2, 3, 4 }
4331 var myarr1 ar1 := { 1, 2, 3, 4 }
4332 var myuni1 uni1
4333 var myuni2 uni2
4334 ro1 := ar1 // !OK -> Incompatible dimension/subtype.
4335 if (r1 == r2) { } // OK
4336 if (ro1 == ro3) { } // !OK -> Incompatible subtypes.
4337 if (uni1 == uni2) { } // OK -> Can be compatible at run-time.
4338 ro2 := substr(myrec1 : t_myrecof3, 0, 1) // !OK
4339 }
4340 }
4341 <END_MODULE>
4342 <RESULT LTRT COUNT 1>
4343 (?is)\berror: Type mismatch: a value of type `\@Compat1.myrec2' was expected instead of `\@Compat1.myrec1'
4344 <END_RESULT>
4345 <RESULT LTRT COUNT 1>
4346 (?is)\berror: Type mismatch: a value of type `\@Compat1.myrecof1' was expected instead of `integer\[4\]'
4347 <END_RESULT>
4348 <RESULT LTRT COUNT 2>
4349 (?is)\berror: The operands of operation `==' should be of compatible types
4350 <END_RESULT>
4351 <RESULT FTRT COUNT 1>
4352 (?is)\berror: Type mismatch: `\@Compat1.myrecof1' and `integer\[4\]' are not compatible: Incompatible record of/SEQUENCE OF subtypes
4353 <END_RESULT>
4354 <RESULT COUNT 1>
4355 (?is)\berror: Type mismatch: `@Compat1.myrecof1' and `@Compat1.myrecof3' are not compatible: Incompatible record of/SEQUENCE OF subtypes
4356 <END_RESULT>
4357 <RESULT LTRT COUNT 1>
4358 (?is)\berror: Type mismatch: a value or template of type `\@Compat1.myrec1' was expected instead of `\@Compat1.myrecof3'
4359 <END_RESULT>
4360 <RESULT COUNT 1>
4361 (?is)\berror: First operand of operation `substr\(\)' should be a string, `record of' or `set of' value
4362 <END_RESULT>
4363 <END_TC>
4364 :exmp.
4365
4366 .*---------------------------------------------------------------------*
4367 :h3.Adhoc:: Type Compatibility - Simple records and others
4368 .*---------------------------------------------------------------------*
4369 :xmp tab=0.
4370 <TC - Type Compatibility - Records and others>
4371 <COMPILE>
4372 <VERDICT_LEAF PASS>
4373 <MODULE TTCN Compat2 Compat2.ttcn>
4374 module Compat2 {
4375 type port MyPort message {
4376 inout myrec1
4377 inout myrec2 // OK
4378 inout myrec1_alias // !OK
4379 }
4380 type component Empty {
4381 timer T
4382 port MyPort P
4383 }
4384 type record myrec1 { integer a }
4385 type myrec1 myrec1_alias // Only a "typedef".
4386 type record myrec2 { integer a }
4387 type record myrec3 { integer a optional }
4388 type record myrec4 { integer a, integer b }
4389 type set myset1 { integer a }
4390 type set of integer mysetof1
4391 type record of integer myrecof1
4392 type record length(1) of integer myrecof2
4393 type record length(2) of integer myrecof3
4394 type integer myarr1[1]
4395 type union myuni1 {
4396 myrec1 a,
4397 myrec2 b
4398 }
4399 type union myuni2 {
4400 myrec2 a,
4401 myrec1 b
4402 }
4403 testcase tc1_Compat2(in myrec1 p1) runs on Empty {
4404 // For template instances the compatibility check is reversed.
4405 var myrec4 rec4 := { 1, 2 }
4406 activate(as1_Compat2(myrec2 : { 1 })) // OK
4407 activate(as1_Compat2(myrec3 : { 1 })) // !OK
4408 activate(as1_Compat2(rec4)) // !OK
4409 P.send(rec4) // !OK
4410 P.receive(rec4) // !OK
4411 }
4412 function f1_Compat2(in myrec1 p1) { }
4413 function f2_Compat2() return myrec1 {
4414 var myrec2 l_rec2
4415 var myrec3 l_rec3
4416 var myrec4 l_rec4
4417 if (l_rec2.a > l_rec2.a) { return l_rec2 } // OK
4418 else if (l_rec2.a == l_rec2.a) { return l_rec3 } // !OK
4419 else if (l_rec2.a < l_rec2.a) { return l_rec4 } // !OK
4420 else { return { 1 } }
4421 }
4422 altstep as1_Compat2(in myrec1 p1) runs on Empty { [p1.a > p1.a] T.timeout { } }
4423 control {
4424 var myrec1 rec1 := { 1 }
4425 var myrec2 rec2 := rec1 // OK
4426 var myrec3 rec3 := { omit }
4427 var myrec4 rec4 := { rec1.a, rec2.a }
4428 var myset1 set1 := { 1 }
4429 var mysetof1 setof1 := { 1 }
4430 var myrecof1 recof1 := { 1 }
4431 var myrecof2 recof2 := { 1 }
4432 var myrecof3 recof3 := { 1, 2 }
4433 var myarr1 arr1 := { 1 }
4434 var myarr2 arr2 := { 1, 2 }
4435 var myuni1 uni1 := { a := { 1 } }
4436 var myuni2 uni2 := { b := { 1 } }
4437 var anytype any1 := { myrec1 := { 1 } }
4438
4439 // Records <-> records.
4440 rec2 := rec3 // OK
4441 if (rec2 == rec3 or rec2 != rec3) { } // OK
4442 execute(tc1_Compat2(rec2)) // OK
4443 execute(tc1_Compat2(rec3)) // !OK
4444 execute(tc1_Compat2(rec4)) // !OK
4445 f1_Compat2(rec2) // OK
4446 f1_Compat2(rec3) // !OK
4447 f1_Compat2(rec4) // !OK
4448
4449 // Records <-> sets.
4450 set1 := rec1 // !OK
4451 rec1 := set1 // !OK
4452 execute(tc1_Compat2(set1)) // !OK
4453 f1_Compat2(set1) // !OK
4454 if (set1 == rec1 or rec1 != set1) { } // !OK
4455
4456 // Records <-> set ofs.
4457 setof1 := rec1
4458 rec1 := setof1
4459 execute(tc1_Compat2(setof1)) // !OK
4460 f1_Compat2(setof1) // !OK
4461 if (setof1 == rec1 or rec1 != setof1) { } // !OK
4462
4463 // Records <-> record ofs.
4464 recof1 := rec1 // OK
4465 rec1 := recof1 // OK
4466 execute(tc1_Compat2(recof1)) // OK
4467 f1_Compat2(recof1) // OK
4468 if (recof1 == rec1 or rec1 != recof1) { } // OK
4469
4470 // Records <-> record ofs (good restriction).
4471 recof2 := rec1 // OK
4472 rec1 := recof2 // OK
4473 execute(tc1_Compat2(recof2)) // OK
4474 f1_Compat2(recof2) // OK
4475 if (recof2 == rec1 or rec1 != recof2) { } // OK
4476
4477 // Records <-> record ofs (bad restriction).
4478 recof3 := rec1 // !OK
4479 rec1 := recof3 // !OK
4480 execute(tc1_Compat2(recof3)) // !OK
4481 f1_Compat2(recof3) // !OK
4482 if (recof3 == rec1 or rec1 != recof3) { } // !OK
4483
4484 // Records <-> arrays (good dimension).
4485 arr1 := rec1 // OK
4486 rec1 := arr1 // OK
4487 execute(tc1_Compat2(arr1)) // OK
4488 f1_Compat2(arr1) // OK
4489 if (arr1 == rec1 or rec1 != arr1) { } // OK
4490
4491 // Records <-> arrays (bad dimension).
4492 arr1 := rec4 // !OK
4493 rec4 := arr1 // !OK
4494 if (arr1 == rec4 or rec4 != arr1) { } // !OK
4495
4496 // Records <-> unions.
4497 uni1 := rec1 // !OK
4498 rec1 := uni1 // !OK
4499 if (uni1 == rec1 or rec1 != uni1) { } // !OK
4500
4501 // Records <-> anytypes.
4502 rec1 := any1 // !OK
4503 any1 := rec1 // !OK
4504 if (any1 == rec1 or rec1 != any1) { } // !OK
4505
4506 // Unions <-> unions.
4507 uni1 := uni2 // OK
4508 uni2 := uni1 // OK
4509 if (uni1 == uni2 or uni2 == uni1) { } // OK
4510
4511 // Unions <-> anytypes.
4512 uni1 := any1 // !OK
4513 any1 := uni1 // !OK
4514 if (uni1 == any1 or any1 == uni1) { } // !OK
4515 }
4516 } with { extension "anytype myrec1, myrec2" }
4517 <END_MODULE>
4518 <RESULT FTRT COUNT 1>
4519 (?is)\berror: Duplicate incoming message type `\@Compat2.myrec1'
4520 <END_RESULT>
4521 <RESULT FTRT COUNT 1>
4522 (?is)\berror: Duplicate outgoing message type `\@Compat2.myrec1'
4523 <END_RESULT>
4524 <RESULT FTRT COUNT 2>
4525 (?is)\bnote: Type `\@Compat2.myrec1' is already listed here
4526 <END_RESULT>
4527 <RESULT FTRT COUNT 1>
4528 (?is)\berror: Message type `\@Compat2.myrec4' is not present on the outgoing list of port type `\@Compat2.MyPort'
4529 <END_RESULT>
4530 <RESULT FTRT COUNT 1>
4531 (?is)\berror: Message type `\@Compat2.myrec4' is not present on the incoming list of port of type `\@Compat2.MyPort'
4532 <END_RESULT>
4533 <RESULT FTRT COUNT 3>
4534 (?is)\berror: Type mismatch: `\@Compat2.myrec2.a' of type `integer' and `\@Compat2.myrec3.a' of type `integer' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4535 <END_RESULT>
4536 <RESULT FTRT COUNT 4>
4537 (?is)\berror: Type mismatch: `\@Compat2.myrec1.a' of type `integer' and `\@Compat2.myrec3.a' of type `integer' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4538 <END_RESULT>
4539 <RESULT FTRT COUNT 4>
4540 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.myrec4' are not compatible: The number of fields in record/SEQUENCE types must be the same
4541 <END_RESULT>
4542 <RESULT FTRT COUNT 4>
4543 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.myset1' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4544 <END_RESULT>
4545 <RESULT FTRT COUNT 2>
4546 (?is)\berror: Type mismatch: `\@Compat2.myset1' and `\@Compat2.myrec1' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4547 <END_RESULT>
4548 <RESULT FTRT COUNT 4>
4549 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.mysetof1' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4550 <END_RESULT>
4551 <RESULT FTRT COUNT 2>
4552 (?is)\berror: Type mismatch: `\@Compat2.mysetof1' and `\@Compat2.myrec1' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4553 <END_RESULT>
4554 <RESULT FTRT COUNT 4>
4555 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.myrecof3' are not compatible: Incompatible record of/SEQUENCE OF subtypes
4556 <END_RESULT>
4557 <RESULT FTRT COUNT 2>
4558 (?is)\berror: Type mismatch: `\@Compat2.myrecof3' and `\@Compat2.myrec1' are not compatible: Incompatible record of/SEQUENCE OF subtypes
4559 <END_RESULT>
4560 <RESULT FTRT COUNT 2>
4561 (?is)\berror: Type mismatch: `integer\[1\]' and `\@Compat2.myrec4' are not compatible: The dimension of the array must be >= than the number of mandatory fields in the record/SEQUENCE type
4562 <END_RESULT>
4563 <RESULT FTRT COUNT 2>
4564 (?is)\berror: Type mismatch: `\@Compat2.myrec4' and `integer\[1\]' are not compatible: The dimension of the array must be >= than the number of mandatory fields in the record/SEQUENCE type
4565 <END_RESULT>
4566 <RESULT FTRT COUNT 2>
4567 (?is)\berror: Type mismatch: `\@Compat2.myuni1' and `\@Compat2.myrec1' are not compatible: union/CHOICE/anytype types are compatible only with other union/CHOICE/anytype types
4568 <END_RESULT>
4569 <RESULT FTRT COUNT 2>
4570 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.myuni1' are not compatible: union/CHOICE/anytype types are compatible only with other union/CHOICE/anytype types
4571 <END_RESULT>
4572 <RESULT FTRT COUNT 2>
4573 (?is)\berror: Type mismatch: `\@Compat2.myrec1' and `\@Compat2.anytype' are not compatible: union/CHOICE/anytype types are compatible only with other union/CHOICE/anytype types
4574 <END_RESULT>
4575 <RESULT FTRT COUNT 2>
4576 (?is)\berror: Type mismatch: `\@Compat2.anytype' and `\@Compat2.myrec1' are not compatible: Type anytype is compatible only with other anytype types
4577 <END_RESULT>
4578 <RESULT FTRT COUNT 2>
4579 (?is)\berror: Type mismatch: `\@Compat2.myuni1' and `\@Compat2.anytype' are not compatible: Type anytype is compatible only with other anytype types
4580 <END_RESULT>
4581 <RESULT FTRT COUNT 2>
4582 (?is)\berror: Type mismatch: `\@Compat2.anytype' and `\@Compat2.myuni1' are not compatible: Type anytype is compatible only with other anytype types
4583 <END_RESULT>
4584 <END_TC>
4585 :exmp.
4586
4587 .*---------------------------------------------------------------------*
4588 :h3.Adhoc:: Type Compatibility - Standard compile-time errors
4589 .*---------------------------------------------------------------------*
4590 :xmp tab=0.
4591 <TC - Type Compatibility - Standard compile-time errors>
4592 <COMPILE>
4593 <VERDICT_LEAF PASS>
4594 <MODULE TTCN Compat3 Compat3.ttcn>
4595 // Compile-time errors from the standard.
4596 module Compat3 {
4597 type record AType {
4598 integer a(0..10) optional,
4599 integer b(0..10) optional,
4600 boolean c
4601 }
4602
4603 type record BType {
4604 integer a optional,
4605 integer b(0..10) optional,
4606 boolean c
4607 }
4608
4609 type record CType {
4610 integer d optional,
4611 integer e optional,
4612 boolean f
4613 }
4614
4615 type record DType {
4616 integer a optional,
4617 integer b optional,
4618 boolean c optional
4619 }
4620
4621 type record EType {
4622 integer a optional,
4623 integer b optional,
4624 boolean c,
4625 float d optional
4626 }
4627
4628 type set FType {
4629 integer a optional,
4630 integer b optional,
4631 boolean c
4632 }
4633
4634 type union U1 { integer i }
4635 type union U2 { integer i, boolean b }
4636
4637 control {
4638 var AType MyVarA := { -, 1, true }
4639 var BType MyVarB := { omit, 2, true }
4640 var CType MyVarC := { 3, omit, true }
4641 var DType MyVarD := { 4, 4, true }
4642 var EType MyVarE := { 5, 5, true, omit }
4643 var U1 u1 := { i := 1 }
4644 var U2 u2 := u1
4645
4646 MyVarA := MyVarB // OK
4647 MyVarC := MyVarB // OK
4648 MyVarA := MyVarD // !OK
4649 MyVarA := MyVarE // !OK
4650
4651 var FType MyVarF := { a := 1, c := true }
4652 MyVarF := MyVarA // !OK
4653 u1 := u2 // OK
4654 var anytype x := u1 // !OK
4655 }
4656 } with { extension "anytype integer" }
4657 <END_MODULE>
4658 <RESULT FTRT COUNT 1>
4659 (?is)\berror: Type mismatch: `\@Compat3.AType.c' of type `boolean' and `\@Compat3.DType.c' of type `boolean' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4660 <END_RESULT>
4661 <RESULT FTRT COUNT 1>
4662 (?is)\berror: Type mismatch: `\@Compat3.AType' and `\@Compat3.EType' are not compatible: The number of fields in record/SEQUENCE types must be the same
4663 <END_RESULT>
4664 <RESULT FTRT COUNT 1>
4665 (?is)\berror: Type mismatch: `\@Compat3.FType' and `\@Compat3.AType' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4666 <END_RESULT>
4667 <RESULT FTRT COUNT 1>
4668 (?is)\berror: Type mismatch: `@Compat3.anytype' and `\@Compat3.U1' are not compatible: Type anytype is compatible only with other anytype types
4669 <END_RESULT>
4670 <END_TC>
4671 :exmp.
4672
4673 .*---------------------------------------------------------------------*
4674 :h3.Adhoc:: Type Compatibility - More complex types
4675 .*---------------------------------------------------------------------*
4676 :xmp tab=0.
4677 <TC - Type Compatibility - More complex types>
4678 <COMPILE>
4679 <VERDICT_LEAF PASS>
4680 <MODULE TTCN Compat4 Compat4.ttcn>
4681 module Compat4 {
4682 type record myrec1 {
4683 integer f1 optional,
4684 integer f2,
4685 boolean f3
4686 }
4687 type record myrec2 {
4688 integer f1,
4689 integer f2,
4690 boolean f3
4691 }
4692 type record of myrec1 mylist1
4693 type myrec2 myarr2[2]
4694 type mylist1 myarr1[2] // Top-level 1.
4695 type record of myarr2 mylist2 // Top-level 2.
4696 control {
4697 var myarr1 arr1 := {
4698 { { omit, 99, false }, { 1, 100, true } },
4699 { { 1, 2, false }, { 0, 1, false } }
4700 }
4701 var mylist2 ml2 := {
4702 { { 1, 2, false }, { 11, 22, false } },
4703 { { -1, -2, true }, { -11, -22, true } }
4704 }
4705 arr1 := ml2 // !OK
4706 ml2 := arr1 // !OK
4707 if (arr1 == ml2 or ml2 != arr1) { } // !OK
4708 }
4709 }
4710 <END_MODULE>
4711 <RESULT FTRT COUNT 2>
4712 (?is)\berror: Type mismatch: `\@Compat4.mylist1\[2\]\[\].f1' of type `integer' and `\@Compat4.mylist2\[\].f1' of type `integer' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4713 <END_RESULT>
4714 <RESULT FTRT COUNT 2>
4715 (?is)\berror: Type mismatch: `\@Compat4.mylist2\[\].f1' of type `integer' and `\@Compat4.mylist1\[2\]\[\].f1' of type `integer' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4716 <END_RESULT>
4717 <END_TC>
4718 :exmp.
4719
4720 .*---------------------------------------------------------------------*
4721 :h3.Adhoc:: Type Compatibility - Arrays and other list types
4722 .*---------------------------------------------------------------------*
4723 :xmp tab=0.
4724 <TC - Type Compatibility - Arrays and other list types>
4725 <COMPILE>
4726 <VERDICT_LEAF PASS>
4727 <MODULE TTCN Compat5 Compat5.ttcn>
4728 module Compat5 {
4729 const integer i1[2 .. 4] := { 1, 2, 3 }
4730 const integer i2[3] := i1
4731 const integer i3[1..3] := i1
4732 const integer i1[2][1..2] := { { 1, 2 }, { 3, 4 } };
4733 const integer i2[2][0..1] := i1;
4734 control {
4735 }
4736 }
4737 <END_MODULE>
4738 <RESULT FTRT COUNT 1>
4739 (?is)\berror: Type mismatch: `integer\[3\]' and `integer\[2..4\]' are not compatible: Array types should have the same dimension
4740 <END_RESULT>
4741 <RESULT FTRT COUNT 1>
4742 (?is)\berror: Type mismatch: `integer\[1..3\]' and `integer\[2..4\]' are not compatible: Array types should have the same dimension
4743 <END_RESULT>
4744 <RESULT FTRT COUNT 1>
4745 (?is)\berror: Type mismatch: `integer\[2\]\[0..1\]' and `integer\[2..4\]' are not compatible: Array types should have the same dimension
4746 <END_RESULT>
4747 <RESULT LTRT COUNT 1>
4748 (?is)\berror: Type mismatch: a value of type `integer\[3\]' was expected instead of `integer\[2..4\]'
4749 <END_RESULT>
4750 <RESULT LTRT COUNT 1>
4751 (?is)\berror: Type mismatch: a value of type `integer\[1..3\]' was expected instead of `integer\[2..4\]'
4752 <END_RESULT>
4753 <RESULT LTRT COUNT 1>
4754 (?is)\berror: Type mismatch: a value of type `integer\[2\]\[0..1\]' was expected instead of `integer\[2..4\]'
4755 <END_RESULT>
4756 <END_TC>
4757 :exmp.
4758
4759 .*---------------------------------------------------------------------*
4760 :h3.Adhoc:: Type Compatibility - Templates of all kind
4761 .*---------------------------------------------------------------------*
4762 :xmp tab=0.
4763 <TC - Type Compatibility - Templates of all kind>
4764 <COMPILE>
4765 <VERDICT_LEAF PASS>
4766 <MODULE TTCN Compat6 Compat6.ttcn>
4767 module Compat6 {
4768 type record rtype { integer i, boolean b }
4769 type set stype { integer i, boolean b }
4770 type record r2type { integer i1, integer i2 }
4771 type set of integer s2type
4772
4773 template rtype t := { 1, true }
4774 template stype t1 modifies t := { b := false }
4775 template r2type u := { 1, 2 };
4776 template s2type u1 modifies u := { 2, 1 };
4777
4778 // Test for the first bug (TR 955).
4779 type record of integer b1_intlist
4780 type set of integer b1_intset
4781 const b1_intlist c_b1 := { 1, 2, 3 }
4782 template b1_intset t_b1 := { 3, 2, 1 }
4783
4784 control {
4785 var template rtype tv1
4786 var template r2type tv2
4787 tv1 := tv2
4788 if (match(valueof(t), u1)) { }
4789 if (match(c_b1, t_b1)) { }
4790 }
4791 }
4792 <END_MODULE>
4793 <RESULT FTRT COUNT 1>
4794 (?is)\berror: Type mismatch: `\@Compat6.stype' and `\@Compat6.rtype' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4795 <END_RESULT>
4796 <RESULT FTRT COUNT 1>
4797 (?is)\berror: Type mismatch: `\@Compat6.s2type' and `\@Compat6.r2type' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4798 <END_RESULT>
4799 <RESULT FTRT COUNT 1>
4800 (?is)\berror: Type mismatch: `\@Compat6.rtype.b' of type `boolean' and `\@Compat6.r2type.i2' of type `integer' are not compatible
4801 <END_RESULT>
4802 <RESULT FTRT COUNT 1>
4803 (?is)\berror: Type mismatch: `\@Compat6.s2type' and `\@Compat6.rtype' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4804 <END_RESULT>
4805 <RESULT FTRT COUNT 1>
4806 (?is)\berror: Type mismatch: `\@Compat6.b1_intset' and `\@Compat6.b1_intlist' are not compatible: set/SET and set of/SET OF types are compatible only with other set/SET set of/SET OF types
4807 <END_RESULT>
4808 <RESULT LTRT COUNT 1>
4809 (?is)\berror: The modified template has different type than base template `\@Compat6.t': `\@Compat6.rtype' was expected instead of `\@Compat6.stype'
4810 <END_RESULT>
4811 <RESULT LTRT COUNT 1>
4812 (?is)\berror: The modified template has different type than base template `\@Compat6.u': `\@Compat6.r2type' was expected instead of `\@Compat6.s2type'
4813 <END_RESULT>
4814 <RESULT LTRT COUNT 1>
4815 (?is)\berror: Type mismatch: a value or template of type `\@Compat6.rtype' was expected instead of `\@Compat6.r2type'
4816 <END_RESULT>
4817 <RESULT LTRT COUNT 1>
4818 (?is)\berror: Type mismatch: a value or template of type `\@Compat6.s2type' was expected instead of `\@Compat6.rtype'
4819 <END_RESULT>
4820 <RESULT LTRT COUNT 1>
4821 (?is)\berror: Type mismatch: a value of type `\@Compat6.b1_intset' was expected instead of `\@Compat6.b1_intlist'
4822 <END_RESULT>
4823 <RESULT COUNT 5>
4824 (?is)\berror:
4825 <END_RESULT>
4826 <END_TC>
4827 :exmp.
4828
4829 .*---------------------------------------------------------------------*
4830 :h3.Adhoc:: Type Compatibility - Recursive types
4831 .*---------------------------------------------------------------------*
4832 :xmp tab=0.
4833 <TC - Type Compatibility - Recursive types>
4834 <COMPILE>
4835 <VERDICT_LEAF PASS>
4836 <MODULE TTCN Compat6 Compat6.ttcn>
4837 module Compat6 {
4838 type record of recR recofR
4839 type record recR { recofR rof optional }
4840 type record c1 { recR f1 }
4841 type record c11 { c1 f1 }
4842 type record c2 { recofR f1 }
4843 type record c22 { c2 f1 }
4844 // "Normal" use.
4845 type record A {
4846 integer f1,
4847 B f2 optional
4848 }
4849 type record B {
4850 A f1 optional,
4851 integer f2
4852 }
4853 control {
4854 // Make sure that we don't stuck in an infinite recursion.
4855 var recofR v_rof := { { omit } }
4856 var recR v_r := { rof := omit }
4857 var c11 cc1 := { f1 := { { omit } } }
4858 var c22 cc2 := { f1 := { { { omit } } } }
4859 cc1 := cc2
4860 if (cc1 == cc2) { }
4861 v_r := v_rof
4862 if (v_r.rof == omit) { }
4863 v_rof := v_r
4864 if (cc1 == v_r or v_rof == cc2) { } // Just to get an error...
4865 var A a := { f1 := 1, f2 := { f1 := { 1, omit }, f2 := 11 } }
4866 var B b := { f1 := a, f2 := 1 }
4867 if (a == b and not b != a) { }
4868 }
4869 }
4870 <END_MODULE>
4871 <RESULT FTRT COUNT 1>
4872 (?is)\berror: Type mismatch: `\@Compat6.c11.f1' of type `\@Compat6.c1' and `\@Compat6.recR.rof' of type `\@Compat6.recofR' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4873 <END_RESULT>
4874 <RESULT FTRT COUNT 1>
4875 (?is)\berror: Type mismatch: `\@Compat6.recofR\[\].rof' of type `\@Compat6.recofR' and `\@Compat6.c22.f1.f1' of type `\@Compat6.recofR' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4876 <END_RESULT>
4877 <RESULT FTRT COUNT 1>
4878 (?is)\berror: Type mismatch: `\@Compat6.A.f1' of type `integer' and `\@Compat6.B.f1' of type `\@Compat6.A' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4879 <END_RESULT>
4880 <RESULT FTRT COUNT 1>
4881 (?is)\berror: Type mismatch: `\@Compat6.B.f1' of type `\@Compat6.A' and `\@Compat6.A.f1' of type `integer' are not compatible: The optionality of fields in record/SEQUENCE types must be the same
4882 <END_RESULT>
4883 <RESULT LTRT COUNT 4>
4884 (?is)\berror: The operands of operation `==' should be of compatible types
4885 <END_RESULT>
4886 <RESULT LTRT COUNT 1>
4887 (?is)\berror: The operands of operation `!=' should be of compatible types
4888 <END_RESULT>
4889 <RESULT LTRT COUNT 1>
4890 (?is)\berror: Type mismatch: a value of type `\@Compat6.c11' was expected instead of `\@Compat6.c22'
4891 <END_RESULT>
4892 <RESULT LTRT COUNT 1>
4893 (?is)\berror: Type mismatch: a value of type `\@Compat6.recR' was expected instead of `\@Compat6.recofR'
4894 <END_RESULT>
4895 <RESULT LTRT COUNT 1>
4896 (?is)\berror: Type mismatch: a value of type `\@Compat6.recofR' was expected instead of `\@Compat6.recR'
4897 <END_RESULT>
4898 <END_TC>
4899 :exmp.
4900
4901 .*---------------------------------------------------------------------*
4902 :h3.Adhoc:: Default values of modified parametrized templates
4903 .*---------------------------------------------------------------------*
4904 :xmp tab=0.
4905 <TC - Default values of modified parametrized templates>
4906 <COMPILE>
4907 <VERDICT_LEAF PASS>
4908 <MODULE TTCN TDefPar TDefPar.ttcn>
4909 module TDefPar {
4910 // Negative tests for ETSI CR5091.
4911
4912 type record MyRecordType {
4913 integer field1 optional,
4914 charstring field2,
4915 boolean field3
4916 }
4917
4918 // For value parameters.
4919
4920 template MyRecordType MyTemplate1(integer p_int) := {
4921 field1 := 1,
4922 field2 := "",
4923 field3 := true
4924 }
4925
4926 template MyRecordType MyTemplate2(integer p_int := -) modifies MyTemplate1 := {
4927 field1 := -1
4928 }
4929
4930 template MyRecordType MyTemplate3(integer p_int := -) := {
4931 1, "", true
4932 }
4933
4934 template MyRecordType MyTemplate4(integer p_int := 1, charstring p_str, boolean p_bool) := {
4935 p_int, p_str, p_bool
4936 }
4937
4938 template MyRecordType MyTemplate5(integer p_int := -, charstring p_str := -, boolean p_bool := -) modifies MyTemplate4 := {
4939 p_int, p_str, p_bool
4940 }
4941
4942 template MyRecordType MyTemplate6(integer p_int := 1, charstring p_str, boolean p_bool, octetstring p_ostr := -) modifies MyTemplate4 := {
4943 p_int, p_str, p_bool
4944 }
4945
4946 // For template parameters.
4947
4948 template MyRecordType TMyTemplate1(template integer p_int) := {
4949 field1 := 1,
4950 field2 := "",
4951 field3 := true
4952 }
4953
4954 template MyRecordType TMyTemplate2(template integer p_int := -) modifies TMyTemplate1 := {
4955 field1 := -1
4956 }
4957
4958 template MyRecordType TMyTemplate3(template integer p_int := -) := {
4959 1, "", true
4960 }
4961
4962 template MyRecordType TMyTemplate4(template integer p_int := 1, template charstring p_str, template boolean p_bool) := {
4963 p_int, p_str, p_bool
4964 }
4965
4966 template MyRecordType TMyTemplate5(template integer p_int := -, template charstring p_str := -, template boolean p_bool := -) modifies TMyTemplate4 := {
4967 p_int, p_str, p_bool
4968 }
4969
4970 template MyRecordType TMyTemplate6(template integer p_int := 1, template charstring p_str, template boolean p_bool, template octetstring p_ostr := -) modifies TMyTemplate4 := {
4971 p_int, p_str, p_bool
4972 }
4973
4974 template MyRecordType TMyTemplate7(template integer p_int := 0) modifies MyRecordType := {
4975 field1 := p_int
4976 }
4977
4978 type component Empty { timer T := 1.0 }
4979
4980 testcase TC1(in integer p1 := -) runs on Empty { }
4981 testcase TC2(in template integer p1 := -) runs on Empty { }
4982
4983 function Func1(in integer p1 := -) { }
4984 function Func2(in template integer p1 := -) { }
4985
4986 altstep Alt1(in integer p1 := -) runs on Empty { [1 > 2] T.timeout { } }
4987 altstep Alt2(in template integer p1 := -) runs on Empty { [1 > 2] T.timeout { } }
4988
4989
4990 }
4991 <END_MODULE>
4992 <RESULT COUNT 8>
4993 (?is)\berror: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template
4994 <END_RESULT>
4995 <RESULT COUNT 2>
4996 (?is)\berror: Only modified templates are allowed to use the not used symbol \(`-'\) as the default parameter
4997 <END_RESULT>
4998 <RESULT COUNT 5>
4999 (?is)\berror: integer value was expected
5000 <END_RESULT>
5001 <RESULT COUNT 1>
5002 (?is)\berror: character string value was expected
5003 <END_RESULT>
5004 <RESULT COUNT 1>
5005 (?is)\berror: boolean value was expected
5006 <END_RESULT>
5007 <RESULT COUNT 1>
5008 (?is)\berror: octetstring value was expected
5009 <END_RESULT>
5010 <RESULT COUNT 1>
5011 (?is)\berror: Reference to a template was expected in the `modifies' definition instead of type `\@TDefPar.MyRecordType'
5012 <END_RESULT>
5013 <RESULT COUNT 19>
5014 (?is)\berror:
5015 <END_RESULT>
5016 <END_TC>
5017 :exmp.
5018
5019 *---------------------------------------------------------------------*
5020 :h3.Adhoc:: __SCOPE__ macro
5021 .*---------------------------------------------------------------------*
5022 :xmp tab=0.
5023 <TC - __SCOPE__ macro>
5024 <COMPILE>
5025 <VERDICT_LEAF PASS>
5026 <MODULE TTCN TDefPar TDefPar.ttcn>
5027 module TDefPar {
5028 // Negative tests for __SCOPE__ macro.
5029
5030 type enumerated Dummy { Dummy1, Dummy2 };
5031
5032 type record MyRecord {
5033 charstring field1,
5034 charstring field2 (__SCOPE__) optional
5035 };
5036
5037 type record MyRecord2 {
5038 MyRecord field1,
5039 charstring field2 (__SCOPE__)
5040 };
5041
5042
5043 template MyRecord t_MyTemplate := {
5044 field1 := __SCOPE__,
5045 //field2 := __SCOPE__ //NOK MyRecord not equal with t_MyTemplate
5046 field2 := "MyRecord"
5047 }
5048
5049 template MyRecord2 t_MyTemplate2 := {
5050 field1 := {
5051 field1 := __SCOPE__,
5052 field2 := __SCOPE__
5053 },
5054 field2 := __SCOPE__
5055 }
5056
5057 }
5058 <END_MODULE>
5059 <RESULT COUNT 1>
5060 (?is)\berror: "t_MyTemplate2" is not a valid value for type `charstring' which has subtype \("MyRecord"\)
5061 <END_RESULT>
5062 <RESULT COUNT 1>
5063 (?is)\berror: "t_MyTemplate2" is not a valid value for type `charstring' which has subtype \("MyRecord2"\)
5064 <END_RESULT>
5065 <END_TC>
5066 :exmp.
5067
5068 *---------------------------------------------------------------------*
5069 :h3.Adhoc:: public/private/friend
5070 .*---------------------------------------------------------------------*
5071 :xmp tab=0.
5072 <TC - public/private/friend>
5073 <COMPILE>
5074 <VERDICT_LEAF PASS>
5075 <MODULE TTCN module1 module1.ttcn>
5076 module module1
5077 {
5078
5079 public modulepar charstring ts_m1:="public";
5080 private modulepar charstring ts_m2:="private";
5081 friend modulepar charstring ts_m3:="friend";
5082
5083 friend module module2;
5084
5085 private import from module2 all;//OK
5086 private import from module3 all;//OK
5087 private import from module4 all;//OK
5088
5089 const module2Type akarmi1 := 1; //OK, type is implicitly public
5090 const module2TypePublic akarmi2 := 2; //OK, type is explicitly public
5091 const module2TypeFriend akarmi3 := 3; //OK, module1 is friend of module2
5092 const module2TypePrivate akarmi4 := 4; //NOK, module2TypePrivate is private to module2
5093
5094 group g_MyGroup{
5095 const module3Type akarmi5 := 5; //OK, type is implicitly public
5096 const module3TypePublic akarmi6 := 6; //OK, type is explicitly public
5097 const module3TypeFriend akarmi7 := 7; //NOK, module1 is NOT a friend of module3
5098 const module3TypePrivate akarmi8 := 8; //NOK, module2TypePrivate is private to module2
5099 }
5100
5101 function MyFunc1() runs on Lib4_CT {} //OK
5102 function MyFunc2() runs on Lib4Friend_CT {} //OK, module1 is friend for module4
5103 function MyFunc3() runs on Lib4Private_CT {} //NOK, the *name* Lib4Private_CT is not visible for module1, thus fails at checking the runs on clause, whatever is the content!
5104
5105
5106 function f_set2_Lib4_1() runs on Lib4_CT { v_Lib4_1 := 0 } //OK
5107 function f_set2_Lib4_2() runs on Lib4_CT { v_Lib4_2 := 0 } //OK
5108 function f_set2_Lib4_3() runs on Lib4_CT { v_Lib4_3 := 0 } //OK
5109 function f_set2_Lib4Friend_1() runs on Lib4Friend_CT { v_Lib4Friend_1 := 0 } //OK
5110 function f_set2_Lib4Friend_2() runs on Lib4Friend_CT { v_Lib4Friend_2 := 0 } //OK
5111 function f_set2_Lib4Friend_3() runs on Lib4Friend_CT { v_Lib4Friend_3 := 0 } //OK
5112
5113
5114 type component User_CT extends Lib4_CT {};
5115 function f_set3_Lib4_1() runs on User_CT { v_Lib4_1 := 0 } //OK
5116 function f_set3_Lib4_2() runs on User_CT { v_Lib4_2 := 0 } //OK
5117 function f_set3_Lib4_3() runs on User_CT { v_Lib4_3 := 0 } //NOK, v_Lib4_3 is private, can be used in functions with "Lib4_CT" in their runs on (but not in children)
5118
5119 //in short: visibility of the component type definition (name) and allowed use of the component
5120 //type definitions are two different things. Component type visibility is checked when checking
5121 //the runs on clause. Component definition visibility is checked (after a successful runs on
5122 //check), when the definition is used within the body of the function
5123
5124
5125 //All setter functions of module4 are public, hence can be called from any function
5126 //with a compatible runs on clause
5127 function f_MyFunc_1() runs on User_CT { f_set_Lib4_1() } //OK
5128 function f_MyFunc_2() runs on User_CT { f_set_Lib4_2() } //OK
5129 function f_MyFunc_3() runs on User_CT { f_set_Lib4_3() } //OK
5130
5131 type component UserFriend_CT extends Lib4Friend_CT {}; //OK
5132 function f_MyFuncFriend_1() runs on UserFriend_CT { f_set_Lib4Friend_1() } //OK
5133 function f_MyFuncFriend_2() runs on UserFriend_CT { f_set_Lib4Friend_2() } //OK
5134 function f_MyFuncFriend_3() runs on UserFriend_CT { f_set_Lib4Friend_3() } //OK
5135
5136
5137 type component UserPrivate_CT extends Lib4Private_CT {}; //NOK, the name Lib4Private_CT is not visible in module1
5138 function f_MyFuncPrivate_1() runs on UserPrivate_CT { f_set_Lib4Private_1() } //NOK, UserPrivate_CT has an error
5139 function f_MyFuncPrivate_2() runs on UserPrivate_CT { f_set_Lib4Private_2() } //NOK, UserPrivate_CT has an error
5140 function f_MyFuncPrivate_3() runs on UserPrivate_CT { f_set_Lib4Private_3() } //NOK, UserPrivate_CT has an error
5141
5142 control {
5143 var Lib4Private_CT v_Lib4Private := Lib4Private_CT.create; // NOK, the name Lib4Privae_CT is not visible in module1
5144 }
5145
5146 } // end of module1
5147
5148 <END_MODULE>
5149 <MODULE TTCN module2 module2.ttcn>
5150 module module2
5151 {
5152 friend module module1;
5153 public group g_Group1{
5154 type integer module2Type;
5155 public type integer module2TypePublic;
5156 friend type integer module2TypeFriend;
5157 private type integer module2TypePrivate;
5158 }
5159
5160 /*private*/ group g_Group2{
5161 type integer module2Type2;
5162 public type integer module2TypePublic2;
5163 friend type integer module2TypeFriend2;
5164 private type integer module2TypePrivate2;
5165 }
5166
5167 /*friend*/ group g_Group3{
5168 type integer module2Type3;
5169 public type integer module2TypePublic3;
5170 friend type integer module2TypeFriend3;
5171 private type integer module2TypePrivate3;
5172 }
5173
5174 } // end of module2
5175
5176 <END_MODULE>
5177 <MODULE TTCN module3 module3.ttcn>
5178 module module3
5179 {
5180 type integer module3Type;
5181 public type integer module3TypePublic;
5182 friend type integer module3TypeFriend;
5183 private type integer module3TypePrivate;
5184
5185 public type port pPublic message { inout charstring; } with {extension "internal"}
5186 private type port pPrivate message { inout charstring; } with {extension "internal"}
5187 friend type port pFriend message { inout charstring; } with {extension "internal"}
5188 } // end of module3
5189
5190 <END_MODULE>
5191 <MODULE TTCN module4 module4.ttcn>
5192 module module4
5193 {
5194 friend module module1;
5195
5196 type component Lib4_CT {
5197 var integer v_Lib4_1;
5198 public var integer v_Lib4_2;
5199 private var integer v_Lib4_3;
5200 }
5201 friend type component Lib4Friend_CT {
5202 var integer v_Lib4Friend_1;
5203 public var integer v_Lib4Friend_2;
5204 private var integer v_Lib4Friend_3;
5205 }
5206 private type component Lib4Private_CT {
5207 var integer v_Lib4Private_1;
5208 public var integer v_Lib4Private_2;
5209 private var integer v_Lib4Private_3;
5210 }
5211
5212 function f_set_Lib4_1() runs on Lib4_CT { v_Lib4_1 := 0 } //OK
5213 function f_set_Lib4_2() runs on Lib4_CT { v_Lib4_2 := 0 } //OK
5214 function f_set_Lib4_3() runs on Lib4_CT { v_Lib4_3 := 0 } //OK
5215 function f_set_Lib4Friend_1() runs on Lib4Friend_CT { v_Lib4Friend_1 := 0 } //OK
5216 function f_set_Lib4Friend_2() runs on Lib4Friend_CT { v_Lib4Friend_2 := 0 } //OK
5217 function f_set_Lib4Friend_3() runs on Lib4Friend_CT { v_Lib4Friend_3 := 0 } //OK
5218
5219 //These functions cannot be called or started outside module4, though they are public!
5220 //See module1
5221 function f_set_Lib4Private_1() runs on Lib4Private_CT { v_Lib4Private_1 := 0 } //OK
5222 function f_set_Lib4Private_2() runs on Lib4Private_CT { v_Lib4Private_2 := 0 } //OK
5223 function f_set_Lib4Private_3() runs on Lib4Private_CT { v_Lib4Private_3 := 0 } //OK
5224 } // end of module4
5225
5226 <END_MODULE>
5227 <MODULE TTCN module5 module5.ttcn>
5228 module module5
5229 {
5230 /*public*/ import from module2 all;//NOK no public import
5231 }
5232 <END_MODULE>
5233 <MODULE TTCN module6 module6.ttcn>
5234 module module6
5235 {
5236 /*friend*/ import from module2 all;//NOK no friend import
5237 }
5238 <END_MODULE>
5239
5240 <RESULT COUNT 1>
5241 (?is)\berror: There is no local or imported definition with name `module2TypePrivate'
5242 <END_RESULT>
5243 <RESULT COUNT 1>
5244 (?is)\berror: There is no local or imported definition with name `module3TypeFriend'
5245 <END_RESULT>
5246 <RESULT COUNT 1>
5247 (?is)\berror: There is no local or imported definition with name `module3TypePrivate'
5248 <END_RESULT>
5249 <RESULT COUNT 4>
5250 (?is)\berror: There is no local or imported definition with name `Lib4Private_CT'
5251 <END_RESULT>
5252 <RESULT COUNT 1>
5253 (?is)\berror: The member definition `v_Lib4_3' in component type `User_CT' is not visible in this scope
5254 <END_RESULT>
5255 <RESULT COUNT 1>
5256 (?is)\berror: Runs on clause mismatch: A definition that runs on component type `@module1.UserPrivate_CT' cannot call function `@module4.f_set_Lib4Private_1', which runs on `@module4.Lib4Private_CT'
5257 <END_RESULT>
5258 <RESULT COUNT 1>
5259 (?is)\berror: Runs on clause mismatch: A definition that runs on component type `@module1.UserPrivate_CT' cannot call function `@module4.f_set_Lib4Private_2', which runs on `@module4.Lib4Private_CT'
5260 <END_RESULT>
5261 <RESULT COUNT 1>
5262 (?is)\berror: Runs on clause mismatch: A definition that runs on component type `@module1.UserPrivate_CT' cannot call function `@module4.f_set_Lib4Private_3', which runs on `@module4.Lib4Private_CT'
5263 <END_RESULT>
5264 <RESULT COUNT 1>
5265 (?is)\berror: Operation `create()' is not allowed in control part
5266 <ENd RESULT>
5267 <END_TC>
5268 :exmp.
5269
5270 *---------------------------------------------------------------------*
5271 :h3.Adhoc:: Subtyping - Verdicts
5272 .*---------------------------------------------------------------------*
5273 :xmp tab=0.
5274 <TC - Subtyping - Verdicts>
5275 <COMPILE>
5276 <VERDICT_LEAF PASS>
5277 <MODULE TTCN module1 module1.ttcn>
5278 module module1
5279 {
5280 type verdicttype myv1 (pass, fail, none)
5281 type myv1 myv2 (inconc)
5282 // No error for disjunct types.
5283 type verdicttype myv3 (myv1, myv2)
5284 type myv3 myv4 (myv3, myv3, myv3)
5285 const myv1 c_myv1 := inconc
5286 const myv2 c_myv2 := c_myv1
5287 template myv1 t_myv1 := inconc
5288 template myv2 t_myv2 := t_myv1
5289 template myv1 t_myv3 := (inconc)
5290
5291 modulepar myv1 mp1 := inconc
5292
5293 function fv1() return myv1 { return inconc }
5294 function fv2(in myv1 p1 := inconc) { }
5295
5296 control {
5297 var template myv1 vt_myv1 := inconc
5298 var template myv1 vt_myv2 := t_myv2
5299 var template myv2 vt_myv3 := fv1() // No error.
5300 var myv1 v_myv1 := inconc
5301 var myv1 v_myv2 := valueof(t_myv2)
5302 var myv2 v_myv3 := fv1()
5303 }
5304 }
5305 <END_MODULE>
5306 <RESULT COUNT 8>
5307 (?is)\berror: inconc is not a valid value for type `verdicttype' which has subtype \(none,pass,fail\)
5308 <END_RESULT>
5309 <RESULT COUNT 1>
5310 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(inconc\) is not subset of subtype \(none,pass,fail\)
5311 <END_RESULT>
5312 <RESULT COUNT 9>
5313 (?is)\berror:
5314 <END_RESULT>
5315 <END_TC>
5316 :exmp.
5317
5318 *---------------------------------------------------------------------*
5319 :h3.Adhoc:: Subtyping - Booleans
5320 .*---------------------------------------------------------------------*
5321 :xmp tab=0.
5322 <TC - Subtyping - Booleans>
5323 <COMPILE>
5324 <VERDICT_LEAF PASS>
5325 <MODULE TTCN module1 module1.ttcn>
5326 module module1
5327 {
5328 type boolean myb1 (true)
5329 type myb1 myb2 (false)
5330 type boolean myb3 (myb1, myb2)
5331 const myb1 c_myb1 := false
5332 const myb2 c_myb2 := c_myb1
5333 template myb1 t_myb1 := false
5334 template myb2 t_myb2 := t_myb1
5335 template myb1 t_myb3 := (false)
5336
5337 modulepar myb1 mp1 := false
5338
5339 function fb1() return myb1 { return false }
5340 function fb2(in myb1 p1 := false) { }
5341
5342 control {
5343 var template myb1 vt_myb1 := false
5344 var template myb1 vt_myb2 := t_myb2
5345 var template myb2 vt_myb3 := fb1()
5346 var myb1 v_myb1 := false
5347 var myb1 v_myb2 := valueof(t_myb2)
5348 var myb2 v_myb3 := fb1()
5349 }
5350 }
5351 <END_MODULE>
5352 <RESULT COUNT 8>
5353 (?is)\berror: false is not a valid value for type `boolean' which has subtype \(true\)
5354 <END_RESULT>
5355 <RESULT COUNT 1>
5356 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(false\) is not subset of subtype \(true\)
5357 <END_RESULT>
5358 <RESULT COUNT 9>
5359 (?is)\berror:
5360 <END_RESULT>
5361 <END_TC>
5362 :exmp.
5363
5364 *---------------------------------------------------------------------*
5365 :h3.Adhoc:: Subtyping - Integers
5366 .*---------------------------------------------------------------------*
5367 :xmp tab=0.
5368 <TC - Subtyping - Integers>
5369 <COMPILE>
5370 <VERDICT_LEAF PASS>
5371 <MODULE TTCN module1 module1.ttcn>
5372 module module1
5373 {
5374 type integer myi1 (1, 2, 3)
5375 type myi1 myi2 (4)
5376 type myi1 myi3 (4..8)
5377 type myi1 myi4 (4..8, 16)
5378 type integer myi5 (myi1, myi2)
5379 type integer myi6 (1, 2, myi7)
5380 type integer myi7 (myi6, 1, 2)
5381 type integer myi8 (myi1, 99, 101)
5382
5383 const myi1 c_myi1 := 4
5384 const myi2 c_myi2 := c_myi1
5385 const myi8 c_myi3 := 100
5386
5387 template myi1 t_myi1 := 4
5388 template myi2 t_myi2 := t_myi1
5389 template myi1 t_myi3 := (4)
5390 template myi8 t_myi4 := c_myi3
5391
5392 modulepar myi1 mp1 := 4
5393 modulepar myi5 mp2 := 32 // No error.
5394
5395 function fi1() return myi1 { return 4 }
5396 function fi2(in myi1 p1 := 4) { }
5397
5398 control {
5399 var template myi1 vt_myi1 := 4
5400 var template myi1 vt_myi2 := t_myi2
5401 var template myi2 vt_myi3 := fi1()
5402 var template myi8 vt_myi4 := 100
5403 var myi1 v_myi1 := 4
5404 // It seems, that no additional error is reported here.
5405 var myi1 v_myi2 := valueof(t_myi2)
5406 var myi2 v_myi3 := fi1()
5407 var myi8 v_myi4 := 100
5408 }
5409 }
5410 <END_MODULE>
5411 <RESULT COUNT 4>
5412 (?is)\berror: 100 is not a valid value for type `integer' which has subtype \(1..3,99,101\)
5413 <END_RESULT>
5414 <RESULT COUNT 8>
5415 (?is)\berror: 4 is not a valid value for type `integer' which has subtype \(1..3\)
5416 <END_RESULT>
5417 <RESULT COUNT 1>
5418 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4\) is not subset of subtype \(1..3\)
5419 <END_RESULT>
5420 <RESULT COUNT 1>
5421 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4..8\) is not subset of subtype \(1..3\)
5422 <END_RESULT>
5423 <RESULT COUNT 1>
5424 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4..8,16\) is not subset of subtype \(1..3\)
5425 <END_RESULT>
5426 <RESULT COUNT 1>
5427 (?is)\berror: While checking circular type references in subtype definitions: Circular reference: `\@module1.myi6' -> `\@module1.myi7' -> `\@module1.myi6'
5428 <END_RESULT>
5429 <RESULT COUNT 16>
5430 (?is)\berror:
5431 <END_RESULT>
5432 <END_TC>
5433 :exmp.
5434
5435 *---------------------------------------------------------------------*
5436 :h3.Adhoc:: Subtyping - Floats
5437 .*---------------------------------------------------------------------*
5438 :xmp tab=0.
5439 <TC - Subtyping - Floats>
5440 <COMPILE>
5441 <VERDICT_LEAF PASS>
5442 <MODULE TTCN module1 module1.ttcn>
5443 module module1
5444 {
5445 type float myf1 (1.0, 2.0, 3.0)
5446 type myf1 myf2 (4.0)
5447 type myf1 myf3 (4.0..8.0)
5448 type myf1 myf4 (4.0..8.0, 16.0)
5449 type float myf5 (myf1, myf2)
5450
5451 const myf1 c_myf1 := 4.0
5452 const myf2 c_myf2 := c_myf1
5453
5454 template myf1 t_myf1 := 4.0
5455 template myf2 t_myf2 := t_myf1
5456 template myf1 t_myf3 := (4.0)
5457
5458 modulepar myf1 mp1 := 4.0
5459 modulepar myf5 mp2 := 32.0 // No error.
5460
5461 function ff1() return myf1 { return 4.0 }
5462 function ff2(in myf1 p1 := 4.0) { }
5463
5464 control {
5465 var template myf1 vt_myf1 := 4.0
5466 var template myf1 vt_myf2 := t_myf2
5467 var template myf2 vt_myf3 := ff1()
5468 var myf1 v_myf1 := 4.0
5469 var myf1 v_myf2 := valueof(t_myf2)
5470 var myf2 v_myf3 := ff1()
5471 }
5472 }
5473 <END_MODULE>
5474 <RESULT COUNT 8>
5475 (?is)\berror: 4.0e0 is not a valid value for type `float' which has subtype \(1.0e0,2.0e0,3.0e0\)
5476 <END_RESULT>
5477 <RESULT COUNT 1>
5478 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4.0e0\) is not subset of subtype \(1.0e0,2.0e0,3.0e0\)
5479 <END_RESULT>
5480 <RESULT COUNT 1>
5481 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4.0e0..8.0e0\) is not subset of subtype \(1.0e0,2.0e0,3.0e0\)
5482 <END_RESULT>
5483 <RESULT COUNT 1>
5484 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(4.0e0..8.0e0,1.6e1\) is not subset of subtype \(1.0e0,2.0e0,3.0e0\)
5485 <END_RESULT>
5486 <RESULT COUNT 11>
5487 (?is)\berror:
5488 <END_RESULT>
5489 <END_TC>
5490 :exmp.
5491
5492 *---------------------------------------------------------------------*
5493 :h3.Adhoc:: Subtyping - Charstrings
5494 .*---------------------------------------------------------------------*
5495 :xmp tab=0.
5496 <TC - Subtyping - Charstrings>
5497 <COMPILE>
5498 <VERDICT_LEAF PASS>
5499 <MODULE TTCN module1 module1.ttcn>
5500 module module1
5501 {
5502 type charstring myc1 ("ich", "du", "er")
5503 type charstring myc2 length(1)
5504 type myc1 myc3 length(1)
5505 type myc1 myc4 ("a".."z") // No error message.
5506 type myc1 myc5 ("a".."z", "sie")
5507 type charstring myc6 (myc1, myc2)
5508 type myc1 myc7 (pattern "itstoolong")
5509 type myc1 myc8 (pattern "i*h")
5510
5511 const myc1 c_myc1 := "sie"
5512 const myc2 c_myc2 := "sie"
5513 const myc8 c_myc3 := "ich"
5514
5515 template myc1 t_myc1 := "sie"
5516 template myc2 t_myc2 := "sie"
5517 template myc2 t_myc3 := t_myc1
5518 template myc1 t_myc4 := ("sie")
5519
5520 function fc1() return myc1 { return "sie" }
5521 function fc2(in myc1 p1 := "sie") { }
5522
5523 control {
5524 var template myc1 vt_myc1 := "sie"
5525 var template myc2 vt_myc2 := "sie"
5526 var template myc2 vt_myc3 := fc1()
5527 var myc1 v_myc1 := "sie"
5528 // Additional `(' characters in the error message.
5529 var myc2 v_myc2 := "sie"
5530 var myc2 v_myc3 := fc1()
5531 }
5532 }
5533 <END_MODULE>
5534 <RESULT COUNT 1>
5535 (?is)\berror: Mixing of value list and range subtyping is not allowed for type `charstring'
5536 <END_RESULT>
5537 <RESULT COUNT 7>
5538 (?is)\berror: "sie" is not a valid value for type `charstring' which has subtype \("du","er","ich"\)
5539 <END_RESULT>
5540 <RESULT COUNT 4>
5541 (?is)\berror: "sie" is not a valid value for type `charstring' which has subtype length\(1\)
5542 <END_RESULT>
5543 <RESULT COUNT 2>
5544 (?is)\berror: The subtype is an empty set
5545 <END_RESULT>
5546 <RESULT COUNT 3>
5547 (?is)\berror: Subtype mismatch: subtype length\(1\) has no common value with subtype \("du","er","ich"\)
5548 <END_RESULT>
5549 <RESULT COUNT 17>
5550 (?is)\berror:
5551 <END_RESULT>
5552 <END_TC>
5553 :exmp.
5554
5555 *---------------------------------------------------------------------*
5556 :h3.Adhoc:: Subtyping - Universal Charstrings
5557 .*---------------------------------------------------------------------*
5558 :xmp tab=0.
5559 <TC - Subtyping - Universal Charstrings>
5560 <COMPILE>
5561 <VERDICT_LEAF PASS>
5562 <MODULE TTCN module1 module1.ttcn>
5563 module module1
5564 {
5565 type universal charstring myu1 (char(0, 0, 0, 0), char(0, 0, 0, 1))
5566 type universal charstring myu2 length(1)
5567 type myu1 myu3 length(2)
5568 type universal charstring myu4 (myu1, myu2)
5569 type universal charstring myu5 (pattern "abc?\q{0, 0, 1, 113}")
5570 const myu1 c_myu1 := char(0, 0, 1, 0)
5571 const myu2 c_myu2 := char(0, 0, 1, 0) & char(0, 0, 1, 0)
5572 template myu1 t_myu1 := char(0, 0, 1, 0)
5573 template myu2 t_myu2 := char(0, 0, 1, 0) & char(0, 0, 1, 0)
5574 template myu2 t_myu3 := t_myu1
5575 template myu1 t_myu4 := (char(0, 0, 1, 0))
5576
5577 function fu1() return myu1 { return char(0, 0, 1, 0) & char(0, 0, 1, 0) }
5578 function fu2(in myu1 p1 := char(0, 0, 1, 0) & char(0, 0, 1, 0)) { }
5579
5580 control {
5581 var template myu1 vt_myu1 := char(0, 0, 1, 0)
5582 var template myu2 vt_myu2 := char(0, 0, 1, 0) & char(0, 0, 1, 0)
5583 var template myu2 vt_myu3 := fu1()
5584 var myu1 v_myu1 := char(0, 0, 1, 0)
5585 var myu2 v_myu2 := char(0, 0, 1, 0) & char(0, 0, 1, 0)
5586 var myu2 v_myu3 := fu1()
5587 }
5588 }
5589 <END_MODULE>
5590 <RESULT COUNT 5>
5591 (?is)\berror: char\(0, 0, 1, 0\) is not a valid value for type `universal charstring' which has subtype \(char\(0, 0, 0, 0\),char\(0, 0, 0, 1\)\)
5592 <END_RESULT>
5593 <RESULT COUNT 4>
5594 (?is)\berror: char\(0, 0, 1, 0\) & char\(0, 0, 1, 0\) is not a valid value for type `universal charstring' which has subtype length\(1\)
5595 <END_RESULT>
5596 <RESULT COUNT 2>
5597 (?is)\berror: char\(0, 0, 1, 0\) & char\(0, 0, 1, 0\) is not a valid value for type `universal charstring' which has subtype \(char\(0, 0, 0, 0\),char\(0, 0, 0, 1\)\)
5598 <END_RESULT>
5599 <RESULT COUNT 1>
5600 (?is)\berror: The subtype is an empty set
5601 <END_RESULT>
5602 <RESULT COUNT 12>
5603 (?is)\berror:
5604 <END_RESULT>
5605 <END_TC>
5606 :exmp.
5607
5608 *---------------------------------------------------------------------*
5609 :h3.Adhoc:: Subtyping - Bitstrings
5610 .*---------------------------------------------------------------------*
5611 :xmp tab=0.
5612 <TC - Subtyping - Bitstrings>
5613 <COMPILE>
5614 <VERDICT_LEAF PASS>
5615 <MODULE TTCN module1 module1.ttcn>
5616 module module1
5617 {
5618 type bitstring myb1 ('00'B, '01'B)
5619 type bitstring myb2 length(1)
5620 // The consistent `The subtype is an empty set' error message may be better.
5621 type myb1 myb3 length(1)
5622 type bitstring myb4 (myb1, myb2)
5623 const myb1 c_myb1 := '10'B
5624 const myb2 c_myb2 := '10'B
5625 template myb1 t_myb1 := '10'B
5626 template myb2 t_myb2 := '10'B
5627 template myb2 t_myb3 := t_myb1
5628 template myb1 t_myb4 := ('10'B)
5629
5630 function fb1() return myb1 { return '10'B }
5631 function fb2(in myb1 p1 := '00'B) { }
5632
5633 control {
5634 var template myb1 vt_myb1 := '10'B
5635 var template myb2 vt_myb2 := '10'B
5636 // It's not yet checked.
5637 var template myb2 vt_myb3 := fb1()
5638 var myb1 v_myb1 := '10'B
5639 var myb2 v_myb2 := '10'B
5640 var myb2 v_myb3 := fb1()
5641 }
5642 }
5643 <END_MODULE>
5644 <RESULT COUNT 6>
5645 (?is)\berror: '10'B is not a valid value for type `bitstring' which has subtype \('00'B,'01'B\)
5646 <END_RESULT>
5647 <RESULT COUNT 4>
5648 (?is)\berror: '10'B is not a valid value for type `bitstring' which has subtype length\(1\)
5649 <END_RESULT>
5650 <RESULT COUNT 1>
5651 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(1\) is not subset of subtype \('00'B,'01'B\)
5652 <END_RESULT>
5653 <RESULT COUNT 3>
5654 (?is)\berror: Subtype mismatch: subtype length\(1\) has no common value with subtype \('00'B,'01'B\)
5655 <END_RESULT>
5656 <RESULT COUNT 14>
5657 (?is)\berror:
5658 <END_RESULT>
5659 <END_TC>
5660 :exmp.
5661
5662 *---------------------------------------------------------------------*
5663 :h3.Adhoc:: Subtyping - Hexstrings
5664 .*---------------------------------------------------------------------*
5665 :xmp tab=0.
5666 <TC - Subtyping - Hexstrings>
5667 <COMPILE>
5668 <VERDICT_LEAF PASS>
5669 <MODULE TTCN module1 module1.ttcn>
5670 module module1
5671 {
5672 type hexstring myh1 ('00'H, '01'H)
5673 type hexstring myh2 length(1)
5674 type myh1 myh3 length(1)
5675 type hexstring myh4 (myh1, myh2)
5676 const myh1 c_myh1 := '10'H
5677 const myh2 c_myh2 := '10'H
5678 template myh1 t_myh1 := '10'H
5679 template myh2 t_myh2 := '10'H
5680 template myh2 t_myh3 := t_myh1
5681 template myh1 t_myh4 := ('10'H)
5682
5683 function fh1() return myh1 { return '00'H }
5684 function fh2(in myh1 p1 := '00'H) { }
5685
5686 control {
5687 var template myh1 vt_myh1 := '10'H
5688 var template myh2 vt_myh2 := '10'H
5689 var template myh2 vt_myh3 := fh1()
5690 var myh1 v_myh1 := '10'H
5691 var myh2 v_myh2 := '10'H
5692 var myh2 v_myh3 := fh1()
5693 }
5694 }
5695 <END_MODULE>
5696 <RESULT COUNT 5>
5697 (?is)\berror: '10'H is not a valid value for type `hexstring' which has subtype \('00'H,'01'H\)
5698 <END_RESULT>
5699 <RESULT COUNT 4>
5700 (?is)\berror: '10'H is not a valid value for type `hexstring' which has subtype length\(1\)
5701 <END_RESULT>
5702 <RESULT COUNT 1>
5703 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(1\) is not subset of subtype \('00'H,'01'H\)
5704 <END_RESULT>
5705 <RESULT COUNT 3>
5706 (?is)\berror: Subtype mismatch: subtype length\(1\) has no common value with subtype \('00'H,'01'H\)
5707 <END_RESULT>
5708 <RESULT COUNT 13>
5709 (?is)\berror:
5710 <END_RESULT>
5711 <END_TC>
5712 :exmp.
5713
5714 *---------------------------------------------------------------------*
5715 :h3.Adhoc:: Subtyping - Octetstrings
5716 .*---------------------------------------------------------------------*
5717 :xmp tab=0.
5718 <TC - Subtyping - Octetstrings>
5719 <COMPILE>
5720 <VERDICT_LEAF PASS>
5721 <MODULE TTCN module1 module1.ttcn>
5722 module module1
5723 {
5724 type octetstring myo1 ('00'O, '01'O)
5725 type octetstring myo2 length(1)
5726 type myo1 myo3 length(2)
5727 type octetstring myo4 (myo1, myo2)
5728 const myo1 c_myo1 := '10'O
5729 const myo2 c_myo2 := '1010'O
5730 const myo3 c_myo3 := '10'O
5731 template myo1 t_myo1 := '10'O
5732 template myo2 t_myo2 := '1010'O
5733 template myo2 t_myo3 := t_myo1
5734 template myo1 t_myo4 := ('10'O)
5735 template myo3 t_myo5 := '10'O
5736
5737 function fo1() return myo1 { return '1010'O }
5738 function fo2(in myo1 p1 := '1010'O) { }
5739
5740 control {
5741 var template myo1 vt_myo1 := '10'O
5742 var template myo2 vt_myo2 := '1010'O
5743 var template myo3 vt_myo3 := '10'O
5744 var template myo1 vt_myo4 := fo1()
5745 var myo1 v_myo1 := '10'O
5746 var myo2 v_myo2 := '1010'O
5747 var myo3 v_myo3 := '10'O
5748 var myo1 v_myo4 := fo1()
5749 }
5750 }
5751 <END_MODULE>
5752 <RESULT COUNT 5>
5753 (?is)\berror: '10'O is not a valid value for type `octetstring' which has subtype \('00'O,'01'O\)
5754 <END_RESULT>
5755 <RESULT COUNT 4>
5756 (?is)\berror: '1010'O is not a valid value for type `octetstring' which has subtype length\(1\)
5757 <END_RESULT>
5758 <RESULT COUNT 1>
5759 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(2\) is not subset of subtype \('00'O,'01'O\)
5760 <END_RESULT>
5761 <RESULT COUNT 2>
5762 (?is)\berror: '1010'O is not a valid value for type `octetstring' which has subtype \('00'O,'01'O\)
5763 <END_RESULT>
5764 <RESULT COUNT 12>
5765 (?is)\berror:
5766 <END_RESULT>
5767 <END_TC>
5768 :exmp.
5769
5770 *---------------------------------------------------------------------*
5771 :h3.Adhoc:: Subtyping - Objids
5772 .*---------------------------------------------------------------------*
5773 :xmp tab=0.
5774 <TC - Subtyping - Objids>
5775 <COMPILE>
5776 <VERDICT_LEAF PASS>
5777 <MODULE TTCN module1 module1.ttcn>
5778 module module1
5779 {
5780 type objid myo1 (objid{itu_t(0) identified_organization(4) etsi(0)})
5781 const myo1 c_myo1 := objid{0 0 0}
5782 template myo1 t_myo1 := objid{0 0 0}
5783
5784 control {
5785 var template myo1 vt_myo1 := objid{0 0 0}
5786 var myo1 v_myo1 := objid{0 0 0}
5787 }
5788 }
5789 <END_MODULE>
5790 <RESULT COUNT 4>
5791 (?is)\berror: objid \{ 0 0 0 \} is not a valid value for type `objid' which has subtype \(objid \{ 0 4 0 \}\)
5792 <END_RESULT>
5793 <END_TC>
5794 :exmp.
5795
5796 *---------------------------------------------------------------------*
5797 :h3.Adhoc:: Subtyping - Anytypes
5798 .*---------------------------------------------------------------------*
5799 :xmp tab=0.
5800 <TC - Subtyping - Anytypes>
5801 <COMPILE>
5802 <VERDICT_LEAF PASS>
5803 <MODULE TTCN module1 module1.ttcn>
5804 module module1
5805 {
5806 type anytype mya1 ({integer := 0})
5807 type anytype mya2
5808 type integer myint1 (1, 2, 3)
5809 type mya2.myint1 myint2 (1..2)
5810
5811 const mya1 c_mya1 := {integer := 1}
5812 const mya2.myint1 c_mya2 := 100
5813 const myint2 c_myi1 := 3
5814
5815 template mya1 t_mya1 := {integer := 1}
5816
5817 control {
5818 var template mya1 vt_mya1 := {integer := 1}
5819 var mya1 v_mya1 := {integer := 1}
5820 }
5821 } with { extension "anytype integer, myint1" }
5822 <END_MODULE>
5823 <RESULT COUNT 1>
5824 (?is)\berror: 3 is not a valid value for type `integer' which has subtype \(1..2\)
5825 <END_RESULT>
5826 <RESULT COUNT 2>
5827 (?is)\berror: \{ integer := 1 \} is not a valid value for type `\@module1.anytype' which has subtype \(\{ integer := 0 \}\)
5828 <END_RESULT>
5829 <RESULT COUNT 1>
5830 (?is)\berror: 100 is not a valid value for type `integer' which has subtype \(1..3\)
5831 <END_RESULT>
5832 <RESULT COUNT 4>
5833 (?is)\berror:
5834 <END_RESULT>
5835 <END_TC>
5836 :exmp.
5837
5838 *---------------------------------------------------------------------*
5839 :h3.Adhoc:: Subtyping - Unions
5840 .*---------------------------------------------------------------------*
5841 :xmp tab=0.
5842 <TC - Subtyping - Unions>
5843 <COMPILE>
5844 <VERDICT_LEAF PASS>
5845 <MODULE TTCN module1 module1.ttcn>
5846 module module1
5847 {
5848 type union myu1 {
5849 integer f1,
5850 charstring f2
5851 }
5852 type myu1 myu2 ({f1 := 0}, {f2 := ""})
5853 type myu1 myu3 ({f1 := 100}, {f1 := 200})
5854 type myu1 myu4 (myu3.interestingfieldreferencenotcheckedbutpossible)
5855 type myu1 myu5 (myu3, myu4)
5856
5857 const myu2 c_myu1 := {f1 := 1}
5858 const myu5 c_myu2 := {f1 := 1}
5859
5860 // Union subtypes are not checked for templates. We should expect 4 error
5861 // messages instead of 2. It should be fixed later. This applies for
5862 // record, set and union types as well.
5863 template myu2 t_myu1 := {f1 := 1}
5864 template myu5 t_myu2 := {f1 := valueof(t_myu1.f1)}
5865
5866 control {
5867 var template myu2 vt_myu1 := {f1 := 1}
5868 var template myu5 vt_myu2 := {f1 := vt_myu1.f1}
5869 var myu2 v_myu1 := {f1 := 1}
5870 var myu5 v_myu2 := {f1 := v_myu1.f1} // Check?
5871 }
5872 }
5873 <END_MODULE>
5874 <RESULT COUNT 2>
5875 (?is)\berror: \{ f1 := 1 \} is not a valid value for type `\@module1.myu1' which has subtype \(\{ f1 := 0 \},\{ f2 := "" \}\)
5876 <END_RESULT>
5877 <RESULT COUNT 1>
5878 (?is)\berror: Reference to non-existent field `interestingfieldreferencenotcheckedbutpossible' in type `\@module1.myu1'
5879 <END_RESULT>
5880 <RESULT COUNT 3>
5881 (?is)\berror:
5882 <END_RESULT>
5883 <END_TC>
5884 :exmp.
5885
5886 *---------------------------------------------------------------------*
5887 :h3.Adhoc:: Subtyping - Records
5888 .*---------------------------------------------------------------------*
5889 :xmp tab=0.
5890 <TC - Subtyping - Records>
5891 <COMPILE>
5892 <VERDICT_LEAF PASS>
5893 <MODULE TTCN module1 module1.ttcn>
5894 module module1
5895 {
5896 type record myr1 {
5897 integer f1,
5898 charstring f2
5899 }
5900 type integer myi1 (11, 22, 33)
5901 type myr1 myr2 ({0, ""}, {0, " "})
5902 type myr1 myr3 ({0.0, ""})
5903 type myr1 myr4 (myr1, myr3)
5904 type myr2 myr5 (myr2, myr2, {0, ""}, {0, ""})
5905 type record myr6 {
5906 integer f1 (1, 2, 3),
5907 charstring f2 length(3)
5908 }
5909
5910 // Only the constants are checked regarding subtypes.
5911 const myr2 c_myr1 := {1, ""}
5912 const myr4 c_myr2 := {1, ""}
5913
5914 template myr2 t_myr1 := {1, ""}
5915 template myr4 t_myr2 := {1, ""}
5916 template myr6 t_myr3(in myi1 p1) := {p1, "abc"}
5917
5918 function fr1() return myr2 { return {0, "1"} }
5919 function fr2(in myr2 p1 := {0, "1"}) { }
5920
5921 control {
5922 var template myr2 vt_myr1 := {1, ""}
5923 var template myr5 vt_myr2 := {1, "1"} // No error. Why?
5924 var myr2 v_myr1 := {1, ""}
5925 var myr5 v_myr2 := {1, "1"} // It's an error for all non-templates.
5926 var myr6 v_myr3 := {1, "abcdefghijk"}
5927 if (valueof(vt_myr1) == valueof(vt_myr2)) { }
5928 if (v_myr1 == v_myr2) { }
5929 }
5930 }
5931 <END_MODULE>
5932 <RESULT COUNT 1>
5933 (?is)\berror: integer value was expected
5934 <END_RESULT>
5935 <RESULT COUNT 1>
5936 (?is)\berror: Type referenced by `myr1' does not have a subtype
5937 <END_RESULT>
5938 <RESULT COUNT 1>
5939 (?is)\berror: \{ f1 := 1, f2 := "1" \} is not a valid value for type `\@module1.myr1' which has subtype \(\{ f1 := 0, f2 := "" \},\{ f1 := 0, f2 := " " \}\)
5940 <END_RESULT>
5941 <RESULT COUNT 2>
5942 (?is)\berror: \{ f1 := 1, f2 := "" \} is not a valid value for type `\@module1.myr1' which has subtype \(\{ f1 := 0, f2 := "" \},\{ f1 := 0, f2 := " " \}\)
5943 <END_RESULT>
5944 <RESULT COUNT 2>
5945 (?is)\berror: \{ f1 := 0, f2 := "1" \} is not a valid value for type `\@module1.myr1' which has subtype \(\{ f1 := 0, f2 := "" \},\{ f1 := 0, f2 := " " \}\)
5946 <END_RESULT>
5947 <RESULT COUNT 1>
5948 (?is)\berror: Subtype mismatch: subtype \(1..3\) has no common value with subtype \(11,22,33\)
5949 <END_RESULT>
5950 <RESULT COUNT 1>
5951 (?is)\berror: \"abcdefghijk\" is not a valid value for type `charstring' which has subtype length\(3\)
5952 <END_RESULT>
5953 <RESULT COUNT 9>
5954 (?is)\berror:
5955 <END_RESULT>
5956 <END_TC>
5957 :exmp.
5958
5959 *---------------------------------------------------------------------*
5960 :h3.Adhoc:: Subtyping - Sets
5961 .*---------------------------------------------------------------------*
5962 :xmp tab=0.
5963 <TC - Subtyping - Sets>
5964 <COMPILE>
5965 <VERDICT_LEAF PASS>
5966 <MODULE TTCN module1 module1.ttcn>
5967 module module1
5968 {
5969 type set mys1 {
5970 integer f1,
5971 charstring f2
5972 }
5973 type integer myi1 (11, 22, 33)
5974 type mys1 mys2 ({f1 := 0, f2 := ""}, {f1 := 0, f2 := " "})
5975 type set mys3 {
5976 integer f1 (1, 2, 3),
5977 charstring f2 length(3)
5978 }
5979 type mys1 myr4 (mys2)
5980 type mys2 mys5 (mys2, mys2, {f1 := 0, f2 := ""}, {f1 := 0, f2 := ""})
5981
5982 const mys2 c_mys1 := {f1 := 1, f2 := ""}
5983 const myr4 c_mys2 := {f1 := c_mys1.f1, f2 := c_mys1.f2}
5984 const mys5 c_mys3 := {f1 := 1, f2 := ""}
5985
5986 template mys2 t_mys1 := {f1 := 1, f2 := ""}
5987 template mys3 t_mys2(in myi1 p1) := {f1 := p1, f2 := "abc"}
5988 template mys3 t_mys3(in integer p1) modifies t_mys2 := {f1 := 100}
5989
5990 control {
5991 var template mys2 vt_mys1 := {f1 := 1, f2 := ""}
5992 var mys2 v_mys1 := {f1 := 1, f2 := ""}
5993 var mys3 v_mys2 := {f1 := 1, f2 := "itstoolong"}
5994 v_mys2.f1 := 100
5995 v_mys2.f2 := "itstoolong"
5996 // `if (v_mys1 == v_mys2) { }' should be an error in both runtimes.
5997 // Currently, there is no error from the function-test runtime.
5998 }
5999 }
6000 <END_MODULE>
6001 <RESULT COUNT 4>
6002 (?is)\berror: \{ f1 := 1, f2 := "" \} is not a valid value for type `\@module1.mys1' which has subtype \(\{ f1 := 0, f2 := "" \},\{ f1 := 0, f2 := " " \}\)
6003 <END_RESULT>
6004 <RESULT COUNT 1>
6005 (?is)\berror: Subtype mismatch: subtype \(1..3\) has no common value with subtype \(11,22,33\)
6006 <END_RESULT>
6007 <RESULT COUNT 2>
6008 (?is)\berror: \"itstoolong\" is not a valid value for type `charstring' which has subtype length\(3\)
6009 <END_RESULT>
6010 <RESULT COUNT 2>
6011 (?is)\berror: 100 is not a valid value for type `integer' which has subtype \(1..3\)
6012 <END_RESULT>
6013 <RESULT COUNT 9>
6014 (?is)\berror:
6015 <END_RESULT>
6016 <END_TC>
6017 :exmp.
6018
6019 *---------------------------------------------------------------------*
6020 :h3.Adhoc:: Subtyping - Recordofs
6021 .*---------------------------------------------------------------------*
6022 :xmp tab=0.
6023 <TC - Subtyping - Recordofs>
6024 <COMPILE>
6025 <VERDICT_LEAF PASS>
6026 <MODULE TTCN module1 module1.ttcn>
6027 module module1
6028 {
6029 type record length(1) of integer myro1
6030 type record length(4..8) of integer myro2
6031 type record length(5) of record length(5) of record length(5) of record length(5) of integer myro3
6032 type myro3 myro4 ({1}, {2})
6033 type myro1 myro5 (myro1, {1, 2})
6034 type myro1 myro6 (myro1, myro1, {1}, {1}, {2}, {2})
6035 type myro5 myro7 ({1}) // No error for erroneous parent type.
6036 type myro7 myro8 (myro2)
6037
6038 const myro1 c_myro1 := {0, 1}
6039 const myro2 c_myro2 := {0, 1}
6040 const myro6 c_myro3 := {c_myro1[0]}
6041
6042 template myro1 t_myro1 := {0, 1}
6043 template myro2 t_myro2 := {0, 1}
6044 template myro6 t_myro3 := {0}
6045
6046 modulepar myro1 mp1 := {0, 1}
6047 modulepar myro2 mp2 := {0, 1}
6048 modulepar myro6 mp3 := {}
6049
6050 function fro1() return myro1 { return {0, 1} }
6051 function fro2(in myro1 p1 := {0, 1}) { }
6052
6053 control {
6054 var template myro1 vt_myro1 := {0, 1}
6055 var template myro2 vt_myro2 := {0, 1}
6056 var myro1 v_myro1 := {0, 1}
6057 var myro2 v_myro2 := {0, 1}
6058 if (valueof(vt_myro1) == valueof(vt_myro2)) { }
6059 if (v_myro1 == v_myro2) { }
6060 if (match(fro1(), t_myro2)) { }
6061 }
6062 }
6063 <END_MODULE>
6064 <RESULT COUNT 1>
6065 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ 1, 2 \}\) union length\(1\) is not subset of subtype length\(1\)
6066 <END_RESULT>
6067 <RESULT COUNT 2>
6068 (?is)\berror: There must not be more than 1 elements in the list
6069 <END_RESULT>
6070 <RESULT COUNT 5>
6071 (?is)\berror: \{ 0, 1 \} is not a valid value for type `\@module1.myro1' which has subtype length\(1\)
6072 <END_RESULT>
6073 <RESULT COUNT 3>
6074 (?is)\berror: \{ 0, 1 \} is not a valid value for type `\@module1.myro2' which has subtype length\(4..8\)
6075 <END_RESULT>
6076 <RESULT COUNT 2>
6077 (?is)\berror: At least 4 elements must be present in the list
6078 <END_RESULT>
6079 <RESULT COUNT 1>
6080 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ <erroneous> \},\{ <erroneous> \}\) is not subset of subtype length\(5\)
6081 <END_RESULT>
6082 <RESULT COUNT 2>
6083 (?is)\berror: record of value was expected
6084 <END_RESULT>
6085 <RESULT COUNT 1>
6086 (?is)\berror: \{ \} is not a valid value for type `\@module1.myro1' which has subtype length\(1\)
6087 <END_RESULT>
6088 <RESULT COUNT 3>
6089 (?is)\berror: Type mismatch: `\@module1.myro1' and `\@module1.myro2' are not compatible: Incompatible record of/SEQUENCE OF subtypes
6090 <END_RESULT>
6091 <RESULT COUNT 1>
6092 (?is)\berror: Reference `myro2' must refer to a type which has the same root type as this type
6093 <END_RESULT>
6094 <RESULT COUNT 21>
6095 (?is)\berror:
6096 <END_RESULT>
6097 <END_TC>
6098 :exmp.
6099
6100 *---------------------------------------------------------------------*
6101 :h3.Adhoc:: Subtyping - Setofs
6102 .*---------------------------------------------------------------------*
6103 :xmp tab=0.
6104 <TC - Subtyping - Setofs>
6105 <COMPILE>
6106 <VERDICT_LEAF PASS>
6107 <MODULE TTCN module1 module1.ttcn>
6108 module module1
6109 {
6110 type set length(1) of integer myso1
6111 type set length(4..8) of integer myso2
6112 type set of integer myso3 (myso1, myso2)
6113 type myso1 myso4 (myso1, {1, 2})
6114 type myso1 myso5 (myso1, myso1, {1}, {1}, {2}, {2})
6115 type myso4 myso6 ({1}) // No error for erroneous parent type.
6116 type myso6 myso7 (myso2)
6117
6118 template myso1 t_myso1 := {0, 1}
6119 template myso2 t_myso2 := {0, 1}
6120 template myso5 t_myso3 := {0}
6121
6122 const myso1 c_myso1 := {0, 1}
6123 const myso2 c_myso2 := {0, 1}
6124 const myso5 c_myso3 := {c_myso1[0]}
6125
6126 modulepar myso1 mp1 := {0, 1}
6127 modulepar myso2 mp2 := {0, 1}
6128 modulepar myso5 mp3 := {}
6129
6130 function fso1() return myso1 { return {0, 1} }
6131 function fso2(in myso1 p1 := {0, 1}) { }
6132
6133 control {
6134 var template myso1 vt_myso1 := {0, 1}
6135 var template myso2 vt_myso2 := {0, 1}
6136 var myso1 v_myso1 := {0, 1}
6137 var myso2 v_myso2 := {0, 1}
6138 if (valueof(vt_myso1) == valueof(vt_myso2)) { }
6139 if (v_myso1 == v_myso2) { }
6140 if (match(fso1(), t_myso2)) { }
6141 }
6142 }
6143 <END_MODULE>
6144 <RESULT COUNT 1>
6145 (?is)\berror: Reference `myso1' must refer to a type which has the same root type as this type
6146 <END_RESULT>
6147 <RESULT COUNT 2>
6148 (?is)\berror: Reference `myso2' must refer to a type which has the same root type as this type
6149 <END_RESULT>
6150 <RESULT COUNT 1>
6151 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ 1, 2 \}\) union length\(1\) is not subset of subtype length\(1\)
6152 <END_RESULT>
6153 <RESULT COUNT 2>
6154 (?is)\berror: There must not be more than 1 elements in the list
6155 <END_RESULT>
6156 <RESULT COUNT 5>
6157 (?is)\berror: \{ 0, 1 \} is not a valid value for type `\@module1.myso1' which has subtype length\(1\)
6158 <END_RESULT>
6159 <RESULT COUNT 2>
6160 (?is)\berror: At least 4 elements must be present in the list
6161 <END_RESULT>
6162 <RESULT COUNT 3>
6163 (?is)\berror: \{ 0, 1 \} is not a valid value for type `\@module1.myso2' which has subtype length\(4..8\)
6164 <END_RESULT>
6165 <RESULT COUNT 1>
6166 (?is)\berror: \{ \} is not a valid value for type `\@module1.myso1' which has subtype length\(1\)
6167 <END_RESULT>
6168 <RESULT COUNT 3>
6169 (?is)\berror: Type mismatch: `\@module1.myso1' and `\@module1.myso2' are not compatible: Incompatible set of/SET OF subtypes
6170 <END_RESULT>
6171 <RESULT COUNT 20>
6172 (?is)\berror:
6173 <END_RESULT>
6174 <END_TC>
6175 :exmp.
6176
6177 *---------------------------------------------------------------------*
6178 :h3.Adhoc:: Subtyping - Arrays
6179 .*---------------------------------------------------------------------*
6180 :xmp tab=0.
6181 <TC - Subtyping - Arrays>
6182 <COMPILE>
6183 <VERDICT_LEAF PASS>
6184 <MODULE TTCN module1 module1.ttcn>
6185 module module1
6186 {
6187 // The length subtyping is not for `integer', it's an `integer[1]' array.
6188 type integer mya1[1] length(2)
6189 type mya1 mya2 (0, 1)
6190 type mya1 mya3 ({0, 1}, {2, 3})
6191 type mya3 mya4 (mya1, mya2, mya3)
6192
6193 template mya1 t_mya1 := {2}
6194 template mya3 t_mya2 := {2, 3}
6195
6196 const mya1 c_mya1 := {2}
6197 const mya3 c_mya2 := {c_mya1[0], 3}
6198 const mya1 c_mya3[1] := {c_mya1} // Shouldn't be allowed.
6199
6200 control {
6201 var template mya1 vt_mya1 := {2}
6202 var template mya3 vt_mya2 := {vt_mya1[0], 3}
6203 var template mya1 vt_mya3[1] := {vt_mya1} // Shouldn't be allowed.
6204 var mya1 v_mya1 := {2}
6205 var mya3 v_mya2 := {2, 3}
6206 var mya1 v_mya3[1] := {v_mya1} // Shouldn't be allowed.
6207 if (valueof(vt_mya1) == valueof(vt_mya2)) { }
6208 if (v_mya1 == v_mya2) { }
6209 }
6210 }
6211 <END_MODULE>
6212 <RESULT COUNT 1>
6213 (?is)\berror: Length subtyping is not allowed for type `integer'
6214 <END_RESULT>
6215 <RESULT COUNT 3>
6216 (?is)\berror: Subtype constraints are not applicable to type `integer\[1\]'
6217 <END_RESULT>
6218 <RESULT COUNT 2>
6219 (?is)\berror: Too many elements in the array value: 1 was expected instead of 2
6220 <END_RESULT>
6221 <RESULT COUNT 8>
6222 (?is)\berror:
6223 <END_RESULT>
6224 <END_TC>
6225 :exmp.
6226
6227
6228 *---------------------------------------------------------------------*
6229 :h3.Adhoc:: Special float values
6230 .*---------------------------------------------------------------------*
6231 :xmp tab=0.
6232 <TC - Special float values>
6233 <COMPILE>
6234 <VERDICT_LEAF PASS>
6235 <MODULE TTCN module1 module1.ttcn>
6236 module module1
6237 {
6238 const float cf_pinf := infinity;
6239 const float cf_minf := -infinity;
6240 const float cf_nan := not_a_number;
6241
6242 type float MyFlt (-infinity..infinity);
6243 type float MyFlt2 (not_a_number);
6244
6245 control {
6246 var MyFlt vf1;
6247 var MyFlt2 vf2;
6248 vf1 := not_a_number;
6249 vf2 := 1.0;
6250 vf2 := vf1;
6251 }
6252 }
6253 <END_MODULE>
6254 <RESULT COUNT 1>
6255 (?is)\berror: NaN is not a valid value for type `float' which has subtype \(-INF..INF\)
6256 <END_RESULT>
6257 <RESULT COUNT 1>
6258 (?is)\berror: 1.0e0 is not a valid value for type `float' which has subtype \(NaN\)
6259 <END_RESULT>
6260 <RESULT COUNT 1>
6261 (?is)\berror: Subtype mismatch: subtype \(NaN\) has no common value with subtype \(-INF..INF\)
6262 <END_RESULT>
6263 <RESULT COUNT 3>
6264 (?is)\berror:
6265 <END_RESULT>
6266 <END_TC>
6267 :exmp.
6268
6269
6270 *---------------------------------------------------------------------*
6271 :h3.Adhoc:: Exclusive ranges - integer type
6272 .*---------------------------------------------------------------------*
6273 :xmp tab=0.
6274 <TC - Exclusive ranges - integer type>
6275 <COMPILE>
6276 <VERDICT_LEAF PASS>
6277 <MODULE TTCN module1 module1.ttcn>
6278 module module1
6279 {
6280 type integer MyInt1 (!-infinity..!10);
6281 type integer MyInt2 (!-10..!infinity);
6282 type integer MyInt3 (!1..!2);
6283 type integer MyInt4 (!1..!10,!10..!20);
6284 const MyInt4 c_myint4 := 10;
6285 type MyInt4 MyInt5 (2..19);
6286 type integer MyInt6 (MyInt4,10);
6287 const MyInt6 c_myint6a := 10;
6288 const MyInt6 c_myint6b := 20;
6289 }
6290 <END_MODULE>
6291 <RESULT COUNT 1>
6292 (?is)\berror: invalid lower boundary, -infinity cannot be excluded from an integer subtype range
6293 <END_RESULT>
6294 <RESULT COUNT 1>
6295 (?is)\berror: invalid upper boundary, infinity cannot be excluded from an integer subtype range
6296 <END_RESULT>
6297 <RESULT COUNT 1>
6298 (?is)\berror: lower boundary is bigger than upper boundary in integer subtype range
6299 <END_RESULT>
6300 <RESULT COUNT 1>
6301 (?is)\berror: 10 is not a valid value for type `integer' which has subtype \(2..9,11..19\)
6302 <END_RESULT>
6303 <RESULT COUNT 1>
6304 (?is)\berror: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(2..19\) is not subset of subtype \(2..9,11..19\)
6305 <END_RESULT>
6306 <RESULT COUNT 1>
6307 (?is)\berror: 20 is not a valid value for type `integer' which has subtype \(2..19\)
6308 <END_RESULT>
6309 <RESULT COUNT 6>
6310 (?is)\berror:
6311 <END_RESULT>
6312 <END_TC>
6313 :exmp.
6314
6315
6316 *---------------------------------------------------------------------*
6317 :h3.Adhoc:: Exclusive ranges - float type
6318 .*---------------------------------------------------------------------*
6319 :xmp tab=0.
6320 <TC - Exclusive ranges - float type>
6321 <COMPILE>
6322 <VERDICT_LEAF PASS>
6323 <MODULE TTCN module1 module1.ttcn>
6324 module module1
6325 {
6326 type float MyFlt1 (!-infinity..!-infinity);
6327 type float MyFlt2 (!infinity..!infinity);
6328 type float MyFlt3 (not_a_number..!infinity);
6329 type float MyFlt4 (!-infinity..!infinity);
6330 const MyFlt4 c_myflt4a := -infinity;
6331 const MyFlt4 c_myflt4b := infinity;
6332 const MyFlt4 c_myflt4c := not_a_number;
6333 type float MyFlt5 (MyFlt4, -infinity, infinity, not_a_number);
6334 type float MyFlt6 (-infinity..!0.0,!0.0..infinity);
6335 const MyFlt6 c_myflt6 := 0.0;
6336 }
6337 <END_MODULE>
6338 <RESULT COUNT 1>
6339 (?is)\berror: !-infinity is not a valid upper boundary
6340 <END_RESULT>
6341 <RESULT COUNT 1>
6342 (?is)\berror: !infinity is not a valid lower boundary
6343 <END_RESULT>
6344 <RESULT COUNT 1>
6345 (?is)\berror: lower boundary cannot be not_a_number in float subtype range
6346 <END_RESULT>
6347 <RESULT COUNT 1>
6348 (?is)\berror: -INF is not a valid value for type `float' which has subtype \(!-INF..!INF\)
6349 <END_RESULT>
6350 <RESULT COUNT 1>
6351 (?is)\berror: INF is not a valid value for type `float' which has subtype \(!-INF..!INF\)
6352 <END_RESULT>
6353 <RESULT COUNT 1>
6354 (?is)\berror: NaN is not a valid value for type `float' which has subtype \(!-INF..!INF\)
6355 <END_RESULT>
6356 <RESULT COUNT 1>
6357 (?is)\bwarning: The subtype of type `float' is a full set, it does not constrain the root type.
6358 <END_RESULT>
6359 <RESULT COUNT 1>
6360 (?is)\berror: 0.0e0 is not a valid value for type `float' which has subtype \(-INF..!0.0e0,!0.0e0..INF\)
6361 <END_RESULT>
6362 <RESULT COUNT 7>
6363 (?is)\berror:
6364 <END_RESULT>
6365 <END_TC>
6366 :exmp.
6367
6368
6369 *---------------------------------------------------------------------*
6370 :h3.Adhoc:: Exclusive ranges - charstring type
6371 .*---------------------------------------------------------------------*
6372 :xmp tab=0.
6373 <TC - Exclusive ranges - charstring type>
6374 <COMPILE>
6375 <VERDICT_LEAF PASS>
6376 <MODULE TTCN module1 module1.ttcn>
6377 module module1
6378 {
6379 type charstring MyStr1 (!"a".."a");
6380 type charstring MyStr2 (!"a"..!"b");
6381 type charstring MyStr3 (!"a"..!"c",!"c"..!"z");
6382 const MyStr3 c_mystr3 := "c";
6383 type charstring MyStr4 ("c".."c",!"0".."9");
6384 type charstring MyStr5 (MyStr3, MyStr4);
6385 const MyStr5 c_mystr5a := "c";
6386 const MyStr5 c_mystr5b := "0";
6387 }
6388 <END_MODULE>
6389 <RESULT COUNT 2>
6390 (?is)\berror: lower boundary is bigger than upper boundary in charstring subtype range
6391 <END_RESULT>
6392 <RESULT COUNT 1>
6393 (?is)\berror: "c" is not a valid value for type `charstring' which has subtype from\("b","d".."y"\)
6394 <END_RESULT>
6395 <RESULT COUNT 1>
6396 (?is)\berror: "0" is not a valid value for type `charstring' which has subtype \(from\("b","d".."y"\) union from\("1".."9","c"\)\)
6397 <END_RESULT>
6398 <RESULT COUNT 4>
6399 (?is)\berror:
6400 <END_RESULT>
6401 <END_TC>
6402 :exmp.
6403
6404 *---------------------------------------------------------------------*
6405 :h3.Adhoc:: invalid syntax - equality followed by negation
6406 .*---------------------------------------------------------------------*
6407 :xmp tab=0.
6408 <TC - invalid syntax - equality followed by negation>
6409 <COMPILE>
6410 <VERDICT_LEAF PASS>
6411 <MODULE TTCN module1 module1.ttcn>
6412 module module1
6413 {
6414 function X() {
6415 var boolean x,y;
6416 if (x != not y) {}
6417 }
6418 }
6419 <END_MODULE>
6420 <RESULT COUNT 1>
6421 (?is)\berror: The operation `not' is not allowed to be the second operand of operation `!='
6422 <END_RESULT>
6423 <END_TC>
6424 :exmp.
6425
6426 .*---------------------------------------------------------------------*
6427 :h3.Adhoc:: special float values
6428 .*---------------------------------------------------------------------*
6429 :xmp tab=0.
6430 <TC - special float values>
6431 <COMPILE>
6432 <VERDICT_LEAF PASS>
6433 <MODULE TTCN x x.ttcn>
6434 module x {
6435 const float a := infinity;
6436 const float b := not_a_number;
6437 const float c := 0.0 / b;
6438 control {
6439 var float d := rnd( a );
6440 var float e := rnd( b );
6441 timer t1 := a;
6442 timer t2 := b;
6443 }
6444 }
6445 <END_MODULE>
6446 <RESULT IF_PASS COUNT 1>
6447 (?im)error: Second operand of operation `/' cannot be NaN, it must be a numeric value
6448 <END_RESULT>
6449 <RESULT IF_PASS COUNT 1>
6450 (?im)error: The operand of operation `rnd \(seed\)' cannot be INF, it must be a numeric value
6451 <END_RESULT>
6452 <RESULT IF_PASS COUNT 1>
6453 (?im)error: The operand of operation `rnd \(seed\)' cannot be NaN, it must be a numeric value
6454 <END_RESULT>
6455 <RESULT IF_PASS COUNT 1>
6456 (?im)error: A non-negative float value was expected as timer duration instead of `INF'
6457 <END_RESULT>
6458 <RESULT IF_PASS COUNT 1>
6459 (?im)error: A non-negative float value was expected as timer duration instead of `NaN'
6460 <END_RESULT>
6461 <RESULT IF_PASS COUNT 5>
6462 (?is)\berror:
6463 <END_RESULT>
6464 <END_TC>
6465 :exmp.
6466
6467
6468 .*---------------------------------------------------------------------*
6469 :h3.Adhoc:: template restrictions (TR: HL77646)
6470 .*---------------------------------------------------------------------*
6471 :xmp tab=0.
6472 <TC - template restrictions (TR: HL77646)>
6473 <EXECUTE>
6474 <VERDICT_LEAF PASS>
6475 <MODULE TTCN Temp Temp.ttcn>
6476 module Temp {
6477 type record of integer MyRecOfInt;
6478 template(value) integer t_MyInt := 1
6479 template(value) MyRecOfInt t_MyRecOfInt := {[2]:= t_MyInt }
6480 type record R
6481 {
6482 integer i,
6483 integer o optional,
6484 ROF rof
6485 }
6486 type record of C ROF;
6487 type union C
6488 {
6489 integer i,
6490 boolean b
6491 }
6492 control
6493 {
6494 var template(value) R tr1;
6495 var template R tr2 := { 1, omit, { {b:=true}, {i:=1}, {b:=(true,false)} } }
6496 tr1 := tr2;
6497 }
6498 }
6499 <END_MODULE>
6500 <MODULE CFG Temp Temp.cfg>
6501 [MODULE_PARAMETERS]
6502 [LOGGING]
6503 LogSourceInfo := Yes
6504 Logfile := "Temp%i.log"
6505 LogFileSize := 10
6506 LogFileNumber := 10
6507 DiskFullAction := error
6508 FileMask := LOG_ALL
6509 ConsoleMask := WARNING | ERROR | TESTCASE | STATISTICS
6510 [EXECUTE]
6511 Temp
6512 <END_MODULE>
6513 <RESULT IF_PASS>
6514 (?im)warning: Inadequate restriction on the referenced template variable `tr2', this may cause a dynamic test case error at runtime
6515 <END_RESULT>
6516 <RESULT IF_PASS COUNT 1>
6517 (?im)Dynamic test case error: Restriction `value' on template of type @Temp.R violated.
6518 <END_RESULT>
6519
6520 <END_TC>
6521 :exmp.
6522
6523
6524 .*---------------------------------------------------------------------*
6525 :h3.Adhoc:: template restrictions (TR: HL77646) 2
6526 .*---------------------------------------------------------------------*
6527 :xmp tab=0.
6528 <TC - template restrictions (TR: HL77646) 2>
6529 <EXECUTE>
6530 <VERDICT_LEAF PASS>
6531 <MODULE TTCN Temp Temp.ttcn>
6532 module Temp {
6533 type record R {}
6534 type record of R ROF;
6535 type record of R ROF2;
6536 type union C
6537 {
6538 integer i,
6539 ROF r
6540 }
6541 control
6542 {
6543 var template(value) C t1;
6544 var template(present) C t2 := { r := { [2] := {} } }
6545 t1 := t2;
6546 var template(value) ROF2 t11;
6547 var template(present) ROF2 t21 := { {}, ({},{}) }
6548 t11 := t21;
6549 }
6550 }
6551 <END_MODULE>
6552 <MODULE CFG Temp Temp.cfg>
6553 [MODULE_PARAMETERS]
6554 [LOGGING]
6555 LogSourceInfo := Yes
6556 Logfile := "Temp%i.log"
6557 LogFileSize := 10
6558 LogFileNumber := 10
6559 DiskFullAction := error
6560 FileMask := LOG_ALL
6561 ConsoleMask := WARNING | ERROR | TESTCASE | STATISTICS
6562 [EXECUTE]
6563 Temp
6564 <END_MODULE>
6565 <RESULT IF_PASS>
6566 (?im)warning: Inadequate restriction on the referenced template variable `.+', this may cause a dynamic test case error at runtime
6567 <END_RESULT>
6568 <RESULT IF_PASS COUNT 1>
6569 (?im)Dynamic test case error: Restriction `value' on template of type @Temp.ROF2 violated.
6570 <END_RESULT>
6571
6572 <END_TC>
6573 :exmp.
6574
6575 .*---------------------------------------------------------------------*
6576 :h3.Adhoc:: constant parameter in decvalue function
6577 .*---------------------------------------------------------------------*
6578 :xmp tab=0.
6579 <TC - constant parameter in decvalue function>
6580 <COMPILE>
6581 <VERDICT_LEAF PASS>
6582 <MODULE TTCN x x.ttcn>
6583 module x {
6584 type integer myint with {encode "RAW"}
6585 type record R {
6586 myint i
6587 } with {encode "XML"};
6588
6589 const bitstring c_bs0 := ''B;
6590
6591 control {
6592 var R v_r;
6593 var integer ret := decvalue(c_bs0, v_r);
6594 }
6595
6596 }
6597 <END_MODULE>
6598 <RESULT IF_PASS COUNT 1>
6599 (?im)error: Reference to 'constant' cannot be used as the first operand of the 'decvalue' operation
6600 <END_RESULT>
6601 <RESULT IF_PASS COUNT 1>
6602 (?is)\berror:
6603 <END_RESULT>
6604 <END_TC>
6605 :exmp.
6606
6607 .*---------------------------------------------------------------------*
6608 :h3.Adhoc:: extra checks for decvalue (HM59355)
6609 .*---------------------------------------------------------------------*
6610 :xmp tab=0.
6611 <TC - extra checks for decvalue (HM59355)>
6612 <COMPILE>
6613 <VERDICT_LEAF PASS>
6614 <MODULE TTCN x x.ttcn>
6615 module x {
6616 type record MyEmptyRecord { } with { encode "XML" }
6617 control {
6618 var bitstring s
6619 var integer i
6620 var template MyEmptyRecord t
6621 i := decvalue(s, MyEmptyRecord)
6622 // Original error: expected unqualified-id before '.' token
6623 i := decvalue(s, t)
6624 // Original error: 'class x::MyEmptyRecord_template' has no member named 'decode'
6625 }
6626 }
6627 <END_MODULE>
6628 <RESULT IF_PASS COUNT 1>
6629 (?im)error: Reference to 'type' cannot be used.
6630 <END_RESULT>
6631 <RESULT IF_PASS COUNT 1>
6632 (?im)error: Reference to 'template variable' cannot be used.
6633 <END_RESULT>
6634 <RESULT IF_PASS COUNT 2>
6635 (?is)\berror:
6636 <END_RESULT>
6637 <END_TC>
6638 :exmp.
6639
6640 .*---------------------------------------------------------------------*
6641 :h3.Adhoc:: SIGSEGV on missing modules (HM62166)
6642 .*---------------------------------------------------------------------*
6643 :xmp tab=0.
6644 <TC - SIGSEGV on missing modules (HM62166)>
6645 <COMPILE>
6646 <VERDICT_LEAF PASS>
6647 <MODULE TTCN x x.asn>
6648 Example DEFINITIONS ::= BEGIN
6649 IMPORTS
6650 X FROM Y
6651 MyType FROM Z {itu-t(0)};
6652 EXTENSION ::= CLASS {&id Code}
6653 myExtension EXTENSION ::= {IDENTIFIED BY global : {itu-t(0)}}
6654 END
6655 <END_MODULE>
6656 <RESULT IF_PASS COUNT 1>
6657 (?im)error: There is no module with identifier \`Y\'
6658 <END_RESULT>
6659 <RESULT IF_PASS COUNT 1>
6660 (?im)error: There is no module with identifier \`Z\'
6661 <END_RESULT>
6662 <RESULT IF_PASS COUNT 1>
6663 (?im)error: There is no assignment or imported symbol with name \`Code\' in module \`Example\'
6664 <END_RESULT>
6665 <RESULT IF_PASS COUNT 1>
6666 (?im)error: Cannot recognize fieldspec
6667 <END_RESULT>
6668 <RESULT IF_PASS COUNT 1>
6669 (?im)error: Unexpected \`\<upperidentifier\>\'
6670 <END_RESULT>
6671 <RESULT IF_PASS COUNT 1>
6672 (?im)error: Superfluous part detected
6673 <END_RESULT>
6674 <RESULT IF_PASS COUNT 1>
6675 (?im)error: Check the syntax of objectclass \(consider using debug messages\)
6676 <END_RESULT>
6677 <RESULT IF_PASS COUNT 7>
6678 (?is)\berror:
6679 <END_RESULT>
6680 <END_TC>
6681 :exmp.
6682
6683 *---------------------------------------------------------------------*
6684 :h3.Adhoc:: Subtyping - Octetstring TR (TR:?)
6685 .*---------------------------------------------------------------------*
6686 :xmp tab=0.
6687 <TC - Subtyping - Octetstring TR (TR:?)>
6688 <COMPILE>
6689 <VERDICT_LEAF PASS>
6690 <MODULE TTCN module1 module1.ttcn>
6691 module module1
6692 {
6693 const octetstring c_PcapMagic_LittleEndian := 'd4c3b2a1'O;
6694 const octetstring c_PcapMagic_BigEndian := 'a1b2c3d4'O;
6695 type octetstring PcapMagic1 ('d4c3b2a1'O, 'a1b2c3d4'O);
6696 type octetstring PcapMagic2 (c_PcapMagic_BigEndian, c_PcapMagic_LittleEndian);
6697
6698 control {}
6699 }
6700 <END_MODULE>
6701 <RESULT COUNT 0>
6702 (?is)\berror:
6703 <END_RESULT>
6704 <END_TC>
6705 :exmp.
6706
6707 *---------------------------------------------------------------------*
6708 :h3.Adhoc:: Subtyping - String indexing (TR:?)
6709 .*---------------------------------------------------------------------*
6710 :xmp tab=0.
6711 <TC - Subtyping - String indexing (TR:?)>
6712 <COMPILE>
6713 <VERDICT_LEAF PASS>
6714 <MODULE TTCN module1 module1.ttcn>
6715 module module1
6716 {
6717 type octetstring OCT1 length(1);
6718 type octetstring OCT2 length(2);
6719
6720 const OCT2 long_octet := '0102'O;
6721 const OCT1 short_octet := long_octet[0];
6722
6723 type port myport message { inout OCT1; } with { extension "internal" };
6724 type port myport2 message { inout OCT2; } with { extension "internal" };
6725 type component mycomp {
6726 port myport p;
6727 port myport2 p2;
6728 };
6729
6730 function myfunc() runs on mycomp
6731 {
6732 var OCT1 o1;
6733 var OCT2 o2;
6734 p.receive(OCT1:?) -> value o2[0];
6735 p2.receive(OCT2:?) -> value o1;
6736 p2.receive(OCT2:?) -> value o2[0];
6737
6738 o1 := o2;
6739 o2 := o1;
6740
6741 o1 := o2[1];
6742 o2[0] := o1;
6743
6744 o2 := o2[2];
6745 o2[0] := o2;
6746
6747 o2 := myfunc12(o1,o2);
6748
6749 o2[0] := myfunc12(o1,o2);
6750
6751 o2[0] := o1[0];
6752
6753 o1[0] := myfunc12(o1,o2);
6754
6755 o1 := myfunc12(o2,o1);
6756 o1 := myfunc12in(o2,o1);
6757 o1 := myfunc12out(o2,o1);
6758 o2 := myfunc12(o1,o2);
6759 }
6760
6761 function myfunc12(inout OCT1 p_o1, inout OCT2 p_o2) return OCT1
6762 {
6763 return p_o2[0];
6764 }
6765
6766 function myfunc12in(in OCT1 p_o1, in OCT2 p_o2) return OCT1
6767 {
6768 return p_o2[0];
6769 }
6770
6771 function myfunc12out(out OCT1 p_o1, out OCT2 p_o2) return OCT1
6772 {
6773 return p_o2[0];
6774 }
6775
6776 function myfunc12err(inout OCT1 p_o1, inout OCT2 p_o2) return OCT2
6777 {
6778 return p_o2[0];
6779 }
6780
6781 control {
6782 var OCT2 o2 := 'BABE'O;
6783 var integer i := oct2int(o2[0]); // HQ38022
6784 }
6785 }
6786 <END_MODULE>
6787 <RESULT IF_PASS COUNT 3>
6788 (?im)error: Subtype mismatch: subtype length\(2\) has no common value with a string element
6789 <END_RESULT>
6790 <RESULT IF_PASS COUNT 7>
6791 (?im)error: Subtype mismatch: subtype length\(2\) has no common value with subtype length\(1\)
6792 <END_RESULT>
6793 <RESULT IF_PASS COUNT 4>
6794 (?im)error: Subtype mismatch: subtype length\(1\) has no common value with subtype length\(2\)
6795 <END_RESULT>
6796 <RESULT IF_PASS COUNT 1>
6797 (?im)error: Subtype mismatch: string element has no common value with subtype length\(2\)
6798 <END_RESULT>
6799 <RESULT IF_PASS COUNT 2>
6800 (?im)error: Reference to a string element of type `octetstring' cannot be used in this context
6801 <END_RESULT>
6802 <RESULT COUNT 17>
6803 (?is)\berror:
6804 <END_RESULT>
6805 <END_TC>
6806 :exmp.
6807
6808 *---------------------------------------------------------------------*
6809 :h3.Adhoc:: Subtyping - function references
6810 .*---------------------------------------------------------------------*
6811 :xmp tab=0.
6812 <TC - Subtyping - function references>
6813 <COMPILE>
6814 <VERDICT_LEAF PASS>
6815 <MODULE TTCN module1 module1.ttcn>
6816 module module1
6817 {
6818 type octetstring OCT1 length(1);
6819 type octetstring OCT2 length(2);
6820
6821 const OCT2 long_octet := '0102'O;
6822 const OCT1 short_octet := long_octet[0];
6823
6824 type function myfunctype(inout OCT2 p_o1, inout OCT1 p_o2) return OCT2
6825
6826 function myfunc(inout OCT1 p_o1, inout OCT2 p_o2) return OCT1
6827 {
6828 return p_o2[0];
6829 }
6830
6831 control {
6832 var myfunctype f := refers(myfunc);
6833 }
6834 }
6835 <END_MODULE>
6836 <RESULT IF_PASS COUNT 1>
6837 (?im)error: Subtype mismatch: subtype length\(2\) has no common value with subtype length\(1\)
6838 <END_RESULT>
6839 <RESULT IF_PASS COUNT 1>
6840 (?im)error: Subtype mismatch: subtype length\(1\) has no common value with subtype length\(2\)
6841 <END_RESULT>
6842 <RESULT IF_PASS COUNT 1>
6843 (?im)error: Return type subtype mismatch: subtype length\(2\) has no common value with subtype length\(1\)
6844 <END_RESULT>
6845 <RESULT COUNT 3>
6846 (?is)\berror:
6847 <END_RESULT>
6848 <END_TC>
6849 :exmp.
6850
6851 *---------------------------------------------------------------------*
6852 :h3.Adhoc:: Values - Valueof TR (TR:HM93087)
6853 .*---------------------------------------------------------------------*
6854 :xmp tab=0.
6855 <TC - Values - Valueof TR (TR:HM93087)>
6856 <COMPILE>
6857 <VERDICT_LEAF PASS>
6858 <MODULE TTCN module1 module1.ttcn>
6859 module module1
6860 {
6861 type record rec {
6862 integer f
6863 }
6864 control {
6865 if (valueof(rec:{1}) == {1}) { }
6866 }
6867 }
6868 <END_MODULE>
6869 <RESULT COUNT 0>
6870 (?is)\berror:
6871 <END_RESULT>
6872 <END_TC>
6873 :exmp.
6874
6875 *---------------------------------------------------------------------*
6876 :h3.Adhoc:: Recursion - recursion TR (TR:HM93170)
6877 .*---------------------------------------------------------------------*
6878 :xmp tab=0.
6879 <TC - Recursion - recursion TR (TR:HM93170)>
6880 <COMPILE>
6881 <VERDICT_LEAF PASS>
6882 <MODULE TTCN module1 module1.ttcn>
6883 module module1
6884 {
6885 type record recT {
6886 integer f1,
6887 float f2,
6888 charstring f3,
6889 integer f4,
6890 integer f5
6891 }
6892
6893 template recT temp1:= { f1:= temp2.f1, f2:= 1.1, f3:= "ERIXON", f4:= 1, f5:= temp1.f1 };
6894 template recT temp2:= { f1:= temp2.f4, f2:= 1.1, f3:= "ERIXON", f4:= temp1.f5, f5:= 2 };
6895
6896 }
6897 <END_MODULE>
6898 <RESULT IF_PASS COUNT 1>
6899 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.temp2.f4' -> `\@module1.temp1.f5' -> `\@module1.temp1.f1' -> `\@module1.temp2.f1' -> `\@module1.temp2.f4'
6900 <END_RESULT>
6901 <RESULT IF_PASS COUNT 1>
6902 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.temp1.f1' -> `\@module1.temp2.f1' -> `\@module1.temp2.f4' -> `\@module1.temp1.f5' -> `\@module1.temp1.f1'
6903 <END_RESULT>
6904 <RESULT IF_PASS COUNT 1>
6905 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.temp1.f5' -> `\@module1.temp1.f1' -> `\@module1.temp2.f1' -> `\@module1.temp2.f4' -> `\@module1.temp1.f5'
6906 <END_RESULT>
6907 <RESULT COUNT 3>
6908 (?is)\berror:
6909 <END_RESULT>
6910 <END_TC>
6911 :exmp.
6912
6913 *---------------------------------------------------------------------*
6914 :h3.Adhoc:: Recursion - union TR (TR:HM93077)
6915 .*---------------------------------------------------------------------*
6916 :xmp tab=0.
6917 <TC - Recursion - union TR (TR:HM93077)>
6918 <COMPILE>
6919 <VERDICT_LEAF PASS>
6920 <MODULE TTCN module1 module1.ttcn>
6921 module module1 {
6922 type union ValidUnion0 {
6923 integer i
6924 }
6925
6926 type union ValidUnion1 {
6927 ValidUnion1 u1,
6928 integer i,
6929 ValidUnion0 u2
6930 }
6931
6932 type union InvalidUnion0 {
6933 InvalidUnion0 u1
6934 }
6935
6936 type union InvalidUnion1 {
6937 InvalidUnion2 u1
6938 }
6939
6940 type union InvalidUnion2 {
6941 InvalidUnion1 u1
6942 }
6943
6944 type union InvalidUnion3 {
6945 InvalidUnion3 u1,
6946 InvalidUnion3 u2,
6947 InvalidUnion3 u3
6948 }
6949
6950 type union InvalidUnion4 {
6951 InvalidRecord0 r1
6952 }
6953
6954 type record InvalidRecord0 {
6955 InvalidRecord0 r1
6956 }
6957 }
6958 <END_MODULE>
6959 <RESULT IF_PASS COUNT 1>
6960 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidUnion0' -> `\@module1.InvalidUnion0.u1' -> `\@module1.InvalidUnion0'
6961 <END_RESULT>
6962 <RESULT IF_PASS COUNT 1>
6963 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidUnion2' -> `\@module1.InvalidUnion2.u1' -> `@\module1.InvalidUnion1' -> `\@module1.InvalidUnion1.u1' -> `\@module1.InvalidUnion2'
6964 <END_RESULT>
6965 <RESULT IF_PASS COUNT 1>
6966 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidUnion3' -> `\@module1.InvalidUnion3.u1' -> `\@module1.InvalidUnion3'
6967 <END_RESULT>
6968 <RESULT IF_PASS COUNT 1>
6969 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidUnion3' -> `\@module1.InvalidUnion3.u2' -> `\@module1.InvalidUnion3'
6970 <END_RESULT>
6971 <RESULT IF_PASS COUNT 1>
6972 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidUnion3' -> `\@module1.InvalidUnion3.u3' -> `\@module1.InvalidUnion3'
6973 <END_RESULT>
6974 <RESULT IF_PASS COUNT 1>
6975 (?is)\berror: While checking embedded recursions: Circular reference: `\@module1.InvalidRecord0' -> `\@module1.InvalidRecord0.r1' -> `\@module1.InvalidRecord0'
6976 <END_RESULT>
6977 <RESULT IF_PASS COUNT 1>
6978 (?im)\bnotify: Errors found in the input module. Code will not be generated.
6979 <END_RESULT>
6980 <END_TC>
6981 :exmp.
6982
6983 .*---------------------------------------------------------------------*
6984 :h3.Adhoc:: Negative testing semantic check error messages
6985 .*---------------------------------------------------------------------*
6986 :xmp tab=0.
6987 <TC - Negative testing semantic check error messages>
6988 <COMPILE>
6989 <VERDICT_LEAF PASS>
6990 <MODULE ASN Virag Virag.asn>
6991 Virag DEFINITIONS ::=
6992 BEGIN
6993 IMPORTS ;
6994 MySeqOf ::= SEQUENCE OF INTEGER
6995 MySeq ::= SEQUENCE {
6996 i INTEGER,
6997 b BOOLEAN
6998 }
6999 MyUnion ::= CHOICE {
7000 i INTEGER,
7001 b BOOLEAN,
7002 s MySeq
7003 }
7004 MyCharstring1 ::= VisibleString
7005 MyCharstring2 ::= IA5String
7006 END
7007 <END_MODULE>
7008
7009 <MODULE TTCN virag virag.ttcn>
7010 module virag
7011 {
7012 import from Virag all;
7013 group text_grp {
7014 type record MYREC
7015 {
7016 integer i,
7017 boolean b,
7018 MYREC r optional
7019 }
7020 type record of integer MYROFI;
7021 type union MYU {
7022 integer i,
7023 boolean b,
7024 MYREC r
7025 }
7026 }
7027 with { encode "TEXT" variant "" }
7028 type record MYREC2 { integer i }
7029 const MYREC c_myrec1 := {i:=1}
7030 with {
7031 erroneous "value := 2"
7032 erroneous (x) "value := 2"
7033 erroneous (i, r.i, r.r.i) "value := 2"
7034 }
7035 const MYREC c_myrec2 := {i:=1} with { erroneous (b) "after := omit" }
7036 const MYREC c_myrec3 := {i:=1} with { erroneous (b) "before := omit" }
7037 const MYREC c_myrec4 := {i:=1} with { erroneous (b) "value := omit all" }
7038 const MYREC c_myrec5 := {i:=1} with { erroneous (b) "value := 123 all" }
7039 const MYREC c_myrec6 := {i:=1} with { erroneous (b) "value := {1,2,3}" }
7040 const MYREC c_myrec7 := {i:=1} with { erroneous (b) "value := nonexi" }
7041 const MYREC c_myrec8 := {i:=1} with { erroneous (b) "value(raw) := 123" }
7042 const MYREC c_myrec9 := {i:=1} with { erroneous (b) "value := MYROFI:'A'H" }
7043 const MYREC c_myrec10 := {i:=1} with { erroneous (b) "value := MYROFI:{1,2,*}" }
7044 const MYREC c_myrec11 := {i:=1} with {
7045 erroneous (b) "after := omit all"
7046 erroneous (r) "value := 0"
7047 }
7048 const MYREC c_myrec12 := {i:=1} with {
7049 erroneous (r) "before := omit all"
7050 erroneous (b) "value := 0"
7051 }
7052 const MYU c_myu13 := {i:=1} with { erroneous (b) "after := omit all" erroneous (r) "value:=12" }
7053 const MYU c_myu14 := {i:=1} with { erroneous (b) "value := omit" }
7054 const MYREC c_myrec15 := {i:=1} with {
7055 erroneous (r) "after := omit all"
7056 erroneous (i) "before := omit all"
7057 }
7058 const MYREC c_myrec16 := {i:=1} with {
7059 erroneous (b,b) "value := 1"
7060 erroneous (b,b) "after := 1"
7061 erroneous (b,b) "before := 1"
7062 }
7063 const MYREC c_myrec17 := {i:=1} with {
7064 erroneous (r.b) "value := 1"
7065 erroneous (r) "value := 1"
7066 }
7067 const MYREC c_myrec18 := {i:=1} with {
7068 erroneous (b) "before := omit all"
7069 erroneous (r) "before := omit all"
7070 }
7071 const MYREC c_myrec19 := {i:=1} with {
7072 erroneous (b) "value := 1"
7073 erroneous (r) "before := omit all"
7074 }
7075 const MYREC c_myrec20 := {i:=1} with {
7076 erroneous (b) "after := omit all"
7077 erroneous (i) "after := omit all"
7078 }
7079 const MYREC c_myrec21 := {i:=1} with {
7080 erroneous (r) "value := 1"
7081 erroneous (b) "after := omit all"
7082 }
7083 const MYREC c_myrec22 := {i:=1} with {
7084 erroneous (r) "value := omit"
7085 erroneous (r.i) "value := 1"
7086 }
7087 const MySeq c_myrec23 := {i:=1} with { erroneous (b) "value(raw) := ""proba""" }
7088 const MySeq c_myrec24 := {i:=1} with { erroneous (b) "value(raw) := universal charstring:""proba""" }
7089 const MYREC2 c_myrec25 := {i:=1} with { erroneous (i) "value(raw) := '1010'B" }
7090 const MYREC c_myrec26 := {i:=1} with { erroneous (b) "value := MyCharstring1:""haha""" }
7091 const MYREC c_myrec27 := {i:=1} with { erroneous (b) "value := MYREC2:{i:=1}" }
7092 function fv() {} with{erroneous ""}
7093 control {} with{erroneous ""}
7094 } with{erroneous ""}
7095 <END_MODULE>
7096
7097 <RESULT FTRT COUNT 1>
7098 (?im)\berror: At least one qualifier must be specified for the `erroneous' attribute
7099 <END_RESULT>
7100
7101 <RESULT FTRT COUNT 1>
7102 (?im)\berror: Reference to non-existent field `x' in type `@virag.MYREC'
7103 <END_RESULT>
7104
7105 <RESULT FTRT COUNT 1>
7106 (?im)\berror: Keyword `all' is expected after `omit' when omitting all fields after the specified field
7107 <END_RESULT>
7108
7109 <RESULT FTRT COUNT 1>
7110 (?im)\berror: Keyword `all' is expected after `omit' when omitting all fields before the specified field
7111 <END_RESULT>
7112
7113 <RESULT FTRT COUNT 1>
7114 (?im)\berror: Unexpected `all' keyword after `omit' when omitting one field
7115 <END_RESULT>
7116
7117 <RESULT FTRT COUNT 1>
7118 (?im)\berror: Unexpected `all' keyword after the in-line template
7119 <END_RESULT>
7120
7121 <RESULT FTRT COUNT 1>
7122 (?im)\berror: Cannot determine the type of the in-line template
7123 <END_RESULT>
7124
7125 <RESULT FTRT COUNT 1>
7126 (?im)\berror: There is no local or imported definition with name `nonexi'
7127 <END_RESULT>
7128
7129 <RESULT FTRT COUNT 1>
7130 (?im)\berror: An in-line template of type `integer' cannot be used as a `raw' erroneous value
7131 <END_RESULT>
7132
7133 <RESULT FTRT COUNT 1>
7134 (?im)\berror: record of value was expected
7135 <END_RESULT>
7136
7137 <RESULT FTRT COUNT 1>
7138 (?im)\berror: A specific value without matching symbols was expected
7139 <END_RESULT>
7140
7141 <RESULT FTRT COUNT 1>
7142 (?im)\berror: Field `r' cannot be referenced because all fields after field `b' have been omitted
7143 <END_RESULT>
7144
7145 <RESULT FTRT COUNT 1>
7146 (?im)\berror: Field `b' cannot be referenced because all fields before field `r' have been omitted
7147 <END_RESULT>
7148
7149 <RESULT FTRT COUNT 1>
7150 (?im)\berror: Indicator `after' cannot be used with reference `b' which points to a field of a union type
7151 <END_RESULT>
7152
7153 <RESULT FTRT COUNT 1>
7154 (?im)\berror: There is nothing to omit after the last field \(r\) of a record/set type
7155 <END_RESULT>
7156
7157 <RESULT FTRT COUNT 1>
7158 (?im)\berror: Reference to field `r' with indicator `value' would invalidate previously specified erroneous data
7159 <END_RESULT>
7160
7161 <RESULT FTRT COUNT 1>
7162 (?im)\berror: There is nothing to omit before the first field \(i\)
7163 <END_RESULT>
7164
7165 <RESULT FTRT COUNT 1>
7166 (?im)\berror: Duplicate reference to field `b' with indicator `value'
7167 <END_RESULT>
7168
7169 <RESULT FTRT COUNT 1>
7170 (?im)\berror: Duplicate reference to field `b' with indicator `after'
7171 <END_RESULT>
7172
7173 <RESULT FTRT COUNT 1>
7174 (?im)\berror: Duplicate reference to field `b' with indicator `before'
7175 <END_RESULT>
7176
7177 <RESULT FTRT COUNT 1>
7178 (?im)\berror: Duplicate rule for omitting all fields before the specified field. Used on field `r' but previously already used on field `b'
7179 <END_RESULT>
7180
7181 <RESULT FTRT COUNT 1>
7182 (?im)\berror: Omitting fields before field `r' would invalidate previously specified erroneous data
7183 <END_RESULT>
7184
7185 <RESULT FTRT COUNT 1>
7186 (?im)\berror: Duplicate rule for omitting all fields after the specified field. Used on field `i' but previously already used on field `b'
7187 <END_RESULT>
7188
7189 <RESULT FTRT COUNT 1>
7190 (?im)\berror: Omitting fields after field `b' would invalidate previously specified erroneous data
7191 <END_RESULT>
7192
7193 <RESULT FTRT COUNT 1>
7194 (?im)\berror: Field `r.i' is embedded into a field which was previously overwritten or omitted
7195 <END_RESULT>
7196
7197 <RESULT FTRT COUNT 1>
7198 (?im)\berror: A `raw' charstring value was used for erroneous type `@Virag.MySeq' which has no TEXT or XER encodings.
7199 <END_RESULT>
7200
7201 <RESULT FTRT COUNT 1>
7202 (?im)\berror: A `raw' universal charstring value was used for erroneous type `@Virag.MySeq' which has no XER encoding.
7203 <END_RESULT>
7204
7205 <RESULT FTRT COUNT 1>
7206 (?im)\berror: A `raw' bitstring value was used for erroneous type `@virag.MYREC2' which has no RAW or PER encodings.
7207 <END_RESULT>
7208
7209 <RESULT FTRT COUNT 1>
7210 (?im)\berror: Type `VisibleString' and type `@virag.MYREC' have no common encoding
7211 <END_RESULT>
7212
7213 <RESULT FTRT COUNT 1>
7214 (?im)\berror: Type `@virag.MYREC2' and type `@virag.MYREC' have no common encoding
7215 <END_RESULT>
7216
7217 <RESULT COUNT 3>
7218 (?im)\berror: The `erroneous' attribute can be used only on template and constant definitions
7219 <END_RESULT>
7220
7221 <RESULT FTRT COUNT 33>
7222 (?is)\berror:
7223 <END_RESULT>
7224
7225
7226 <RESULT LTRT COUNT 27>
7227 (?im)\berror: `erroneous' attributes can be used only with the Function Test Runtime
7228 <END_RESULT>
7229
7230 <RESULT LTRT COUNT 27>
7231 (?im)\bnote: If you need negative testing use the -R flag when generating the makefile
7232 <END_RESULT>
7233
7234 <RESULT LTRT COUNT 30>
7235 (?is)\berror:
7236 <END_RESULT>
7237 <RESULT LTRT COUNT 27>
7238 (?is)\bnote:
7239 <END_RESULT>
7240
7241 <END_TC>
7242 :exmp.
7243
7244 .*---------------------------------------------------------------------*
7245 :h3.Adhoc:: Syntax errors in logfiles (TR HN52781)
7246 .*---------------------------------------------------------------------*
7247 :xmp tab=0.
7248 <TC - Syntax errors in logfiles (TR HN52781)>
7249 <EXECUTE>
7250 <VERDICT_LEAF PASS>
7251 <MODULE TTCN Temp Temp.ttcn>
7252 module Temp {
7253 control { }
7254 }
7255 <END_MODULE>
7256 <MODULE CFG Temp Temp.cfg>
7257 [MODULE_PARAMETERS]
7258 very_unknown_module_parameter := "should be logged normally"
7259 [LOGGING]
7260 LogSourceInfo := Yes
7261 Logfile := "Temp%i.log"
7262 FileMask := LOG_ALL
7263 ConsoleMask := LOG_ALL
7264 [EXECUTE]
7265 Temp
7266 <END_MODULE>
7267 <RESULT IF_PASS COUNT 2>
7268 (?im)Error while setting parameter field 'very_unknown_module_parameter' to '"should be logged normally"': Module parameter cannot be set, because module `very_unknown_module_parameter' does not exist, and no parameter with name `very_unknown_module_parameter' exists in any module.
7269 <END_RESULT>
7270 <END_TC>
7271 :exmp.
7272
7273 .*---------------------------------------------------------------------*
7274 :h3.Adhoc:: testcase.stop
7275 .*---------------------------------------------------------------------*
7276 :xmp tab=0.
7277 <TC - testcase.stop>
7278 <EXECUTE>
7279 <VERDICT_LEAF PASS>
7280 <MODULE TTCN Temp Temp.ttcn>
7281 module Temp {
7282 type component MyComp {}
7283 testcase TC() runs on MyComp {
7284 testcase.stop("Is it a Bird?! Is it a Plane?! No!! It's a dynamic test case error!!!");
7285 }
7286 control
7287 {
7288 execute(TC());
7289 }
7290 }
7291 <END_MODULE>
7292 <MODULE CFG Temp Temp.cfg>
7293 [MODULE_PARAMETERS]
7294 [LOGGING]
7295 LogSourceInfo := Yes
7296 Logfile := "Temp%i.log"
7297 FileMask := LOG_ALL
7298 ConsoleMask := LOG_ALL
7299 [EXECUTE]
7300 Temp
7301 <END_MODULE>
7302 <RESULT IF_PASS COUNT 1>
7303 (?im)Dynamic test case error: testcase.stop
7304 <END_RESULT>
7305 <RESULT IF_PASS COUNT 1>
7306 (?im)Is it a Bird\?! Is it a Plane\?! No!! It's a dynamic test case error!!!
7307 <END_RESULT>
7308 <END_TC>
7309 :exmp.
7310
7311 .*---------------------------------------------------------------------*
7312 :h3.Adhoc:: Indexing of string template variables (CR_TR00018474)
7313 .*---------------------------------------------------------------------*
7314 :xmp tab=0.
7315 <TC - Indexing of string template variables (CR_TR00018474)>
7316 <COMPILE>
7317 <VERDICT_LEAF PASS>
7318 <MODULE TTCN Temp Temp.ttcn>
7319 module Temp {
7320 type component MyComp {}
7321 template charstring tcs := "doggee"
7322 template bitstring tbs := '11001100'B
7323 template hexstring ths := 'AABBCCDDEEFF'H
7324 template octetstring tos := 'AABBCCDD'O
7325 template universal charstring tus := char(0, 0, 0, 75) & char(0, 0, 0, 65)
7326
7327 function fsi_charstrings(in template charstring vtc) {}
7328 function fsi_bitstrings(in template bitstring vtb) {}
7329 function fsi_hexstrings(in template hexstring vth) {}
7330 function fsi_octetstrings(in template octetstring vto) {}
7331 function fsi_universal_charstrings(in template universal charstring vtu) {}
7332
7333 testcase TC_charstrings() runs on MyComp {
7334 var template charstring vtc := "fisherman"
7335 vtc[0] := vtc[1] // Compile error, string template variables cannot be indexed on the right hand side.
7336 vtc[0] := tcs[1] // Compile error, string templates cannot be indexed at all.
7337 tcs[0] := "D" // Compile error, string templates cannot be indexed at all.
7338 vtc[0] := * // Compile error, ANY_OR_OMIT can never be assigned to an element of a string template variable.
7339 vtc[0] := ? // Compile error, ANY_VALUE can never be assigned to an element of a string template variable, it would "become" a pattern otherwise.
7340 fsi_charstrings(vtc[0]) // Compile error, string template variables cannot be indexed on the right hand side.
7341 }
7342
7343 testcase TC_bitstrings() runs on MyComp {
7344 var template bitstring vtb := '0011110000'B
7345 vtb[0] := vtb[1]
7346 vtb[0] := tbs[1]
7347 tbs[0] := '1'B
7348 vtb[0] := *
7349 vtb[0] := ?
7350 vtb[0] := '*'B
7351 vtb[1] := '?'B
7352 fsi_bitstrings(vtb[0])
7353 }
7354
7355 testcase TC_hexstrings() runs on MyComp {
7356 var template hexstring vth := 'AABBCCDDEE'H
7357 vth[0] := vth[1]
7358 vth[0] := ths[1]
7359 ths[0] := 'B'H
7360 vth[0] := *
7361 vth[0] := ?
7362 vth[0] := '*'H
7363 vth[1] := '?'H
7364 fsi_hexstrings(vth[0])
7365 }
7366
7367 testcase TC_octetstrings() runs on MyComp {
7368 var template octetstring vto := 'ABBAABBA'O
7369 vto[0] := vto[1]
7370 vto[0] := tos[1]
7371 tos[0] := 'BB'O
7372 vto[0] := *
7373 vto[0] := ?
7374 vto[0] := '*'O
7375 vto[1] := '?'O
7376 fsi_octetstrings(vto[0])
7377 }
7378
7379 testcase TC_universal_charstrings() runs on MyComp {
7380 var template universal charstring vtu := "fisherman"
7381 vtu[0] := vtu[1]
7382 vtu[0] := tus[1]
7383 tus[0] := "F"
7384 vtu[0] := *
7385 vtu[0] := ?
7386 fsi_universal_charstrings(vtu[0])
7387 }
7388
7389 }
7390 <END_MODULE>
7391 <RESULT IF_PASS COUNT 2>
7392 (?im)error: Reference to template variable `vtc' can not be indexed
7393 <END_RESULT>
7394 <RESULT IF_PASS COUNT 1>
7395 (?im)error: Reference to a variable or template variable was expected instead of template `@Temp.tcs'
7396 <END_RESULT>
7397 <RESULT IF_PASS COUNT 16>
7398 (?im)error: A template body with matching symbols cannot be assigned to an element of a template variable
7399 <END_RESULT>
7400 <RESULT IF_PASS COUNT 2>
7401 (?im)error: Reference to template variable `vtb' can not be indexed
7402 <END_RESULT>
7403 <RESULT IF_PASS COUNT 1>
7404 (?im)error: Invalid array element reference: type `bitstring' cannot be indexed
7405 <END_RESULT>
7406 <RESULT IF_PASS COUNT 1>
7407 (?im)error: Reference to a variable or template variable was expected instead of template `@Temp.tbs'
7408 <END_RESULT>
7409 <RESULT IF_PASS COUNT 2>
7410 (?im)error: Reference to template variable `vth' can not be indexed
7411 <END_RESULT>
7412 <RESULT IF_PASS COUNT 2>
7413 (?im)error: Reference to template variable `vto' can not be indexed
7414 <END_RESULT>
7415 <RESULT IF_PASS COUNT 2>
7416 (?im)error: Reference to template variable `vtu' can not be indexed
7417 <END_RESULT>
7418 <RESULT IF_PASS COUNT 1>
7419 (?im)error: Invalid array element reference: type `hexstring' cannot be indexed
7420 <END_RESULT>
7421 <RESULT IF_PASS COUNT 1>
7422 (?im)error: Invalid array element reference: type `octetstring' cannot be indexed
7423 <END_RESULT>
7424 <RESULT IF_PASS COUNT 1>
7425 (?im)error: Invalid array element reference: type `universal charstring' cannot be indexed
7426 <END_RESULT>
7427 <RESULT IF_PASS COUNT 1>
7428 (?im)error: Reference to a variable or template variable was expected instead of template `@Temp.ths'
7429 <END_RESULT>
7430 <RESULT IF_PASS COUNT 1>
7431 (?im)error: Reference to a variable or template variable was expected instead of template `@Temp.tos'
7432 <END_RESULT>
7433 <RESULT IF_PASS COUNT 1>
7434 (?im)error: Reference to a variable or template variable was expected instead of template `@Temp.tus'
7435 <END_RESULT>
7436 <END_TC>
7437 :exmp.
7438
7439 .*---------------------------------------------------------------------*
7440 :h3.Adhoc:: Indexing of string template variables DTEs (CR_TR00018474)
7441 .*---------------------------------------------------------------------*
7442 :xmp tab=0.
7443 <TC - Indexing of string template variables DTEs (CR_TR00018474)>
7444 <EXECUTE>
7445 <VERDICT_LEAF PASS>
7446 <MODULE TTCN Temp Temp.ttcn>
7447 module Temp {
7448 type component MyComp {}
7449
7450 testcase TC_bitstrings() runs on MyComp {
7451 var template bitstring vtb := '0*?1'B // It's a pattern, cannot be indexed, runtime error.
7452 vtb[0] := '1'B
7453 setverdict(pass)
7454 }
7455
7456 testcase TC_hexstrings() runs on MyComp {
7457 var template hexstring vth := 'AABB?CC'H // It's a pattern, cannot be indexed, runtime error.
7458 vth[0] := 'B'H
7459 setverdict(pass)
7460 }
7461
7462 testcase TC_octetstrings() runs on MyComp {
7463 var template octetstring vto := 'AABB??*'O // It's a pattern, cannot be indexed, runtime error.
7464 vto[0] := 'BB'O
7465 setverdict(pass)
7466 }
7467
7468 control
7469 {
7470 execute(TC_bitstrings());
7471 execute(TC_hexstrings());
7472 execute(TC_octetstrings());
7473 }
7474 }
7475 <END_MODULE>
7476 <MODULE CFG Temp Temp.cfg>
7477 [MODULE_PARAMETERS]
7478 [LOGGING]
7479 LogSourceInfo := Yes
7480 Logfile := "Temp%i.log"
7481 FileMask := LOG_ALL
7482 ConsoleMask := LOG_ALL
7483 [EXECUTE]
7484 Temp
7485 <END_MODULE>
7486 <RESULT IF_PASS COUNT 1>
7487 (?im)Dynamic test case error: Accessing a bitstring element of a non-specific bitstring template.
7488 <END_RESULT>
7489 <RESULT IF_PASS COUNT 1>
7490 (?im)Dynamic test case error: Accessing a hexstring element of a non-specific hexstring template.
7491 <END_RESULT>
7492 <RESULT IF_PASS COUNT 1>
7493 (?im)Dynamic test case error: Accessing an octetstring element of a non-specific octetstring template.
7494 <END_RESULT>
7495 <END_TC>
7496 :exmp.
7497
7498 .*--------------------------------------------------------------------------*
7499 :h3.Adhoc - TR HO69261 Incorrect code generated for create with optional parameters
7500 .*--------------------------------------------------------------------------*
7501 :xmp tab=0.
7502
7503 <TC - Adhoc - TR HO69261 Incorrect code generated for create with optional parameters>
7504
7505 <COMPILEGCC>
7506 <VERDICT_LEAF PASS>
7507 <MODULE TTCN Temp Temp.ttcn>
7508 module Temp {
7509 type record Rec {
7510 charstring cs optional
7511 }
7512 type component CT {}
7513
7514 testcase tc() runs on CT
7515 {
7516 var Rec r := {cs := "12.0.0.1"};
7517 var CT c1 := CT.create(r.cs);
7518 var CT c2 := CT.create(-, r.cs);
7519 var CT c3 := CT.create(r.cs, r.cs);
7520 }
7521 }
7522 <END_MODULE>
7523 <RESULT IF_PASS NEGATIVE>
7524 (?is)\berror:
7525 <END_RESULT>
7526 <END_TC>
7527 :exmp.
7528
7529 .*--------------------------------------------------------------------------*
7530 :h3.Adhoc - sizeof()/lengthof() DTEs
7531 .*--------------------------------------------------------------------------*
7532 :xmp tab=0.
7533
7534 <TC - Adhoc - sizeof()/lengthof() DTEs>
7535
7536 <EXECUTE>
7537 <VERDICT_LEAF PASS>
7538 <MODULE TTCN Temp Temp.ttcn>
7539 module Temp {
7540 type component CT {}
7541 type record of integer ROI;
7542 testcase tc_sizeof_lengthof_standard1() runs on CT {
7543 var template ROI tr_roI1 := { 1, permutation(2, 3), ? }
7544 if(lengthof(tr_roI1)==4) { setverdict(pass)}else { setverdict(fail) };
7545 template ROI tr_roI2 := {1, *, (2, 3) }
7546 if(lengthof(tr_roI2)==3){ setverdict(pass)}else { setverdict(fail) }; //DTE!!!!
7547 }
7548
7549 testcase tc_sizeof_lengthof_standard2() runs on CT {
7550 if(lengthof('1*F'H) ==3){ setverdict(pass)}else { setverdict(fail) }; //DTE???
7551 }
7552
7553 control {
7554 execute(tc_sizeof_lengthof_standard1())
7555 execute(tc_sizeof_lengthof_standard2())
7556 }
7557 }
7558 <END_MODULE>
7559 <MODULE CFG Temp Temp.cfg>
7560 [MODULE_PARAMETERS]
7561 [LOGGING]
7562 LogSourceInfo := Yes
7563 Logfile := "Temp%i.log"
7564 FileMask := LOG_ALL
7565 ConsoleMask := LOG_ALL
7566 [EXECUTE]
7567 Temp
7568 <END_MODULE>
7569 <RESULT IF_PASS NEGATIVE>
7570 (?is)\berror: Performing lengthof() operation on a template of type \@Temp.ROI with no exact length.
7571 <END_RESULT>
7572 <RESULT IF_PASS NEGATIVE>
7573 (?is)\berror: Performing lengthof() operation on a hexstring template with no exact length.
7574 <END_RESULT>
7575 <END_TC>
7576 :exmp.
7577
7578 .*--------------------------------------------------------------------------*
7579 :h3.Adhoc - sizeof()/lengthof() compilation errors
7580 .*--------------------------------------------------------------------------*
7581 :xmp tab=0.
7582
7583 <TC - Adhoc - sizeof()/lengthof() compilation errors>
7584
7585 <COMPILE>
7586 <VERDICT_LEAF PASS>
7587 <MODULE TTCN Temp Temp.ttcn>
7588 module Temp {
7589 type record of integer ROI;
7590 type component CT {}
7591 testcase tc_sizeof_lengthof_standard1() runs on CT {
7592 template ROI tr_roI4 := { 1, 2, 3, * } length(1..2) ; //compilation error
7593 if(lengthof(tr_roI4)==3) { setverdict(fail) };
7594 }
7595 }
7596 <END_MODULE>
7597 <RESULT IF_PASS NEGATIVE>
7598 (?is)\berror: There are more (at least 3) elements in the template than it is allowed by the length restriction (at most 2)
7599 <END_RESULT>
7600 <END_TC>
7601 :exmp.
7602
7603 .*--------------------------------------------------------------------------*
7604 :h3.Adhoc - Additional RAW attribute checks for LENGTHTO
7605 .*--------------------------------------------------------------------------*
7606 :xmp tab=0.
7607
7608 <TC - Additional RAW attribute checks for LENGTHTO>
7609
7610 <COMPILE>
7611 <VERDICT_LEAF PASS>
7612 <MODULE TTCN Temp Temp.ttcn>
7613 module Temp {
7614 type union myu_ok { integer a, integer b }
7615 type union myu_nok { integer a, charstring b }
7616 type record of integer mylist
7617 type record myr1 {
7618 boolean f1,
7619 integer f2,
7620 charstring f3
7621 } with {
7622 variant (f2) "LENGTHTO (f3)"
7623 }
7624 type record myr2 {
7625 integer f1,
7626 myu_ok f2,
7627 charstring f3
7628 } with {
7629 variant (f2) "LENGTHTO (f3)"
7630 }
7631 type record myr3 {
7632 integer f1,
7633 myu_nok f2,
7634 charstring f3
7635 } with {
7636 variant (f2) "LENGTHTO (f3)"
7637 }
7638 type record myr4 {
7639 integer f1,
7640 mylist f2,
7641 charstring f3
7642 } with {
7643 variant (f2) "LENGTHTO (f3)"
7644 }
7645 type record myr5 {
7646 charstring f1,
7647 charstring f2
7648 } with {
7649 variant (f1) "LENGTHTO (f2)"
7650 }
7651 } with { encode "RAW" }
7652 <END_MODULE>
7653 <RESULT IF_PASS COUNT 1>
7654 (?is)\berror: The union type LENGTHTO field must contain only integer fields
7655 <END_RESULT>
7656 <RESULT IF_PASS COUNT 1>
7657 (?is)\berror: The LENGTHTO field must be an integer or union type instead of `\@Temp.mylist'
7658 <END_RESULT>
7659 <RESULT IF_PASS COUNT 1>
7660 (?is)\berror: The LENGTHTO field must be an integer or union type instead of `charstring'
7661 <END_RESULT>
7662 <RESULT IF_PASS COUNT 3>
7663 (?is)\berror:
7664 <END_RESULT>
7665 <END_TC>
7666 :exmp.
7667
7668 .*--------------------------------------------------------------------------*
7669 :h3.Adhoc - HQ43433 decode parameter check
7670 .*--------------------------------------------------------------------------*
7671 :xmp tab=0.
7672
7673 <TC - HQ43433 decode parameter check>
7674
7675 <EXECUTE>
7676 <VERDICT_LEAF PASS>
7677 <MODULE TTCN Temp Temp.ttcn>
7678 module Temp
7679 {
7680
7681 // type definition incl. RAW attribute
7682 type set S
7683 {
7684 integer i
7685 } with {
7686 variant (i) "BYTEORDER(last)";
7687 }
7688
7689 // wrapper functions for encoding/decoding
7690 function enc(S s) return bitstring {
7691 var bitstring bs;
7692 bs := encvalue(s);
7693 return bs;
7694 }
7695
7696 // BUG: TITAN SA does NOT report error when @m.dec.bs is not declared inout
7697 // Instead, the compiler generates erronous C++ code which brakes C++
7698 // compilation at function invocation (line marked below)
7699 function dec(/*inout*/ bitstring bs) return S {
7700 var S s;
7701 var integer i;
7702 // decvalue 1st par should be inout by standard?
7703 i := decvalue(bs, s);
7704 return s;
7705 }
7706
7707 function dec2(in bitstring bs) return S {
7708 var S s;
7709 var integer i;
7710 // decvalue 1st par should be inout by standard?
7711 i := decvalue(bs, s);
7712 return s;
7713 }
7714
7715 function dec3(out bitstring bs) return S {
7716 var S s;
7717 var integer i;
7718 var bitstring vl_bs:=bs;
7719 // decvalue 1st par should be inout by standard?
7720 i := decvalue(bs, s);
7721 return s;
7722 }
7723
7724 // inout
7725 function dec_inout(inout bitstring bs) return S {
7726 var S s;
7727 var integer i;
7728 // decvalue 1st par should be inout by standard?
7729 i := decvalue(bs, s);
7730 return s;
7731 }
7732
7733 type component MyComp {}
7734
7735 testcase tc_default() runs on MyComp {
7736 var S s := { i := 2 };
7737 var S s_mod;
7738 var bitstring bs;
7739 log("original:",s);
7740 bs := enc(s);
7741 log("encoded:",bs);
7742 s_mod := dec(bs);
7743 log("decoded:",s_mod);
7744 if(match(s,s_mod)) {setverdict(pass);} else {setverdict(fail)}
7745 bs[1] := '1'B;
7746 log(bs);
7747 }
7748 testcase tc_in() runs on MyComp {
7749 var S s := { i := 2 };
7750 var S s_mod;
7751 var bitstring bs;
7752 log("original:",s);
7753 bs := enc(s);
7754 log("encoded:",bs);
7755 s_mod := dec2(bs);
7756 log("decoded:",s_mod);
7757 if(match(s,s_mod)) {setverdict(pass);} else {setverdict(fail)}
7758
7759 }
7760 /* debate: out fv can use out param!! TR???
7761 testcase tc_out() runs on MyComp {
7762 var S s := { i := 2 };
7763 var S s_mod;
7764 var bitstring bs;
7765 log("original:",s);
7766 bs := enc(s);
7767 log("encoded:",bs);
7768 s_mod := dec3(bs);
7769 log("decoded:",s_mod);
7770 if(match(s,s_mod)) {setverdict(pass);} else {setverdict(fail)}
7771 }
7772 */
7773
7774 testcase tc_inout() runs on MyComp {
7775 var S s := { i := 2 };
7776 var S s_mod;
7777 var bitstring bs;
7778 log("original:",s);
7779 bs := enc(s);
7780 log("encoded:",bs);
7781 s_mod := dec_inout(bs);
7782 log("decoded:",s_mod);
7783 if(match(s,s_mod)) {setverdict(pass);} else {setverdict(fail)}
7784 }
7785
7786
7787 //======Another example=====
7788 type integer MyType
7789
7790 const MyType c_MyType := 42;
7791 const bitstring c_encoded := '00110011'B;
7792
7793 function f_decvalue_inpar( bitstring p_bit) {
7794 var MyType v_MyType;
7795 var bitstring vl_original:=p_bit;
7796 log( "Original input:",p_bit);
7797 log ("errCode: ",decvalue (p_bit,v_MyType)," ", vl_original, " is decodedTo: ",v_MyType, " remained:",
7798 p_bit)
7799 if(v_MyType==51 and p_bit==''B) { setverdict(pass)} else {setverdict(fail)}
7800 }
7801
7802
7803 function f_decvalue_inoutpar( inout bitstring p_bit) {
7804 var MyType v_MyType;
7805 var bitstring vl_original:=p_bit;
7806 log( "Original input:",p_bit);
7807 log ("errCode: ",decvalue (p_bit,v_MyType)," ", vl_original, " is decodedTo: ",v_MyType, " remained:",
7808 p_bit)
7809 if(v_MyType==51 and p_bit==''B) { setverdict(pass)} else {setverdict(fail)}
7810 }
7811
7812 testcase tc_2() runs on MyComp {
7813 var bitstring v_bit := c_encoded;
7814 f_decvalue_inoutpar(v_bit);
7815 f_decvalue_inpar(c_encoded);
7816 }
7817
7818 control
7819 {
7820 execute(tc_default());
7821 execute(tc_in());
7822 //execute(tc_out());
7823 execute(tc_inout());
7824 execute(tc_2());
7825 }
7826
7827 } with {
7828 encode "RAW"
7829 }
7830
7831
7832 <END_MODULE>
7833
7834 <MODULE CFG Temp Temp.cfg>
7835
7836 [MODULE_PARAMETERS]
7837 [LOGGING]
7838 LogSourceInfo := Yes
7839 Logfile := "Temp%i.log"
7840 FileMask := LOG_ALL
7841 ConsoleMask := LOG_ALL
7842 [EXECUTE]
7843 Temp
7844 <END_MODULE>
7845
7846 <RESULT>
7847 Overall verdict: pass
7848 <END_RESULT>
7849
7850
7851 <END_TC>
7852 :exmp.
7853
7854 .*--------------------------------------------------------------------------*
7855 :h3.Adhoc - @try @catch blocks no errors
7856 .*--------------------------------------------------------------------------*
7857 :xmp tab=0.
7858
7859 <TC - @try @catch blocks no errors>
7860
7861 <COMPILE>
7862 <VERDICT_LEAF PASS>
7863 <MODULE TTCN Temp Temp.ttcn>
7864 module Temp {
7865 type component MyComp {}
7866 function fv1() {
7867 @try {}
7868 @catch(e) {}
7869 }
7870 function fv2() return integer {
7871 @try {
7872 log(1);
7873 return 1;
7874 }
7875 @catch(e) {
7876 @try {
7877 log(e);
7878 return 2;
7879 }
7880 @catch(e2) {
7881 log(e2);
7882 return 3;
7883 }
7884 }
7885 }
7886 testcase tc() runs on MyComp {
7887 @try {
7888 @try {}
7889 @catch(e) {}
7890 }
7891 @catch(e) {}
7892 @try {}
7893 @catch(e) {}
7894 }
7895 control {
7896 @try {}
7897 @catch(e) {}
7898 }
7899 }
7900 <END_MODULE>
7901 <RESULT IF_PASS COUNT 0>
7902 (?is)\berror:
7903 <END_RESULT>
7904 <END_TC>
7905 :exmp.
7906
7907 .*--------------------------------------------------------------------------*
7908 :h3.Adhoc - @try @catch blocks semantic errors
7909 .*--------------------------------------------------------------------------*
7910 :xmp tab=0.
7911
7912 <TC - @try @catch blocks semantic errors>
7913
7914 <COMPILE>
7915 <VERDICT_LEAF PASS>
7916 <MODULE TTCN Temp Temp.ttcn>
7917 module Temp {
7918 type component MyComp {}
7919 function fv1() {
7920 var integer e;
7921 @try {}
7922 @catch(e) {}
7923 }
7924 function fv2() return integer {
7925 @try {
7926 log(1);
7927 return 1;
7928 }
7929 log(0);
7930 @catch(e) {
7931 @try {
7932 log(2);
7933 return 2;
7934 }
7935 @catch(e) {
7936 log(3);
7937 return 3;
7938 }
7939 }
7940 }
7941 testcase tc() runs on MyComp {
7942 @catch(e) {}
7943 @try {
7944 @try {}
7945 }
7946 @catch(e) {
7947 var integer i := e;
7948 }
7949 }
7950 control {
7951 @try {}
7952 @catch(dte_str) {
7953 const charstring dte_str := "";
7954 }
7955 }
7956 }
7957 <END_MODULE>
7958 <RESULT IF_PASS COUNT 2>
7959 (?is)\berror: Definition with identifier `e' is not unique in the scope hierarchy
7960 <END_RESULT>
7961 <RESULT IF_PASS COUNT 2>
7962 (?is)\berror: `try' statement block must be followed by a `catch' block
7963 <END_RESULT>
7964 <RESULT IF_PASS COUNT 2>
7965 (?is)\berror: `catch' statement block must be preceded by a `try' block
7966 <END_RESULT>
7967 <RESULT IF_PASS COUNT 1>
7968 (?is)\berror: The function has return type, but control might leave it without reaching a return statement
7969 <END_RESULT>
7970 <RESULT IF_PASS COUNT 1>
7971 (?is)\berror: Duplicate definition with identifier `dte_str'
7972 <END_RESULT>
7973 <RESULT IF_PASS COUNT 1>
7974 (?is)\berror: Type mismatch: a value of type `integer' was expected instead of `charstring'
7975 <END_RESULT>
7976 <RESULT IF_PASS COUNT 9>
7977 (?is)\berror:
7978 <END_RESULT>
7979 <END_TC>
7980 :exmp.
7981
7982 .*---------------------------------------------------------------------*
7983 :h3.Adhoc:: @try @catch blocks catching DTEs
7984 .*---------------------------------------------------------------------*
7985 :xmp tab=0.
7986 <TC - @try @catch blocks catching DTEs>
7987 <EXECUTE>
7988 <VERDICT_LEAF PASS>
7989 <MODULE TTCN Temp Temp.ttcn>
7990 module Temp {
7991 type component MyComp {}
7992 function safe_str2int(in charstring int_str, in integer defval) return integer {
7993 @try {
7994 return str2int(int_str);
7995 }
7996 @catch(err) {
7997 return defval;
7998 }
7999 }
8000 testcase TC1() runs on MyComp {
8001 if (safe_str2int("bread", -1)==-1) { setverdict(pass); }
8002 else { setverdict(fail); }
8003 }
8004 testcase TC2() runs on MyComp {
8005 var integer myEvilUnboundVariable;
8006 @try {
8007 myEvilUnboundVariable := myEvilUnboundVariable + 1;
8008 setverdict(fail);
8009 }
8010 @catch(e) {
8011 setverdict(pass);
8012 }
8013 }
8014 testcase TC3() runs on MyComp {
8015 @try {
8016 var integer i := 0;
8017 i := 10 / i;
8018 setverdict(fail);
8019 }
8020 @catch(e) {
8021 if (match(e, pattern "*division by zero*")) { setverdict(pass); }
8022 else { setverdict(fail); }
8023 }
8024 }
8025 control
8026 {
8027 execute(TC1());
8028 execute(TC2());
8029 execute(TC3());
8030 }
8031 }
8032 <END_MODULE>
8033 <MODULE CFG Temp Temp.cfg>
8034 [MODULE_PARAMETERS]
8035 [LOGGING]
8036 LogSourceInfo := Yes
8037 Logfile := "Temp%i.log"
8038 FileMask := LOG_ALL
8039 ConsoleMask := LOG_ALL
8040 [EXECUTE]
8041 Temp
8042 <END_MODULE>
8043 <RESULT IF_PASS COUNT 0>
8044 (?im)Dynamic test case error:
8045 <END_RESULT>
8046 <RESULT IF_PASS COUNT 1>
8047 (?im)Overall verdict: pass
8048 <END_RESULT>
8049 <END_TC>
8050 :exmp.
8051
8052 .*---------------------------------------------------------------------*
8053 :h3.Adhoc:: @lazy parameters - no errors
8054 .*---------------------------------------------------------------------*
8055 :xmp tab=0.
8056 <TC - @lazy parameters - no errors>
8057 <COMPILEGCC>
8058 <VERDICT_LEAF PASS>
8059 <MODULE TTCN Temp Temp.ttcn>
8060 module Temp
8061 {
8062 type component MyComp {}
8063 const charstring c := "c";
8064 testcase TC() runs on MyComp {
8065 var charstring a := "a";
8066 var charstring b := "b";
8067 var integer i1 := 100;
8068 var integer i2 := 20;
8069 var integer i3 := 3;
8070 MyFunc2(a&b&c&log2str(i1+i2+i3));
8071 setverdict(pass);
8072 }
8073 function MyFunc(in @lazy charstring str) {
8074 log(str);
8075 str := "huhuhu";
8076 log(str&str);
8077 }
8078 function MyFunc2(in @lazy charstring sz) {
8079 MyFunc(sz);
8080 }
8081 function MyFn1(in @lazy charstring str) return charstring {
8082 return str;
8083 }
8084 function MyFn2(in @lazy charstring s) return charstring {
8085 return MyFn2(s&MyFn1(s));
8086 }
8087 function MyFuncNormalEval(in charstring str, boolean b) {
8088 if (b) {
8089 var charstring s := str;
8090 if (s=="") { log(s); }
8091 }
8092 }
8093 function MyFuncLazyEval(in @lazy charstring str, boolean b) {
8094 if (b) {
8095 var charstring s := str;
8096 if (s=="") { log(s); }
8097 }
8098 }
8099 function Fdefaultpar( @lazy integer pi := 123 ) { log(pi); }
8100 function FuncTemplate(in template @lazy charstring tp) {
8101 tp := "huhu";
8102 log(tp);
8103 }
8104 function FuncTempl(in template @lazy charstring tp) {
8105 tp := ?;
8106 FuncTemplate(tp);
8107 }
8108 type record REC {
8109 REC rec optional,
8110 integer i
8111 }
8112 template REC trec(template @lazy integer pi) := {
8113 rec := *,
8114 i := pi
8115 }
8116 function usingRECfield(@lazy integer pi) {
8117 log(pi);
8118 }
8119 type record of integer RECOFINT;
8120 type record RECINT {
8121 RECOFINT ints optional,
8122 RECINT next optional
8123 }
8124 function usingRECINTfield(@lazy integer pi) {
8125 var integer ii := pi + 100;
8126 log(ii);
8127 }
8128 control {
8129 var template REC vrec := trec(?);
8130 var REC r := { rec:={ rec:={ rec:=omit, i:=3 }, i:=2 }, i:=1 }
8131 usingRECfield(r.rec.rec.i);
8132 var integer idx1 := 2;
8133 var integer idx2 := 4;
8134 var RECINT vrecint := { ints:=omit, next:={ ints:={1,2,3,4,5}, next:=omit} }
8135 usingRECINTfield(vrecint.next.ints[idx1+idx2-3]);
8136 FuncTemplate(?);
8137 FuncTempl(*);
8138 Fdefaultpar();
8139 execute(TC());
8140 }
8141 }
8142 <END_MODULE>
8143 <RESULT IF_PASS COUNT 0>
8144 (?im)error
8145 <END_RESULT>
8146 <END_TC>
8147 :exmp.
8148
8149 .*---------------------------------------------------------------------*
8150 :h3.Adhoc:: @lazy parameters - no runtime error
8151 .*---------------------------------------------------------------------*
8152 :xmp tab=0.
8153 <TC - @lazy parameters - no runtime error>
8154 <EXECUTE>
8155 <VERDICT_LEAF PASS>
8156 <MODULE TTCN Temp Temp.ttcn>
8157 module Temp {
8158 type component MyComp {}
8159 function DTEfunc(in charstring s) return charstring {
8160 testcase.stop;
8161 return s;
8162 }
8163 function LazyFunc(in boolean b, in @lazy charstring s) return charstring {
8164 if (b) {
8165 return "lazy";
8166 } else {
8167 return s;
8168 }
8169 }
8170 testcase LazyTC() runs on MyComp {
8171 log(LazyFunc(true, DTEfunc("x")));
8172 setverdict(pass);
8173 }
8174 control {
8175 execute(LazyTC());
8176 }
8177 }
8178 <END_MODULE>
8179 <MODULE CFG Temp Temp.cfg>
8180 [MODULE_PARAMETERS]
8181 [LOGGING]
8182 LogSourceInfo := Yes
8183 Logfile := "Temp%i.log"
8184 FileMask := LOG_ALL
8185 ConsoleMask := LOG_ALL
8186 [EXECUTE]
8187 Temp
8188 <END_MODULE>
8189 <RESULT IF_PASS COUNT 0>
8190 (?im)Dynamic test case error:
8191 <END_RESULT>
8192 <RESULT IF_PASS COUNT 1>
8193 (?im)Overall verdict: pass
8194 <END_RESULT>
8195 <END_TC>
8196 :exmp.
8197
8198 .*--------------------------------------------------------------------------*
8199 :h3.Adhoc - @lazy parameters - semantic errors
8200 .*--------------------------------------------------------------------------*
8201 :xmp tab=0.
8202
8203 <TC - @lazy parameters - semantic errors>
8204
8205 <COMPILE>
8206 <VERDICT_LEAF PASS>
8207 <MODULE TTCN Temp Temp.ttcn>
8208 module Temp {
8209 type function FT(in charstring str);
8210 function FTinst(in @lazy charstring str) {}
8211 type function FT2(in @lazy charstring str);
8212 control {
8213 var FT ft1 := refers(FTinst);
8214 ft1.apply("hehe");
8215 }
8216 }
8217 <END_MODULE>
8218 <RESULT IF_PASS COUNT 1>
8219 (?is)\berror: Formal parameter `str' cannot be \@lazy, not supported in this case.
8220 <END_RESULT>
8221 <RESULT IF_PASS COUNT 1>
8222 (?is)\berror: Parameter \@lazy-ness mismatch
8223 <END_RESULT>
8224 <RESULT IF_PASS COUNT 2>
8225 (?is)\berror:
8226 <END_RESULT>
8227 <END_TC>
8228 :exmp.
8229
8230 .*---------------------------------------------------------------------*
8231 :h3.Adhoc:: @lazy parameters - correct lazy evaluation
8232 .*---------------------------------------------------------------------*
8233 :xmp tab=0.
8234 <TC - @lazy parameters - correct lazy evaluation>
8235 <EXECUTE>
8236 <VERDICT_LEAF PASS>
8237 <MODULE TTCN Temp Temp.ttcn>
8238 module Temp {
8239 type component MyComp2 {
8240 var integer ci := 0;
8241 }
8242 function FN2() runs on MyComp2 return integer {
8243 if (ci==0) { testcase.stop("ci==0 error!"); }
8244 return ci;
8245 }
8246 function Lazy2(in @lazy integer pi) runs on MyComp2 {
8247 ci := 11;
8248 var integer vi := pi; // evaluated: 3*11 = 33
8249 if (vi!=33) { setverdict(fail); }
8250 ci := 0;
8251 vi := pi; // not evaled -> 33
8252 if (vi!=33) { setverdict(fail); }
8253 }
8254 testcase TC2() runs on MyComp2 {
8255 Lazy2(3*FN2());
8256 setverdict(pass);
8257 }
8258 control {
8259 execute(TC2());
8260 }
8261 }
8262 <END_MODULE>
8263 <MODULE CFG Temp Temp.cfg>
8264 [MODULE_PARAMETERS]
8265 [LOGGING]
8266 LogSourceInfo := Yes
8267 Logfile := "Temp%i.log"
8268 FileMask := LOG_ALL
8269 ConsoleMask := LOG_ALL
8270 [EXECUTE]
8271 Temp
8272 <END_MODULE>
8273 <RESULT IF_PASS COUNT 0>
8274 (?im)Dynamic test case error:
8275 <END_RESULT>
8276 <RESULT IF_PASS COUNT 1>
8277 (?im)Overall verdict: pass
8278 <END_RESULT>
8279 <END_TC>
8280 :exmp.
8281
8282 .*---------------------------------------------------------------------*
8283 :h3.Adhoc:: modulepar invalid simple type: port
8284 .*---------------------------------------------------------------------*
8285 :xmp tab=0.
8286 <TC - Adhoc::modulepar invalid type - port>
8287 <COMPILE>
8288 <VERDICT_LEAF FAIL>
8289 <MODULE TTCN Temp Temp.ttcn>
8290 module Temp {
8291 modulepar comp_CT tsp_Comp;
8292 modulepar port_PT tsp_Port;
8293 modulepar default_DT tsp_Def;
8294 type component comp_CT {
8295 var integer v_int := 0;
8296 }
8297 type port port_PT message {
8298 inout charstring
8299 }
8300 type default default_DT;
8301 }
8302 <END_MODULE>
8303 <RESULT IF_FAIL COUNT 1>
8304 (?is)\berror:
8305 <END_RESULT>
8306 <RESULT IF_FAIL POSITIVE>
8307 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
8308 <END_RESULT><END_TC>
8309 :exmp.
8310
8311 .*-----------------------------------------------------------*
8312 :h3.Adhoc:: modulepar invalid type: circular type definition
8313 .*-----------------------------------------------------------*
8314 :xmp tab=0.
8315 <TC - Adhoc::modulepar invalid type - circular type definition>
8316 <COMPILE>
8317 <VERDICT_LEAF FAIL>
8318 <MODULE TTCN Temp Temp.ttcn>
8319 module Temp {
8320 modulepar invalidRec tsp_Rec;
8321 type record invalidRec {
8322 integer varI,
8323 invalidSet varSet,
8324 charstring varStr
8325 }
8326 type set invalidSet {
8327 invalidRec varRec,
8328 comp_CT varCT,
8329 charstring varStr
8330 }
8331 type component comp_CT {
8332 var integer v_int := 0;
8333 }
8334 }
8335 <END_MODULE>
8336 <RESULT IF_FAIL COUNT 1>
8337 (?im)\bcircular\b.+?\breference\b
8338 <END_RESULT>
8339 <RESULT IF_FAIL COUNT 1>
8340 (?is)\berror:
8341 <END_RESULT>
8342 <RESULT IF_FAIL POSITIVE>
8343 (?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
8344 <END_RESULT><END_TC>
8345 :exmp.
8346
8347 .*-----------------------------------------------------------*
8348 :h3.Adhoc:: record of [-] in type reference
8349 .*-----------------------------------------------------------*
8350 :xmp tab=0.
8351 <TC - record of [-] in type reference>
8352 <EXECUTE>
8353 <VERDICT_LEAF PASS>
8354 <MODULE TTCN Temp Temp.ttcn>
8355 module Temp {
8356 type record GetResponseX {
8357 record of record {
8358 charstring pcB,
8359 charstring pcB_1
8360 } pcB_list
8361 }
8362 type record MyRecord {
8363 GetResponseX.pcB_list[-] field1
8364 }
8365 type record of GetResponseX.pcB_list[-] MyPcB_list;
8366 type GetResponseX.pcB_list[-].pcB MyCharType;
8367 type port PCOType message {
8368 inout charstring;
8369 } with {extension "internal"}
8370 type component MTCType {
8371 const GetResponseX.pcB_list[-] cl_myRecord := cg_RecofElem;
8372 const GetResponseX.pcB_list[-].pcB cl_myChar := "O";
8373 var GetResponseX.pcB_list[-] vl_myRecValue;
8374 var GetResponseX.pcB_list[-].pcB vl_myCharValue1;
8375 var template GetResponseX.pcB_list[-] vl_myRecTempl1;
8376 var template GetResponseX.pcB_list[-].pcB vl_myCharTempl;
8377 port PCOType MyPCO_PT;
8378 }
8379 const GetResponseX.pcB_list[-] cg_RecofElem := {
8380 pcB := "0",
8381 pcB_1 := "1"
8382 }
8383 modulepar GetResponseX.pcB_list[-] tsp_RecofElem := {
8384 pcB := "0",
8385 pcB_1 := "1"
8386 }
8387 template GetResponseX.pcB_list[-] t_RecofElem := {
8388 pcB := "0",
8389 pcB_1 := "1"
8390 }
8391 function x (GetResponseX.pcB_list[-] pl_elem, template GetResponseX.pcB_list[-] plt_elem) {
8392 const GetResponseX.pcB_list[-] cl_myRecord1 := cg_RecofElem;
8393 const GetResponseX.pcB_list[-].pcB cl_myChar1 := "O";
8394 var GetResponseX.pcB_list[-] vl_myRecValue1;
8395 var GetResponseX.pcB_list[-].pcB vl_myCharValue2;
8396 var template GetResponseX.pcB_list[-] vl_myRecTempl2;
8397 var template GetResponseX.pcB_list[-].pcB vl_myCharTempl;
8398 }
8399 testcase tc(GetResponseX.pcB_list[-] pl_elem) runs on MTCType {
8400 const GetResponseX.pcB_list[-] cl_myRecord2 := cg_RecofElem;
8401 const GetResponseX.pcB_list[-].pcB cl_myChar2 := "O";
8402 var GetResponseX.pcB_list[-] vl_myRecValue2;
8403 var GetResponseX.pcB_list[-].pcB vl_myCharValue;
8404 var template GetResponseX.pcB_list[-] vl_myRecTempl3;
8405 var template GetResponseX.pcB_list[-].pcB vl_myCharTempl3;
8406 if (pl_elem.pcB == "0") { setverdict(pass)}
8407 else { setverdict (fail);}
8408 }
8409 altstep as_x (GetResponseX.pcB_list[-] pl_elem, template GetResponseX.pcB_list[-] plt_elem) runs on MTCType {
8410 const GetResponseX.pcB_list[-] cl_myRecord3 := cg_RecofElem;
8411 const GetResponseX.pcB_list[-].pcB cl_myChar3 := "O";
8412 var GetResponseX.pcB_list[-] vl_myRecValue3;
8413 var GetResponseX.pcB_list[-].pcB vl_myCharValue;
8414 var template GetResponseX.pcB_list[-] vl_myRecTempl4;
8415 var template GetResponseX.pcB_list[-].pcB vl_myCharTempl4;
8416 [] MyPCO_PT.receive { }
8417 }
8418 control
8419 {
8420 const GetResponseX.pcB_list[-] cl_myRecord4 := cg_RecofElem;
8421 const GetResponseX.pcB_list[-].pcB cl_myChar4 := "O";
8422 var GetResponseX.pcB_list[-] vl_myRecValue2;
8423 var GetResponseX.pcB_list[-].pcB vl_myCharValue;
8424 var template GetResponseX.pcB_list[-] vl_myRecTempl2;
8425 var template GetResponseX.pcB_list[-].pcB vl_myCharTempl2;
8426 var GetResponseX.pcB_list[-] v_RecofElem := {
8427 pcB := "0",
8428 pcB_1 := "1"
8429 }
8430 execute (tc(v_RecofElem));
8431 }
8432 }
8433 <END_MODULE>
8434 <MODULE CFG Temp Temp.cfg>
8435 [MODULE_PARAMETERS]
8436 [LOGGING]
8437 LogSourceInfo := Yes
8438 Logfile := "Temp%i.log"
8439 FileMask := LOG_ALL
8440 ConsoleMask := LOG_ALL
8441 [EXECUTE]
8442 Temp
8443 <END_MODULE>
8444 <RESULT IF_PASS COUNT 0>
8445 (?im)Dynamic test case error:
8446 <END_RESULT>
8447 <RESULT IF_PASS COUNT 1>
8448 (?im)Overall verdict: pass
8449 <END_RESULT>
8450 <END_TC>
8451 :exmp.
8452
8453 .*-----------------------------------------------------------*
8454 :h3.Adhoc:: HP36129: Check for component name correctness
8455 .*-----------------------------------------------------------*
8456 :xmp tab=0.
8457 <TC - HP36129: Check for component name correctness>
8458 <EXECUTE_PARALLEL>
8459 <VERDICT_LEAF PASS>
8460 <MODULE TTCN Temp Temp.ttcn>
8461 module Temp {
8462 type port PT message {
8463 inout charstring;
8464 } with { extension "internal" }
8465 type component C {
8466 port PT PCO;
8467 }
8468 function f1() runs on C{
8469 log("Halo");
8470 }
8471 testcase tc() runs on C {
8472 var C comp := C.create("Alma-a.!ta");
8473 comp.start(f1());
8474 all component.done;
8475 setverdict(pass);
8476 }
8477 control {
8478 execute(tc());
8479 }
8480 }
8481 <END_MODULE>
8482 <MODULE CFG Temp Temp.cfg>
8483 [MODULE_PARAMETERS]
8484 [LOGGING]
8485 LogSourceInfo := Yes
8486 "Alma-a.!ta".FileMask := WARNING
8487 ConsoleMask := LOG_ALL
8488 [EXECUTE]
8489 Temp.control
8490 <END_MODULE>
8491 <RESULT IF_PASS COUNT 0>
8492 (?im)Dynamic test case error:
8493 <END_RESULT>
8494 <RESULT IF_PASS COUNT 1>
8495 (?im)Overall verdict: pass
8496 <END_RESULT>
8497 <END_TC>
8498 :exmp.
8499
8500 *-----------------------------------------------------------*
8501 :h3.Adhoc:: HT23335: Type Infinity is not a valid value for type `integer' which as subtype (-1..65535)
8502 .*-----------------------------------------------------------*
8503 :xmp tab=0.
8504 <TC - HT23335: Type Infinity is not a valid value for type `integer' which as subtype (-1..65535)>
8505
8506 <COMPILE>
8507 <VERDICT_LEAF FAIL>
8508 <MODULE TTCN Temp Temp.ttcn>
8509 module Temp {
8510 const integer limes_i := 65535;
8511 const float limes_f2 := 65535.0;
8512 const float limes_f1 := -1.0;
8513 type record MyRecI {
8514 integer inum (-1..limes_i)
8515 };
8516 type record MyRecF {
8517 float fnum (limes_f1..limes_f2)
8518 };
8519
8520 template MyRecI t1 := { inum := (0..infinity) };
8521 template MyRecF t2 := { fnum := (-infinity..0.0) };
8522
8523 }
8524 <END_MODULE>
8525 <RESULT IF_FAIL COUNT 2>
8526 (?im)\Infinity is not a valid value for type\b
8527 <END_RESULT>
8528 <END_TC>
8529 :exmp.
8530
8531 :etext.
This page took 0.215226 seconds and 5 git commands to generate.