8930eefa |
1 | .****************************************************************************** |
2 | .* Copyright (c) 2000-2016 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 | .* Contributors: |
9 | .* Adrien Kirjak – initial implementation |
10 | .* |
11 | .******************************************************************************/ |
12 | text. |
13 | :lang eng. |
14 | .* |
15 | :docname.Test Description |
16 | :docno.xz/152 91-CRL 113 200 Uen |
17 | :rev.PA1 |
18 | :date.2016-04-04 |
19 | .* |
20 | :prep.ETH/XZ EADRKIR |
21 | :subresp.EADRKIR |
22 | :appr.ETH/XZ (Elemer Lelik) |
23 | :checked. |
24 | .* |
25 | :title.ETSI TTCN3 Negative Conformance Test |
26 | :contents level=3. |
27 | .*---------------------------------------------------------------------* |
28 | :h1.PREREQUISITES AND PREPARATIONS |
29 | .*---------------------------------------------------------------------* |
30 | .*---------------------------------------------------------------------* |
31 | :h2.Scope of the Test Object |
32 | .*---------------------------------------------------------------------* |
33 | :xmp tab=1 nokeep. |
34 | This TD contains negative tests from ETSI TTCN3 Conformance Test's 07_expressions, 08_modules, 09_test_configurations, 10_constants, 11_variables, 12_timers and 14_procedure_signatures folders. |
35 | |
36 | :exmp. |
37 | |
38 | .*---------------------------------------------------------------------* |
39 | :h2.Test Tools |
40 | .*---------------------------------------------------------------------* |
41 | :p.:us.Software Tools:eus. |
42 | :xmp tab=2 nokeep. |
43 | |
44 | SAtester.pl |
45 | |
46 | :exmp. |
47 | :np. |
48 | |
49 | .*---------------------------------------------------------------------* |
50 | :h1.REQUIREMENT-BASED TESTS |
51 | .*---------------------------------------------------------------------* |
52 | .*---------------------------------------------------------------------* |
53 | :h2. 07_expressions folder |
54 | .*---------------------------------------------------------------------* |
55 | *---------------------------------------------------------------------* |
56 | :h3. NegSem_07_toplevel_001 negative test |
57 | .*---------------------------------------------------------------------* |
58 | :xmp tab=0. |
59 | |
60 | <TC - function without return clause in expression > |
61 | |
62 | <COMPILE> |
63 | |
64 | <MODULE TTCN NegSem_07_toplevel_001 NegSem_07_toplevel_001.ttcn > |
65 | /*************************************************** |
66 | ** @version 0.0.1 |
67 | ** @purpose 1:7, function without return clause in expression |
68 | ** @verdict pass reject |
69 | ***************************************************/ |
70 | |
71 | // The following requirement is tested: |
72 | // Functions used in expressions shall have a return clause. |
73 | |
74 | module NegSem_07_toplevel_001 |
75 | { |
76 | type component GeneralComp { |
77 | } |
78 | |
79 | function f() |
80 | { |
81 | var integer v_num := 1; |
82 | } |
83 | |
84 | testcase TC_NegSem_07_toplevel_001() runs on GeneralComp { |
85 | var integer v_num := 3 * f(); |
86 | setverdict(pass); |
87 | } |
88 | |
89 | control { |
90 | execute(TC_NegSem_07_toplevel_001()); |
91 | } |
92 | } |
93 | <END_MODULE> |
94 | |
95 | <RESULT COUNT 1> |
96 | error: Reference to a value was expected instead of a call of function `@NegSem_07_toplevel_001.f', which does not have return type |
97 | <END_RESULT> |
98 | |
99 | <END_TC> |
100 | :exmp |
101 | |
102 | *---------------------------------------------------------------------* |
103 | :h3. NegSem_07_toplevel_002 negative test |
104 | .*---------------------------------------------------------------------* |
105 | :xmp tab=0. |
106 | |
107 | <TC - template used as expression operand > |
108 | |
109 | <COMPILE> |
110 | |
111 | <MODULE TTCN NegSem_07_toplevel_002 NegSem_07_toplevel_002.ttcn > |
112 | /*************************************************** |
113 | ** @version 0.0.1 |
114 | ** @purpose 1:7, template used as expression operand |
115 | ** @verdict pass reject |
116 | ***************************************************/ |
117 | |
118 | // The following requirement is tested: |
119 | // The operands of the operators used in an expression shall be values and their root |
120 | // types shall be the types specified for the appropriate operator in the subsequent |
121 | // clauses. |
122 | |
123 | module NegSem_07_toplevel_002 |
124 | { |
125 | type component GeneralComp { |
126 | } |
127 | |
128 | function f() |
129 | { |
130 | var integer p_num := 1; |
131 | } |
132 | |
133 | testcase TC_NegSem_07_toplevel_002() runs on GeneralComp { |
134 | var template(value) integer vm_num := 3; |
135 | var integer p_num := 3 * vm_num; |
136 | setverdict(pass); |
137 | } |
138 | |
139 | control { |
140 | execute(TC_NegSem_07_toplevel_002()); |
141 | } |
142 | } |
143 | <END_MODULE> |
144 | |
145 | <RESULT COUNT 1> |
146 | error: Reference to a value was expected instead of template variable `vm_num' |
147 | <END_RESULT> |
148 | |
149 | <END_TC> |
150 | :exmp |
151 | |
152 | *---------------------------------------------------------------------* |
153 | :h3. NegSem_07_toplevel_003 negative test |
154 | .*---------------------------------------------------------------------* |
155 | :xmp tab=0. |
156 | |
157 | <TC - uninitialized value in an expression > |
158 | |
159 | <COMPILE> |
160 | <EXECUTE_PARALLEL> |
161 | |
162 | <MODULE TTCN NegSem_07_toplevel_003 NegSem_07_toplevel_003.ttcn > |
163 | /*************************************************** |
164 | ** @version 0.0.1 |
165 | ** @purpose 1:7, uninitialized value in an expression |
166 | ** @verdict pass reject |
167 | ***************************************************/ |
168 | |
169 | // The following requirement is tested: |
170 | // At the point, when an expression is evaluated, the evaluated values of the |
171 | // operands used in expressions shall be completely initialized except where |
172 | // explicitly stated otherwise in the specific clause of the operator. |
173 | |
174 | module NegSem_07_toplevel_003 |
175 | { |
176 | type component GeneralComp { |
177 | } |
178 | |
179 | type record R { |
180 | integer field1, |
181 | integer field2 optional |
182 | } |
183 | |
184 | testcase TC_NegSem_07_toplevel_003() runs on GeneralComp { |
185 | var R v_rec; |
186 | v_rec.field1 := 1; |
187 | if (10 + v_rec.field2 != -1) { setverdict(pass); } |
188 | else { setverdict(fail); } |
189 | } |
190 | |
191 | control { |
192 | execute(TC_NegSem_07_toplevel_003()); |
193 | } |
194 | } |
195 | <END_MODULE> |
196 | |
197 | <RESULT COUNT 1> |
198 | Dynamic test case error: Using the value of an optional field containing omit. |
199 | <END_RESULT> |
200 | |
201 | <END_TC> |
202 | :exmp |
203 | |
204 | *---------------------------------------------------------------------* |
205 | :h3. NegSem_070101_ArithmeticOperators_001 negative test |
206 | .*---------------------------------------------------------------------* |
207 | :xmp tab=0. |
208 | |
209 | <TC - Ensure that Arithmetic operators are for integer and float values > |
210 | |
211 | <COMPILE> |
212 | |
213 | <MODULE TTCN NegSem_070101_ArithmeticOperators_001 NegSem_070101_ArithmeticOperators_001.ttcn > |
214 | /***************************************************************** |
215 | ** @version 0.0.1 |
216 | ** @purpose 1:7.1.1, Ensure that Arithmetic operators are for integer and float values |
217 | ** @verdict pass reject |
218 | *****************************************************************/ |
219 | |
220 | module NegSem_070101_ArithmeticOperators_001 { |
221 | |
222 | type component GeneralComp { |
223 | } |
224 | |
225 | testcase TC_NegSem_070101_ArithmeticOperators_001() runs on GeneralComp { |
226 | var integer v_i := 20; |
227 | var boolean v_k :=true; |
228 | |
229 | var integer v_result := v_i*v_k; // not allowed int*boolean |
230 | |
231 | setverdict(pass); |
232 | |
233 | |
234 | } |
235 | control{ |
236 | execute(TC_NegSem_070101_ArithmeticOperators_001()); |
237 | } |
238 | |
239 | } |
240 | <END_MODULE> |
241 | |
242 | <RESULT COUNT 1> |
243 | error: Second operand of operation `\*' should be integer or float value |
244 | <END_RESULT> |
245 | <RESULT COUNT 1> |
246 | error: The operands of operation `\*' should be of same type |
247 | <END_RESULT> |
248 | |
249 | <END_TC> |
250 | :exmp |
251 | |
252 | |
253 | *---------------------------------------------------------------------* |
254 | :h3. NegSem_070101_ArithmeticOperators_002 negative test |
255 | .*---------------------------------------------------------------------* |
256 | :xmp tab=0. |
257 | |
258 | <TC - Ensure that arithmetic operators can handle same type of variables > |
259 | |
260 | <COMPILE> |
261 | |
262 | <MODULE TTCN NegSem_070101_ArithmeticOperators_002 NegSem_070101_ArithmeticOperators_002.ttcn > |
263 | /***************************************************************** |
264 | ** @version 0.0.1 |
265 | ** @purpose 1:7.1.1, Ensure that arithmetic operators can handle same type of variables |
266 | ** @verdict pass reject |
267 | *****************************************************************/ |
268 | |
269 | module NegSem_070101_ArithmeticOperators_002 { |
270 | |
271 | type component GeneralComp { |
272 | } |
273 | |
274 | testcase TC_NegSem_070101_ArithmeticOperators_002() runs on GeneralComp { |
275 | var integer v_i := 20; |
276 | var float v_k :=2.0E0; |
277 | |
278 | var integer v_result := v_i*v_k; // not allowed int*float |
279 | |
280 | setverdict(pass); |
281 | |
282 | } |
283 | control{ |
284 | execute(TC_NegSem_070101_ArithmeticOperators_002()); |
285 | } |
286 | |
287 | } |
288 | <END_MODULE> |
289 | |
290 | <RESULT COUNT 1> |
291 | error: The operands of operation `\*' should be of same type |
292 | <END_RESULT> |
293 | |
294 | <END_TC> |
295 | :exmp |
296 | |
297 | *---------------------------------------------------------------------* |
298 | :h3. NegSem_070101_ArithmeticOperators_003 negative test |
299 | .*---------------------------------------------------------------------* |
300 | :xmp tab=0. |
301 | |
302 | <TC - Ensure that mod arithmetic operator can handle integer variables > |
303 | |
304 | <COMPILE> |
305 | |
306 | <MODULE TTCN NegSem_070101_ArithmeticOperators_003 NegSem_070101_ArithmeticOperators_003.ttcn > |
307 | /***************************************************************** |
308 | ** @version 0.0.1 |
309 | ** @purpose 1:7.1.1, Ensure that mod arithmetic operator can handle integer variables |
310 | ** @verdict pass reject |
311 | *****************************************************************/ |
312 | |
313 | module NegSem_070101_ArithmeticOperators_003 { |
314 | |
315 | type component GeneralComp { |
316 | } |
317 | |
318 | testcase TC_NegSem_070101_ArithmeticOperators_003() runs on GeneralComp { |
319 | var float v_i := 2.0E1; |
320 | var float v_k :=2.0E0; |
321 | |
322 | var integer v_result := v_i mod v_k; // mod operator is only for integer type |
323 | |
324 | setverdict(pass); |
325 | } |
326 | control{ |
327 | execute(TC_NegSem_070101_ArithmeticOperators_003()); |
328 | } |
329 | |
330 | } |
331 | <END_MODULE> |
332 | |
333 | <RESULT COUNT 1> |
334 | error: Left operand of operation `mod' should be integer value |
335 | <END_RESULT> |
336 | <RESULT COUNT 1> |
337 | error: Right operand of operation `mod' should be integer value |
338 | <END_RESULT> |
339 | |
340 | <END_TC> |
341 | :exmp |
342 | |
343 | *---------------------------------------------------------------------* |
344 | :h3. NegSem_070101_ArithmeticOperators_004 negative test |
345 | .*---------------------------------------------------------------------* |
346 | :xmp tab=0. |
347 | |
348 | <TC - Ensure that rem arithmetic operator can handle integer variables > |
349 | |
350 | <COMPILE> |
351 | |
352 | <MODULE TTCN NegSem_070101_ArithmeticOperators_004 NegSem_070101_ArithmeticOperators_004.ttcn > |
353 | /***************************************************************** |
354 | ** @version 0.0.1 |
355 | ** @purpose 1:7.1.1, Ensure that rem arithmetic operator can handle integer variables |
356 | ** @verdict pass reject |
357 | *****************************************************************/ |
358 | |
359 | module NegSem_070101_ArithmeticOperators_004 { |
360 | |
361 | type component GeneralComp { |
362 | } |
363 | |
364 | testcase TC_NegSem_070101_ArithmeticOperators_004() runs on GeneralComp { |
365 | var float v_i := 2.0E1; |
366 | var float v_k :=2.0E0; |
367 | |
368 | var integer v_result := v_i rem v_k; // rem operator is only for integer type |
369 | |
370 | setverdict(pass); |
371 | } |
372 | control{ |
373 | execute(TC_NegSem_070101_ArithmeticOperators_004()); |
374 | } |
375 | |
376 | } |
377 | <END_MODULE> |
378 | |
379 | <RESULT COUNT 1> |
380 | error: Left operand of operation `rem' should be integer value |
381 | <END_RESULT> |
382 | <RESULT COUNT 1> |
383 | error: Right operand of operation `rem' should be integer value |
384 | <END_RESULT> |
385 | |
386 | <END_TC> |
387 | :exmp |
388 | |
389 | *---------------------------------------------------------------------* |
390 | :h3. NegSem_070101_ArithmeticOperators_008 negative test |
391 | .*---------------------------------------------------------------------* |
392 | :xmp tab=0. |
393 | |
394 | <TC - Ensure that in x mod y arithmetic operator y is non-zero positive number > |
395 | |
396 | <COMPILE> |
397 | <EXECUTE_PARALLEL> |
398 | |
399 | <MODULE TTCN NegSem_070101_ArithmeticOperators_008 NegSem_070101_ArithmeticOperators_008.ttcn > |
400 | /***************************************************************** |
401 | ** @version 0.0.1 |
402 | ** @purpose 1:7.1.1, Ensure that in x mod y arithmetic operator y is non-zero positive number |
403 | ** @verdict pass reject |
404 | *****************************************************************/ |
405 | |
406 | module NegSem_070101_ArithmeticOperators_008 { |
407 | |
408 | type component GeneralComp { |
409 | } |
410 | |
411 | testcase TC_NegSem_070101_ArithmeticOperators_008() runs on GeneralComp { |
412 | var integer v_i := 20; |
413 | var integer v_k :=0; |
414 | |
415 | var integer v_result := v_i mod v_k; // arithmetic operator mod with 0 is not allowed |
416 | |
417 | setverdict(pass); |
418 | |
419 | } |
420 | control{ |
421 | execute(TC_NegSem_070101_ArithmeticOperators_008()); |
422 | } |
423 | |
424 | } |
425 | <END_MODULE> |
426 | |
427 | <RESULT COUNT 1> |
428 | Dynamic test case error: The right operand of mod operator is zero. |
429 | <END_RESULT> |
430 | |
431 | <END_TC> |
432 | :exmp |
433 | |
434 | *---------------------------------------------------------------------* |
435 | :h3. NegSem_070101_ArithmeticOperators_009 negative test |
436 | .*---------------------------------------------------------------------* |
437 | :xmp tab=0. |
438 | |
439 | <TC - Ensure that in x rem y arithmetic operator y is non-zero positive number > |
440 | |
441 | <COMPILE> |
442 | <EXECUTE_PARALLEL> |
443 | |
444 | <MODULE TTCN NegSem_070101_ArithmeticOperators_009 NegSem_070101_ArithmeticOperators_009.ttcn > |
445 | /***************************************************************** |
446 | ** @version 0.0.1 |
447 | ** @purpose 1:7.1.1, Ensure that in x rem y arithmetic operator y is non-zero positive number |
448 | ** @verdict pass reject |
449 | *****************************************************************/ |
450 | |
451 | module NegSem_070101_ArithmeticOperators_009 { |
452 | |
453 | type component GeneralComp { |
454 | } |
455 | |
456 | testcase TC_NegSem_070101_ArithmeticOperators_009() runs on GeneralComp { |
457 | var integer v_i := 20; |
458 | var integer v_k :=0; |
459 | |
460 | var integer v_result := v_i rem v_k; // arithmetic operator rem with 0 is not allowed |
461 | |
462 | setverdict(pass); |
463 | |
464 | } |
465 | control{ |
466 | execute(TC_NegSem_070101_ArithmeticOperators_009()); |
467 | } |
468 | |
469 | } |
470 | <END_MODULE> |
471 | |
472 | <RESULT COUNT 1> |
473 | Dynamic test case error: Integer division by zero. |
474 | <END_RESULT> |
475 | |
476 | <END_TC> |
477 | :exmp |
478 | |
479 | *---------------------------------------------------------------------* |
480 | :h3. NegSem_070101_ArithmeticOperators_010 negative test |
481 | .*---------------------------------------------------------------------* |
482 | :xmp tab=0. |
483 | |
484 | <TC - Ensure that in x rem y arithmetic operator y is non-zero positive number > |
485 | |
486 | <COMPILE> |
487 | <EXECUTE_PARALLEL> |
488 | |
489 | <MODULE TTCN NegSem_070101_ArithmeticOperators_010 NegSem_070101_ArithmeticOperators_010.ttcn > |
490 | /***************************************************************** |
491 | ** @version 0.0.1 |
492 | ** @purpose 1:7.1.1, Ensure that in x rem y arithmetic operator y is non-zero positive number |
493 | ** @verdict pass reject |
494 | *****************************************************************/ |
495 | |
496 | module NegSem_070101_ArithmeticOperators_010 { |
497 | |
498 | type component GeneralComp { |
499 | } |
500 | |
501 | testcase TC_NegSem_070101_ArithmeticOperators_010() runs on GeneralComp { |
502 | var integer v_i := 20; |
503 | var integer v_k :=4; |
504 | var integer v_l :=2; |
505 | |
506 | var integer v_result := v_i rem (v_k mod v_l); // arithmetic operator rem with 0 is not allowed |
507 | |
508 | setverdict(pass); |
509 | |
510 | } |
511 | control{ |
512 | execute(TC_NegSem_070101_ArithmeticOperators_010()); |
513 | } |
514 | |
515 | } |
516 | <END_MODULE> |
517 | |
518 | <RESULT COUNT 1> |
519 | Dynamic test case error: Integer division by zero. |
520 | <END_RESULT> |
521 | |
522 | <END_TC> |
523 | :exmp |
524 | |
525 | *---------------------------------------------------------------------* |
526 | :h3. NegSem_070103_RelationalOperators_002 negative test |
527 | .*---------------------------------------------------------------------* |
528 | :xmp tab=0. |
529 | |
530 | <TC - Ensure that the equals operator on records is evaluated correctly. > |
531 | |
532 | <COMPILE> |
533 | |
534 | <MODULE TTCN NegSem_070103_RelationalOperators_002 NegSem_070103_RelationalOperators_002.ttcn > |
535 | /***************************************************************** |
536 | ** @version 0.0.1 |
537 | ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. |
538 | ** @verdict pass reject |
539 | *****************************************************************/ |
540 | |
541 | module NegSem_070103_RelationalOperators_002 { |
542 | |
543 | type component GeneralComp { |
544 | } |
545 | |
546 | type set IntegerSet1 { |
547 | integer a1 optional, |
548 | integer a2 optional, |
549 | integer a3 optional |
550 | }; |
551 | |
552 | type set IntegerSet2 { |
553 | integer a4 optional, |
554 | integer a5 optional, |
555 | integer a6 optional |
556 | }; |
557 | |
558 | type set LargeSet { |
559 | integer a1 optional, |
560 | integer a2 optional, |
561 | integer a3 optional, |
562 | integer a4 optional, |
563 | integer a5 optional, |
564 | integer a6 optional |
565 | }; |
566 | |
567 | |
568 | testcase TC_NegSem_070103_RelationalOperators_002() runs on GeneralComp { |
569 | const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; |
570 | const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; |
571 | const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5,a6:=omit}; |
572 | |
573 | if ( c_set1 & c_set2 == c_large ) { //It is intentionally forbidden to concatenate record and set values |
574 | setverdict(pass); |
575 | } |
576 | |
577 | } |
578 | |
579 | control{ |
580 | execute(TC_NegSem_070103_RelationalOperators_002()); |
581 | } |
582 | |
583 | } |
584 | <END_MODULE> |
585 | |
586 | <RESULT COUNT 1> |
587 | error: Left operand of operation `&' should be a string, `record of' or `set of' value |
588 | <END_RESULT> |
589 | <RESULT COUNT 1> |
590 | error: Right operand of operation `&' should be a string, `record of' or `set of' value |
591 | <END_RESULT> |
592 | |
593 | <END_TC> |
594 | :exmp |
595 | |
596 | *---------------------------------------------------------------------* |
597 | :h3. NegSem_070103_RelationalOperators_003 negative test |
598 | .*---------------------------------------------------------------------* |
599 | :xmp tab=0. |
600 | |
601 | <TC - Ensure that the equals operator on records is evaluated correctly. > |
602 | |
603 | <COMPILE> |
604 | |
605 | <MODULE TTCN NegSem_070103_RelationalOperators_003 NegSem_070103_RelationalOperators_003.ttcn > |
606 | /***************************************************************** |
607 | ** @version 0.0.1 |
608 | ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. |
609 | ** @verdict pass reject |
610 | *****************************************************************/ |
611 | //on hold till resolution of CR6707 |
612 | |
613 | module NegSem_070103_RelationalOperators_003 { |
614 | |
615 | type component GeneralComp { |
616 | } |
617 | |
618 | type set IntegerSet1 { |
619 | integer a1 optional, |
620 | integer a2 optional, |
621 | integer a3 optional |
622 | }; |
623 | |
624 | type set IntegerSet2 { |
625 | integer a4 optional, |
626 | integer a5 optional, |
627 | integer a6 optional |
628 | }; |
629 | |
630 | type set LargeSet { |
631 | integer a1 optional, |
632 | integer a2 optional, |
633 | integer a3 optional, |
634 | integer a4 optional, |
635 | integer a5 optional, |
636 | integer a6 optional |
637 | }; |
638 | |
639 | |
640 | testcase TC_NegSem_070103_RelationalOperators_003() runs on GeneralComp { |
641 | const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; |
642 | const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; |
643 | const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5,a6:=6}; |
644 | |
645 | if ( c_set1 & c_set2 != c_large ) { //It is intentionally forbidden to concatenate record and set values |
646 | setverdict(pass); |
647 | } |
648 | |
649 | } |
650 | |
651 | control{ |
652 | execute(TC_NegSem_070103_RelationalOperators_003()); |
653 | } |
654 | |
655 | } |
656 | <END_MODULE> |
657 | |
658 | <RESULT COUNT 1> |
659 | error: Left operand of operation `&' should be a string, `record of' or `set of' value |
660 | <END_RESULT> |
661 | <RESULT COUNT 1> |
662 | error: Right operand of operation `&' should be a string, `record of' or `set of' value |
663 | <END_RESULT> |
664 | |
665 | <END_TC> |
666 | :exmp |
667 | |
668 | *---------------------------------------------------------------------* |
669 | :h3. NegSem_070103_RelationalOperators_004 negative test |
670 | .*---------------------------------------------------------------------* |
671 | :xmp tab=0. |
672 | |
673 | <TC - Ensure that the equals operator on records is evaluated correctly. > |
674 | |
675 | <COMPILE> |
676 | |
677 | <MODULE TTCN NegSem_070103_RelationalOperators_004 NegSem_070103_RelationalOperators_004.ttcn > |
678 | /***************************************************************** |
679 | ** @version 0.0.1 |
680 | ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. |
681 | ** @verdict pass reject |
682 | *****************************************************************/ |
683 | //on hold till resolution of CR6707 |
684 | |
685 | module NegSem_070103_RelationalOperators_004 { |
686 | |
687 | type component GeneralComp { |
688 | } |
689 | |
690 | type set IntegerSet1 { |
691 | integer a1 optional, |
692 | integer a2 optional, |
693 | integer a3 optional |
694 | }; |
695 | |
696 | type set IntegerSet2 { |
697 | integer a4 optional, |
698 | integer a5 optional, |
699 | integer a6 optional |
700 | }; |
701 | |
702 | type set LargeSet { |
703 | integer a1 optional, |
704 | integer a2 optional, |
705 | integer a3 optional, |
706 | integer a4 optional, |
707 | integer a5 optional |
708 | }; |
709 | |
710 | |
711 | testcase TC_NegSem_070103_RelationalOperators_004() runs on GeneralComp { |
712 | const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; |
713 | const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; |
714 | const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5}; |
715 | |
716 | if ( c_set1 & c_set2 != c_large ) { //It is intentionally forbidden to concatenate record and set values |
717 | setverdict(pass); |
718 | } |
719 | |
720 | } |
721 | |
722 | control{ |
723 | execute(TC_NegSem_070103_RelationalOperators_004()); |
724 | } |
725 | |
726 | } |
727 | <END_MODULE> |
728 | |
729 | <RESULT COUNT 1> |
730 | error: Left operand of operation `&' should be a string, `record of' or `set of' value |
731 | <END_RESULT> |
732 | <RESULT COUNT 1> |
733 | error: Right operand of operation `&' should be a string, `record of' or `set of' value |
734 | <END_RESULT> |
735 | |
736 | <END_TC> |
737 | :exmp |
738 | |
739 | .*---------------------------------------------------------------------* |
740 | :h2. 08_modules folder |
741 | .*---------------------------------------------------------------------* |
742 | |
743 | *---------------------------------------------------------------------* |
744 | :h3. NegSyn_0801_DefinitionOfAModule_001 negative test |
745 | .*---------------------------------------------------------------------* |
746 | :xmp tab=0. |
747 | |
748 | <TC - Ensure that a module definition with multiple language specifications is rejected. > |
749 | |
750 | <COMPILE> |
751 | |
752 | <MODULE TTCN NegSyn_0801_DefinitionOfAModule_001 NegSyn_0801_DefinitionOfAModule_001.ttcn > |
753 | /***************************************************************** |
754 | ** @version 0.0.1 |
755 | ** @purpose 1:8.1, Ensure that a module definition with multiple language specifications is rejected. |
756 | ** @verdict pass reject |
757 | *****************************************************************/ |
758 | // list of languages is not allowed |
759 | module NegSyn_0801_DefinitionOfAModule_001 language "TTCN-3:2005", "TTCN-3:2009", "TTCN-3:2010" { |
760 | |
761 | } |
762 | <END_MODULE> |
763 | |
764 | <RESULT COUNT 1> |
765 | error: at or before token `,': syntax error, unexpected ',', expecting '\{' |
766 | <END_RESULT> |
767 | |
768 | <END_TC> |
769 | :exmp |
770 | |
771 | *---------------------------------------------------------------------* |
772 | :h3. NegSem_08020301_GeneralFormatOfImport_002 negative test |
773 | .*---------------------------------------------------------------------* |
774 | :xmp tab=0. |
775 | |
776 | <TC - Ensure that name handling of imported enumerations is properly handled > |
777 | |
778 | <COMPILE> |
779 | |
780 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_002 NegSem_08020301_GeneralFormatOfImport_002.ttcn > |
781 | /***************************************************************** |
782 | ** @version 0.0.1 |
783 | ** @purpose 1:8.2.3.1, Ensure that name handling of imported enumerations is properly handled |
784 | ** @verdict pass reject |
785 | *****************************************************************/ |
786 | |
787 | module NegSem_08020301_GeneralFormatOfImport_002 { |
788 | import from NegSem_08020301_GeneralFormatOfImport_002_import all; |
789 | |
790 | const EnumType2 c_enum := enumX; |
791 | |
792 | modulepar EnumType px_ModulePar := NegSem_08020301_GeneralFormatOfImport_002.c_enum; //type mismatch |
793 | } |
794 | <END_MODULE> |
795 | |
796 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_002_import NegSem_08020301_GeneralFormatOfImport_002_import.ttcn > |
797 | module NegSem_08020301_GeneralFormatOfImport_002_import { |
798 | type enumerated EnumType {enumX, enumY, enumZ}; |
799 | type enumerated EnumType2 {enumX, enumY, enumZ}; |
800 | |
801 | } |
802 | <END_MODULE> |
803 | |
804 | <RESULT COUNT 1> |
805 | error: Type mismatch: a value of type `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType' was expected instead of `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType2' |
806 | <END_RESULT> |
807 | |
808 | <END_TC> |
809 | :exmp |
810 | |
811 | *---------------------------------------------------------------------* |
812 | :h3. NegSem_08020301_GeneralFormatOfImport_003 negative test |
813 | .*---------------------------------------------------------------------* |
814 | :xmp tab=0. |
815 | |
816 | <TC - Ensure that name handling of imported enumerations is properly handled > |
817 | |
818 | <COMPILE> |
819 | |
820 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003 NegSem_08020301_GeneralFormatOfImport_003.ttcn > |
821 | /***************************************************************** |
822 | ** @version 0.0.1 |
823 | ** @purpose 1:8.2.3.4, Ensure that transitive import rules are properly handled |
824 | ** @verdict pass reject |
825 | *****************************************************************/ |
826 | |
827 | |
828 | module NegSem_08020301_GeneralFormatOfImport_003 { |
829 | |
830 | import from NegSem_08020301_GeneralFormatOfImport_003_import { |
831 | const all; |
832 | }; |
833 | |
834 | type component GeneralComp {} |
835 | |
836 | testcase TC_NegSem_08020301_GeneralFormatOfImport_003() runs on GeneralComp { |
837 | if (c_myconst == 43532) { |
838 | setverdict(pass); |
839 | } else { |
840 | setverdict(fail); |
841 | } |
842 | } |
843 | |
844 | control{ |
845 | execute(TC_NegSem_08020301_GeneralFormatOfImport_003()); |
846 | } |
847 | } |
848 | <END_MODULE> |
849 | |
850 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003_import NegSem_08020301_GeneralFormatOfImport_003_import.ttcn > |
851 | |
852 | module NegSem_08020301_GeneralFormatOfImport_003_import { |
853 | public import from NegSem_08020301_GeneralFormatOfImport_003_import_2 all; |
854 | } |
855 | <END_MODULE> |
856 | |
857 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003_import_2 NegSem_08020301_GeneralFormatOfImport_003_import_2.ttcn > |
858 | |
859 | module NegSem_08020301_GeneralFormatOfImport_003_import_2 { |
860 | const integer c_myconst := 43532; |
861 | } |
862 | <END_MODULE> |
863 | |
864 | <RESULT COUNT 1> |
865 | error: There is no local or imported definition with name `c_myconst' |
866 | <END_RESULT> |
867 | |
868 | <END_TC> |
869 | :exmp |
870 | |
871 | |
872 | *---------------------------------------------------------------------* |
873 | :h3. NegSem_08020301_GeneralFormatOfImport_004 negative test |
874 | .*---------------------------------------------------------------------* |
875 | :xmp tab=0. |
876 | |
877 | <TC - Ensure that transitive import rules are properly handled > |
878 | |
879 | <COMPILE> |
880 | |
881 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004 NegSem_08020301_GeneralFormatOfImport_004.ttcn > |
882 | /***************************************************************** |
883 | ** @version 0.0.1 |
884 | ** @purpose 1:8.2.3.4, Ensure that transitive import rules are properly handled |
885 | ** @verdict pass reject |
886 | *****************************************************************/ |
887 | |
888 | |
889 | module NegSem_08020301_GeneralFormatOfImport_004 { |
890 | |
891 | import from NegSem_08020301_GeneralFormatOfImport_004_import all; |
892 | |
893 | type component GeneralComp {} |
894 | |
895 | testcase TC_NegSem_08020301_GeneralFormatOfImport_004() runs on GeneralComp { |
896 | if (c_myconst == 43532) { |
897 | setverdict(pass); |
898 | } else { |
899 | setverdict(fail); |
900 | } |
901 | } |
902 | |
903 | control{ |
904 | execute(TC_NegSem_08020301_GeneralFormatOfImport_004()); |
905 | } |
906 | } |
907 | <END_MODULE> |
908 | |
909 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004_import NegSem_08020301_GeneralFormatOfImport_004_import.ttcn > |
910 | |
911 | module NegSem_08020301_GeneralFormatOfImport_004_import { |
912 | import from NegSem_08020301_GeneralFormatOfImport_004_import_2 all; |
913 | } |
914 | <END_MODULE> |
915 | |
916 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004_import_2 NegSem_08020301_GeneralFormatOfImport_004_import_2.ttcn > |
917 | |
918 | module NegSem_08020301_GeneralFormatOfImport_004_import_2 { |
919 | const integer c_myconst := 43532; |
920 | } |
921 | <END_MODULE> |
922 | |
923 | <RESULT COUNT 1> |
924 | error: There is no local or imported definition with name `c_myconst' |
925 | <END_RESULT> |
926 | |
927 | <END_TC> |
928 | :exmp |
929 | |
930 | |
931 | *---------------------------------------------------------------------* |
932 | :h3. NegSem_08020301_GeneralFormatOfImport_005 negative test |
933 | .*---------------------------------------------------------------------* |
934 | :xmp tab=0. |
935 | |
936 | <TC - Make sure that the identifier of the current module cannot be used for prefixing imported entities > |
937 | |
938 | <COMPILE> |
939 | |
940 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_005 NegSem_08020301_GeneralFormatOfImport_005.ttcn > |
941 | /***************************************************************** |
942 | ** @version 0.0.1 |
943 | ** @purpose 1:8.2.3.1, Make sure that the identifier of the current module cannot be used for prefixing imported entities |
944 | ** @verdict pass reject |
945 | *****************************************************************/ |
946 | |
947 | // The following requirements are tested: |
948 | // Name clashes shall be resolved using qualified name(s) for the imported definition(s), |
949 | // i.e. prefixing the imported definition by the identifier of the module in which it has |
950 | // been defined; the prefix and the identifier shall be separated by a dot ("."). |
951 | // In cases where there are no ambiguities the prefixing need not (but may) be present |
952 | // when the imported definitions are used. |
953 | |
954 | module NegSem_08020301_GeneralFormatOfImport_005 { |
955 | |
956 | import from NegSem_08020301_GeneralFormatOfImport_005_import all; |
957 | |
958 | type component GeneralComp {} |
959 | |
960 | testcase TC_NegSem_08020301_GeneralFormatOfImport_005() runs on GeneralComp { |
961 | log(NegSem_08020301_GeneralFormatOfImport_005.c_test); |
962 | setverdict(pass); |
963 | } |
964 | |
965 | control{ |
966 | execute(TC_NegSem_08020301_GeneralFormatOfImport_005()); |
967 | } |
968 | } |
969 | |
970 | <END_MODULE> |
971 | |
972 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_005_import NegSem_08020301_GeneralFormatOfImport_005_import.ttcn > |
973 | |
974 | module NegSem_08020301_GeneralFormatOfImport_005_import { |
975 | const integer c_test := 5; |
976 | } |
977 | <END_MODULE> |
978 | |
979 | |
980 | <RESULT COUNT 1> |
981 | error: There is no definition with name `c_test' in module `NegSem_08020301_GeneralFormatOfImport_005' |
982 | <END_RESULT> |
983 | |
984 | <END_TC> |
985 | :exmp |
986 | |
987 | *---------------------------------------------------------------------* |
988 | :h3. NegSem_08020301_GeneralFormatOfImport_006 negative test |
989 | .*---------------------------------------------------------------------* |
990 | :xmp tab=0. |
991 | |
992 | <TC - Ensure that the only top-level visible definitions of a module may be imported. > |
993 | |
994 | <COMPILE> |
995 | |
996 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_006 NegSem_08020301_GeneralFormatOfImport_006.ttcn > |
997 | /***************************************************************** |
998 | ** @version 0.0.1 |
999 | ** @purpose 1:8.2.3.1, Ensure that the only top-level visible definitions of a module may be imported. |
1000 | ** @verdict pass reject |
1001 | *****************************************************************/ |
1002 | |
1003 | // The following requirements are tested: |
1004 | // Restriction b: |
1005 | // Only top-level visible definitions of a module may be imported. Definitions which |
1006 | // are top-level but invisible to the importing module or which occur at a lower scope |
1007 | // (e.g. local constants defined in a function) shall not be imported. |
1008 | |
1009 | module NegSem_08020301_GeneralFormatOfImport_006 { |
1010 | import from NegSem_08020301_GeneralFormatOfImport_006_import { const c_test }; |
1011 | |
1012 | type component GeneralComp {} |
1013 | |
1014 | testcase TC_NegSem_08020301_GeneralFormatOfImport_006() runs on GeneralComp { |
1015 | log(c_test); |
1016 | setverdict(pass); |
1017 | } |
1018 | |
1019 | control{ |
1020 | execute(TC_NegSem_08020301_GeneralFormatOfImport_006()); |
1021 | } |
1022 | } |
1023 | <END_MODULE> |
1024 | |
1025 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_006_import NegSem_08020301_GeneralFormatOfImport_006_import.ttcn > |
1026 | |
1027 | module NegSem_08020301_GeneralFormatOfImport_006_import { |
1028 | control { |
1029 | const integer c_test := 5; |
1030 | } |
1031 | } |
1032 | |
1033 | <END_MODULE> |
1034 | |
1035 | |
1036 | <RESULT COUNT 1> |
1037 | error: There is no local or imported definition with name `c_test' |
1038 | <END_RESULT> |
1039 | |
1040 | <END_TC> |
1041 | :exmp |
1042 | |
1043 | *---------------------------------------------------------------------* |
1044 | :h3. NegSem_08020301_GeneralFormatOfImport_007 negative test |
1045 | .*---------------------------------------------------------------------* |
1046 | :xmp tab=0. |
1047 | |
1048 | <TC - Verify that information about message types is imported together with port type > |
1049 | |
1050 | <COMPILE> |
1051 | |
1052 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_007 NegSem_08020301_GeneralFormatOfImport_007.ttcn > |
1053 | /***************************************************************** |
1054 | ** @version 0.0.1 |
1055 | ** @purpose 1:8.2.3.1, Verify that information about message types is imported together with port type |
1056 | ** @verdict pass reject |
1057 | *****************************************************************/ |
1058 | |
1059 | // The following requirements are tested: |
1060 | // Restriction d: |
1061 | // A definition is imported together with all information of referenced definitions that |
1062 | // are necessary for the usage of the imported definition, independent of the visibility |
1063 | // of the referenced definitions. |
1064 | // Table 8: |
1065 | // User defined type, port type |
1066 | |
1067 | module NegSem_08020301_GeneralFormatOfImport_007 { |
1068 | import from NegSem_08020301_GeneralFormatOfImport_007_import { type P }; |
1069 | |
1070 | type component GeneralComp { |
1071 | port P p1; |
1072 | } with {extension "internal"} |
1073 | |
1074 | testcase TC_NegSem_08020301_GeneralFormatOfImport_007() runs on GeneralComp { |
1075 | // Since the type of the sent message is not compatible with the allowed types of the imported |
1076 | // port type, a type compatibility error shall be generated. This proves that the type information |
1077 | // has been properly imported. |
1078 | p1.send(charstring:"abc"); |
1079 | setverdict(pass); |
1080 | } |
1081 | |
1082 | control{ |
1083 | execute(TC_NegSem_08020301_GeneralFormatOfImport_007()); |
1084 | } |
1085 | } |
1086 | <END_MODULE> |
1087 | |
1088 | <MODULE TTCN NegSem_08020301_GeneralFormatOfImport_007_import NegSem_08020301_GeneralFormatOfImport_007_import.ttcn > |
1089 | |
1090 | module NegSem_08020301_GeneralFormatOfImport_007_import { |
1091 | type port P message { |
1092 | inout integer; |
1093 | } |
1094 | } |
1095 | |
1096 | <END_MODULE> |
1097 | |
1098 | |
1099 | <RESULT COUNT 1> |
1100 | error: Incompatible explicit type specification: `integer' was expected instead of `charstring' |
1101 | <END_RESULT> |
1102 | |
1103 | <END_TC> |
1104 | :exmp |
1105 | |
1106 | *---------------------------------------------------------------------* |
1107 | :h3. NegSyn_08020301_GeneralFormatOfImport_001 negative test |
1108 | .*---------------------------------------------------------------------* |
1109 | :xmp tab=0. |
1110 | |
1111 | <TC - Ensure that import statement cannot be used in test case blocks > |
1112 | |
1113 | <COMPILE> |
1114 | |
1115 | <MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_001 NegSyn_08020301_GeneralFormatOfImport_001.ttcn > |
1116 | /***************************************************************** |
1117 | ** @version 0.0.1 |
1118 | ** @purpose 1:8.2.3.1, Ensure that import statement cannot be used in test case blocks |
1119 | ** @verdict pass reject |
1120 | *****************************************************************/ |
1121 | |
1122 | // The following requirements are tested: |
1123 | // Restriction a: |
1124 | // An import statement shall only be used in the module definitions part and not be used |
1125 | // within a control part, function definition, and alike. |
1126 | |
1127 | module NegSyn_08020301_GeneralFormatOfImport_001 { |
1128 | |
1129 | type component GeneralComp {} |
1130 | |
1131 | testcase TC_NegSyn_08020301_GeneralFormatOfImport_001() runs on GeneralComp { |
1132 | import from NegSyn_08020301_GeneralFormatOfImport_001_import all; |
1133 | log(c_test); |
1134 | setverdict(pass); |
1135 | } |
1136 | |
1137 | control{ |
1138 | execute(TC_NegSyn_08020301_GeneralFormatOfImport_001()); |
1139 | } |
1140 | } |
1141 | |
1142 | <END_MODULE> |
1143 | |
1144 | <MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_001_import NegSyn_08020301_GeneralFormatOfImport_001_import.ttcn > |
1145 | |
1146 | module NegSyn_08020301_GeneralFormatOfImport_001_import { |
1147 | const integer c_test := 5; |
1148 | } |
1149 | <END_MODULE> |
1150 | |
1151 | |
1152 | <RESULT COUNT 1> |
1153 | error: at or before token `import': syntax error, unexpected ImportKeyword |
1154 | <END_RESULT> |
1155 | |
1156 | <END_TC> |
1157 | :exmp |
1158 | |
1159 | *---------------------------------------------------------------------* |
1160 | :h3. NegSyn_08020301_GeneralFormatOfImport_002 negative test |
1161 | .*---------------------------------------------------------------------* |
1162 | :xmp tab=0. |
1163 | |
1164 | <TC - Ensure that import statement cannot be used in module control part > |
1165 | |
1166 | <COMPILE> |
1167 | |
1168 | <MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_002 NegSyn_08020301_GeneralFormatOfImport_002.ttcn > |
1169 | /***************************************************************** |
1170 | ** @version 0.0.1 |
1171 | ** @purpose 1:8.2.3.1, Ensure that import statement cannot be used in module control part |
1172 | ** @verdict pass reject |
1173 | *****************************************************************/ |
1174 | |
1175 | // The following requirements are tested: |
1176 | // Restriction a: |
1177 | // An import statement shall only be used in the module definitions part and not be used |
1178 | // within a control part, function definition, and alike. |
1179 | |
1180 | module NegSyn_08020301_GeneralFormatOfImport_002 { |
1181 | |
1182 | type component GeneralComp {} |
1183 | |
1184 | testcase TC_NegSyn_08020301_GeneralFormatOfImport_002() runs on GeneralComp { |
1185 | setverdict(pass); |
1186 | } |
1187 | |
1188 | control{ |
1189 | import from NegSyn_08020301_GeneralFormatOfImport_002_import all; |
1190 | log(c_test); |
1191 | execute(TC_NegSyn_08020301_GeneralFormatOfImport_002()); |
1192 | } |
1193 | |
1194 | } |
1195 | <END_MODULE> |
1196 | |
1197 | <MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_002_import NegSyn_08020301_GeneralFormatOfImport_002_import.ttcn > |
1198 | |
1199 | module NegSyn_08020301_GeneralFormatOfImport_002_import { |
1200 | const integer c_test := 5; |
1201 | } |
1202 | <END_MODULE> |
1203 | |
1204 | |
1205 | <RESULT COUNT 1> |
1206 | error: at or before token `import': syntax error, unexpected ImportKeyword |
1207 | <END_RESULT> |
1208 | |
1209 | <END_TC> |
1210 | :exmp |
1211 | |
1212 | *---------------------------------------------------------------------* |
1213 | :h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 negative test |
1214 | .*---------------------------------------------------------------------* |
1215 | :xmp tab=0. |
1216 | |
1217 | <TC - Ensure that the import of import statements works for import all. > |
1218 | |
1219 | <COMPILE> |
1220 | |
1221 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001.ttcn > |
1222 | /***************************************************************** |
1223 | ** @version 0.0.1 |
1224 | ** @purpose 1:8.2.3.7, Ensure that the import of import statements works for import all. |
1225 | ** @verdict pass reject |
1226 | *****************************************************************/ |
1227 | |
1228 | module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 { |
1229 | |
1230 | import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA { |
1231 | import all; |
1232 | }; |
1233 | |
1234 | type component GeneralComp {} |
1235 | |
1236 | testcase TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001() runs on GeneralComp { |
1237 | if (c_myconst == 43532) { // c_myconst shall not be accessible as the import in the importA module is private. |
1238 | setverdict(fail); |
1239 | } else { |
1240 | setverdict(pass); |
1241 | } |
1242 | } |
1243 | |
1244 | control{ |
1245 | execute(TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001()); |
1246 | } |
1247 | } |
1248 | <END_MODULE> |
1249 | |
1250 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA.ttcn > |
1251 | |
1252 | module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA { |
1253 | private import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB all; |
1254 | } |
1255 | |
1256 | <END_MODULE> |
1257 | |
1258 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB.ttcn > |
1259 | |
1260 | module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB { |
1261 | const integer c_myconst := 43532; |
1262 | } |
1263 | |
1264 | <END_MODULE> |
1265 | |
1266 | |
1267 | <RESULT COUNT 1> |
1268 | error: There is no local or imported definition with name `c_myconst' |
1269 | <END_RESULT> |
1270 | |
1271 | <END_TC> |
1272 | :exmp |
1273 | |
1274 | *---------------------------------------------------------------------* |
1275 | :h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 negative test |
1276 | .*---------------------------------------------------------------------* |
1277 | :xmp tab=0. |
1278 | |
1279 | <TC - Ensure that the import of import statements works for import all. > |
1280 | |
1281 | <COMPILE> |
1282 | |
1283 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002.ttcn > |
1284 | /***************************************************************** |
1285 | ** @version 0.0.1 |
1286 | ** @purpose 1:8.2.3.7, Ensure that the import of import statements works for import all. |
1287 | ** @verdict pass reject |
1288 | *****************************************************************/ |
1289 | |
1290 | module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 { |
1291 | |
1292 | import from Sem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA { |
1293 | import all; |
1294 | }; |
1295 | |
1296 | type component GeneralComp {} |
1297 | |
1298 | testcase TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002() runs on GeneralComp { |
1299 | if (c_myconst == 43532) { // c_myconst shall not be accessible as the import in the importA module is private. |
1300 | setverdict(fail); |
1301 | } else { |
1302 | setverdict(pass); |
1303 | } |
1304 | } |
1305 | |
1306 | control{ |
1307 | execute(TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002()); |
1308 | } |
1309 | } |
1310 | |
1311 | <END_MODULE> |
1312 | |
1313 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA.ttcn > |
1314 | |
1315 | module Sem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA { |
1316 | // imports are private by default |
1317 | import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB all; |
1318 | } |
1319 | |
1320 | <END_MODULE> |
1321 | |
1322 | <MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB.ttcn > |
1323 | |
1324 | module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB { |
1325 | const integer c_myconst := 43532; |
1326 | } |
1327 | |
1328 | <END_MODULE> |
1329 | |
1330 | |
1331 | <RESULT COUNT 1> |
1332 | error: There is no local or imported definition with name `c_myconst' |
1333 | <END_RESULT> |
1334 | |
1335 | <END_TC> |
1336 | :exmp |
1337 | |
1338 | *---------------------------------------------------------------------* |
1339 | :h3. NegSem_080204_DefinitionOfFriendModules_001 negative test |
1340 | .*---------------------------------------------------------------------* |
1341 | :xmp tab=0. |
1342 | |
1343 | <TC - Ensure that the import of import statements works for import all. > |
1344 | |
1345 | <COMPILE> |
1346 | |
1347 | <MODULE TTCN NegSem_080204_DefinitionOfFriendModules_001 NegSem_080204_DefinitionOfFriendModules_001.ttcn > |
1348 | /***************************************************************** |
1349 | ** @version 0.0.1 |
1350 | ** @purpose 1:8.2.4, Ensure that friend visibility works for a sample constant. |
1351 | ** @verdict pass reject |
1352 | *****************************************************************/ |
1353 | |
1354 | module NegSem_080204_DefinitionOfFriendModules_001 { |
1355 | |
1356 | import from NegSem_080204_DefinitionOfFriendModules_001_import all; |
1357 | |
1358 | type component GeneralComp {} |
1359 | |
1360 | testcase TC_NegSem_080204_DefinitionOfFriendModules_001() runs on GeneralComp { |
1361 | if (c_myconst == 32532) { // c_myconst shall not be visible. A friend module statement is missing in NegSem_080204_DefinitionOfFriendModules_001_import. |
1362 | setverdict(fail); |
1363 | } else { |
1364 | setverdict(pass); |
1365 | } |
1366 | } |
1367 | |
1368 | control{ |
1369 | execute(TC_NegSem_080204_DefinitionOfFriendModules_001()); |
1370 | } |
1371 | } |
1372 | <END_MODULE> |
1373 | |
1374 | <MODULE TTCN NegSem_080204_DefinitionOfFriendModules_001_import NegSem_080204_DefinitionOfFriendModules_001_import.ttcn > |
1375 | |
1376 | module NegSem_080204_DefinitionOfFriendModules_001_import { |
1377 | friend const integer c_myconst := 32532; |
1378 | } |
1379 | |
1380 | <END_MODULE> |
1381 | |
1382 | |
1383 | <RESULT COUNT 1> |
1384 | error: There is no local or imported definition with name `c_myconst' |
1385 | <END_RESULT> |
1386 | |
1387 | <END_TC> |
1388 | :exmp |
1389 | |
1390 | *---------------------------------------------------------------------* |
1391 | :h3. NegSem_080204_DefinitionOfFriendModules_002 negative test |
1392 | .*---------------------------------------------------------------------* |
1393 | :xmp tab=0. |
1394 | |
1395 | <TC - Ensure that private definitions are not made visible by friend declarations (for a constant sample definition). > |
1396 | |
1397 | <COMPILE> |
1398 | |
1399 | <MODULE TTCN NegSem_080204_DefinitionOfFriendModules_002 NegSem_080204_DefinitionOfFriendModules_002.ttcn > |
1400 | /***************************************************************** |
1401 | ** @version 0.0.1 |
1402 | ** @purpose 1:8.2.4, Ensure that private definitions are not made visible by friend declarations (for a constant sample definition). |
1403 | ** @verdict pass reject |
1404 | *****************************************************************/ |
1405 | |
1406 | module NegSem_080204_DefinitionOfFriendModules_002 { |
1407 | |
1408 | import from NegSem_080204_DefinitionOfFriendModules_002_import all; |
1409 | |
1410 | type component GeneralComp {} |
1411 | |
1412 | testcase TC_NegSem_080204_DefinitionOfFriendModules_002() runs on GeneralComp { |
1413 | if (c_myconst == 32532) { // c_myconst shall not be visible. The definition is private even though the module is a friend. |
1414 | setverdict(fail); |
1415 | } else { |
1416 | setverdict(pass); |
1417 | } |
1418 | } |
1419 | |
1420 | control{ |
1421 | execute(TC_NegSem_080204_DefinitionOfFriendModules_002()); |
1422 | } |
1423 | } |
1424 | <END_MODULE> |
1425 | |
1426 | <MODULE TTCN NegSem_080204_DefinitionOfFriendModules_002_import NegSem_080204_DefinitionOfFriendModules_002_import.ttcn > |
1427 | |
1428 | module NegSem_080204_DefinitionOfFriendModules_002_import { |
1429 | friend module NegSem_080204_DefinitionOfFriendModules_001; |
1430 | |
1431 | private const integer c_myconst := 32532; |
1432 | } |
1433 | <END_MODULE> |
1434 | |
1435 | |
1436 | <RESULT COUNT 1> |
1437 | error: There is no local or imported definition with name `c_myconst' |
1438 | <END_RESULT> |
1439 | |
1440 | <END_TC> |
1441 | :exmp |
1442 | |
1443 | *---------------------------------------------------------------------* |
1444 | :h3. NegSem_080205_VisibilityOfDefinitions_001 negative test |
1445 | .*---------------------------------------------------------------------* |
1446 | :xmp tab=0. |
1447 | |
1448 | <TC - Ensure that private definition (in this case a sample constant) is not visible using a normal import. > |
1449 | |
1450 | <COMPILE> |
1451 | |
1452 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_001 NegSem_080205_VisibilityOfDefinitions_001.ttcn > |
1453 | /***************************************************************** |
1454 | ** @version 0.0.1 |
1455 | ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a normal import. |
1456 | ** @verdict pass reject |
1457 | *****************************************************************/ |
1458 | |
1459 | module NegSem_080205_VisibilityOfDefinitions_001 { |
1460 | |
1461 | import from NegSem_080205_VisibilityOfDefinitions_001_import all; |
1462 | |
1463 | type component GeneralComp {} |
1464 | |
1465 | testcase TC_NegSem_080205_VisibilityOfDefinitions_001() runs on GeneralComp { |
1466 | if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. |
1467 | setverdict(fail); |
1468 | } else { |
1469 | setverdict(pass); |
1470 | } |
1471 | } |
1472 | |
1473 | control{ |
1474 | execute(TC_NegSem_080205_VisibilityOfDefinitions_001()); |
1475 | } |
1476 | } |
1477 | |
1478 | <END_MODULE> |
1479 | |
1480 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_001_import NegSem_080205_VisibilityOfDefinitions_001_import.ttcn > |
1481 | |
1482 | module NegSem_080205_VisibilityOfDefinitions_001_import { |
1483 | private const integer c_myconst := 32532; |
1484 | } |
1485 | <END_MODULE> |
1486 | |
1487 | |
1488 | <RESULT COUNT 1> |
1489 | error: There is no local or imported definition with name `c_myconst' |
1490 | <END_RESULT> |
1491 | |
1492 | <END_TC> |
1493 | :exmp |
1494 | |
1495 | *---------------------------------------------------------------------* |
1496 | :h3. NegSem_080205_VisibilityOfDefinitions_002 negative test |
1497 | .*---------------------------------------------------------------------* |
1498 | :xmp tab=0. |
1499 | |
1500 | <TC - Ensure that private definition (in this case a sample constant) is not visible using an import of a friend module. > |
1501 | |
1502 | <COMPILE> |
1503 | |
1504 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_002 NegSem_080205_VisibilityOfDefinitions_002.ttcn > |
1505 | /***************************************************************** |
1506 | ** @version 0.0.1 |
1507 | ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using an import of a friend module. |
1508 | ** @verdict pass reject |
1509 | *****************************************************************/ |
1510 | |
1511 | module NegSem_080205_VisibilityOfDefinitions_002 { |
1512 | |
1513 | import from NegSem_080205_VisibilityOfDefinitions_002_import all; |
1514 | |
1515 | type component GeneralComp {} |
1516 | |
1517 | testcase TC_NegSem_080205_VisibilityOfDefinitions_002() runs on GeneralComp { |
1518 | if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. |
1519 | setverdict(fail); |
1520 | } else { |
1521 | setverdict(pass); |
1522 | } |
1523 | } |
1524 | |
1525 | control{ |
1526 | execute(TC_NegSem_080205_VisibilityOfDefinitions_002()); |
1527 | } |
1528 | } |
1529 | |
1530 | |
1531 | <END_MODULE> |
1532 | |
1533 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_002_import NegSem_080205_VisibilityOfDefinitions_002_import.ttcn > |
1534 | |
1535 | module NegSem_080205_VisibilityOfDefinitions_002_import { |
1536 | friend module NegSem_080205_VisibilityOfDefinitions_002; |
1537 | |
1538 | private const integer c_myconst := 32532; |
1539 | } |
1540 | <END_MODULE> |
1541 | |
1542 | |
1543 | <RESULT COUNT 1> |
1544 | error: There is no local or imported definition with name `c_myconst' |
1545 | <END_RESULT> |
1546 | |
1547 | <END_TC> |
1548 | :exmp |
1549 | |
1550 | *---------------------------------------------------------------------* |
1551 | :h3. NegSem_080205_VisibilityOfDefinitions_003 negative test |
1552 | .*---------------------------------------------------------------------* |
1553 | :xmp tab=0. |
1554 | |
1555 | <TC - Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. > |
1556 | |
1557 | <COMPILE> |
1558 | |
1559 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_003 NegSem_080205_VisibilityOfDefinitions_003.ttcn > |
1560 | /***************************************************************** |
1561 | ** @version 0.0.1 |
1562 | ** @purpose 1:8.2.5, Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. |
1563 | ** @verdict pass reject |
1564 | *****************************************************************/ |
1565 | |
1566 | module NegSem_080205_VisibilityOfDefinitions_003 { |
1567 | |
1568 | import from NegSem_080205_VisibilityOfDefinitions_003_import { |
1569 | group CONST_GROUP; |
1570 | } |
1571 | |
1572 | type component GeneralComp {} |
1573 | |
1574 | testcase TC_NegSem_080205_VisibilityOfDefinitions_003() runs on GeneralComp { |
1575 | if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. |
1576 | setverdict(fail); |
1577 | } else { |
1578 | setverdict(pass); |
1579 | } |
1580 | } |
1581 | |
1582 | control{ |
1583 | execute(TC_NegSem_080205_VisibilityOfDefinitions_003()); |
1584 | } |
1585 | } |
1586 | <END_MODULE> |
1587 | |
1588 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_003_import NegSem_080205_VisibilityOfDefinitions_003_import.ttcn > |
1589 | |
1590 | module NegSem_080205_VisibilityOfDefinitions_003_import { |
1591 | group CONST_GROUP { |
1592 | friend const integer c_myconst := 32532; |
1593 | } |
1594 | } |
1595 | <END_MODULE> |
1596 | |
1597 | |
1598 | <RESULT COUNT 1> |
1599 | error: There is no local or imported definition with name `c_myconst' |
1600 | <END_RESULT> |
1601 | |
1602 | <END_TC> |
1603 | :exmp |
1604 | |
1605 | *---------------------------------------------------------------------* |
1606 | :h3. NegSem_080205_VisibilityOfDefinitions_004 negative test |
1607 | .*---------------------------------------------------------------------* |
1608 | :xmp tab=0. |
1609 | |
1610 | <TC - Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. > |
1611 | |
1612 | <COMPILE> |
1613 | |
1614 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_004 NegSem_080205_VisibilityOfDefinitions_004.ttcn > |
1615 | /***************************************************************** |
1616 | ** @version 0.0.1 |
1617 | ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a group import of a non-friend module. |
1618 | ** @verdict pass reject |
1619 | *****************************************************************/ |
1620 | |
1621 | module NegSem_080205_VisibilityOfDefinitions_004 { |
1622 | |
1623 | import from NegSem_080205_VisibilityOfDefinitions_004_import { |
1624 | group CONST_GROUP; |
1625 | } |
1626 | |
1627 | type component GeneralComp {} |
1628 | |
1629 | testcase TC_NegSem_080205_VisibilityOfDefinitions_004() runs on GeneralComp { |
1630 | if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. |
1631 | setverdict(fail); |
1632 | } else { |
1633 | setverdict(pass); |
1634 | } |
1635 | } |
1636 | |
1637 | control{ |
1638 | execute(TC_NegSem_080205_VisibilityOfDefinitions_004()); |
1639 | } |
1640 | } |
1641 | <END_MODULE> |
1642 | |
1643 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_004_import NegSem_080205_VisibilityOfDefinitions_004_import.ttcn > |
1644 | |
1645 | module NegSem_080205_VisibilityOfDefinitions_004_import { |
1646 | group CONST_GROUP { |
1647 | private const integer c_myconst := 32532; |
1648 | } |
1649 | } |
1650 | <END_MODULE> |
1651 | |
1652 | |
1653 | <RESULT COUNT 1> |
1654 | error: There is no local or imported definition with name `c_myconst' |
1655 | <END_RESULT> |
1656 | |
1657 | <END_TC> |
1658 | :exmp |
1659 | |
1660 | *---------------------------------------------------------------------* |
1661 | :h3. NegSem_080205_VisibilityOfDefinitions_005 negative test |
1662 | .*---------------------------------------------------------------------* |
1663 | :xmp tab=0. |
1664 | |
1665 | <TC - Ensure that private definition (in this case a sample constant) is not visible using a group import of a friend module. > |
1666 | |
1667 | <COMPILE> |
1668 | |
1669 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005 NegSem_080205_VisibilityOfDefinitions_005.ttcn > |
1670 | /***************************************************************** |
1671 | ** @version 0.0.1 |
1672 | ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a group import of a friend module. |
1673 | ** @verdict pass reject |
1674 | *****************************************************************/ |
1675 | |
1676 | module NegSem_080205_VisibilityOfDefinitions_005 { |
1677 | |
1678 | import from NegSem_080205_VisibilityOfDefinitions_005_import { |
1679 | group CONST_GROUP; |
1680 | } |
1681 | |
1682 | type component GeneralComp {} |
1683 | |
1684 | testcase TC_NegSem_080205_VisibilityOfDefinitions_005() runs on GeneralComp { |
1685 | if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. |
1686 | setverdict(fail); |
1687 | } else { |
1688 | setverdict(pass); |
1689 | } |
1690 | } |
1691 | |
1692 | control{ |
1693 | execute(TC_NegSem_080205_VisibilityOfDefinitions_005()); |
1694 | } |
1695 | } |
1696 | <END_MODULE> |
1697 | |
1698 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005_import NegSem_080205_VisibilityOfDefinitions_005_import.ttcn > |
1699 | |
1700 | module NegSem_080205_VisibilityOfDefinitions_005_import { |
1701 | friend module NegSem_080205_VisibilityOfDefinitions_005; |
1702 | |
1703 | group CONST_GROUP { |
1704 | private const integer c_myconst := 32532; |
1705 | } |
1706 | } |
1707 | <END_MODULE> |
1708 | |
1709 | |
1710 | <RESULT COUNT 1> |
1711 | error: There is no local or imported definition with name `c_myconst' |
1712 | <END_RESULT> |
1713 | |
1714 | <END_TC> |
1715 | :exmp |
1716 | |
1717 | *---------------------------------------------------------------------* |
1718 | :h3. NegSem_080205_VisibilityOfDefinitions_005 negative test |
1719 | .*---------------------------------------------------------------------* |
1720 | :xmp tab=0. |
1721 | |
1722 | <TC - Ensure that there is not more than one control part. > |
1723 | |
1724 | <COMPILE> |
1725 | |
1726 | <MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005 NegSem_080205_VisibilityOfDefinitions_005.ttcn > |
1727 | /***************************************************************** |
1728 | ** @version 0.0.1 |
1729 | ** @purpose 1:8.3, Ensure that there is not more than one control part. |
1730 | ** @verdict pass reject |
1731 | *****************************************************************/ |
1732 | |
1733 | module NegSyn_0803_ModuleControlPart_001 { |
1734 | |
1735 | control { |
1736 | var integer count := 0; |
1737 | } |
1738 | |
1739 | control { |
1740 | var integer count := 0; |
1741 | } |
1742 | |
1743 | } |
1744 | <END_MODULE> |
1745 | |
1746 | <RESULT COUNT 1> |
1747 | error: at or before token `control': syntax error, unexpected ControlKeyword, expecting '\{' or '\}' |
1748 | <END_RESULT> |
1749 | |
1750 | <END_TC> |
1751 | :exmp |
1752 | |
1753 | .*---------------------------------------------------------------------* |
1754 | :h2. 09_test_configurations folder |
1755 | .*---------------------------------------------------------------------* |
1756 | |
1757 | *---------------------------------------------------------------------* |
1758 | :h3. NegSem_0901_Communication_ports_007 negative test |
1759 | .*---------------------------------------------------------------------* |
1760 | :xmp tab=0. |
1761 | |
1762 | <TC - Verify that a two TSI port cannot be connected > |
1763 | |
1764 | <COMPILE> |
1765 | <EXECUTE_PARALLEL> |
1766 | |
1767 | <MODULE TTCN NegSem_0901_Communication_ports_007 NegSem_0901_Communication_ports_007.ttcn > |
1768 | /*************************************************** |
1769 | ** @version 0.0.1 |
1770 | ** @purpose 1:9.1, Verify that a two TSI port cannot be connected |
1771 | ** @verdict pass reject |
1772 | ***************************************************/ |
1773 | |
1774 | /*NOTE: see Figure 7(f): Two TSI port cannot be connected |
1775 | * */ |
1776 | |
1777 | module NegSem_0901_Communication_ports_007 { |
1778 | |
1779 | type port P message { |
1780 | inout integer |
1781 | } with {extension "internal"} |
1782 | |
1783 | type component GeneralComp |
1784 | { |
1785 | port P p1, p2; |
1786 | } |
1787 | |
1788 | testcase TC_NegSem_0901_Communication_ports_007() runs on GeneralComp system GeneralComp { |
1789 | var GeneralComp s := system; |
1790 | map(s:p2, system:p1); // error: p1 and p2 cannot be connected |
1791 | |
1792 | setverdict(pass); |
1793 | } |
1794 | |
1795 | control{ |
1796 | execute(TC_NegSem_0901_Communication_ports_007()); |
1797 | } |
1798 | } |
1799 | <END_MODULE> |
1800 | |
1801 | <RESULT COUNT 1> |
1802 | Dynamic test case error: Both arguments of map operation refer to system ports. |
1803 | <END_RESULT> |
1804 | |
1805 | <END_TC> |
1806 | :exmp |
1807 | |
1808 | *---------------------------------------------------------------------* |
1809 | :h3. NegSem_0901_Communication_ports_009 negative test |
1810 | .*---------------------------------------------------------------------* |
1811 | :xmp tab=0. |
1812 | |
1813 | <TC - Verify that connections within the test system interface are not allowed > |
1814 | |
1815 | <COMPILE> |
1816 | |
1817 | <MODULE TTCN NegSem_0901_Communication_ports_009 NegSem_0901_Communication_ports_009.ttcn > |
1818 | /*************************************************** |
1819 | ** @version 0.0.1 |
1820 | ** @purpose 1:9.1, Verify that connections within the test system interface are not allowed |
1821 | ** @verdict pass reject |
1822 | ***************************************************/ |
1823 | |
1824 | // The following requirements are tested: |
1825 | // Restriction a): Connections within the test system interface are not allowed. |
1826 | |
1827 | module NegSem_0901_Communication_ports_009 { |
1828 | |
1829 | type port P message { |
1830 | inout integer |
1831 | } with {extension "internal"} |
1832 | |
1833 | type component GeneralComp |
1834 | { |
1835 | port P p1, p2; |
1836 | } |
1837 | |
1838 | testcase TC_NegSem_0901_Communication_ports_009() runs on GeneralComp system GeneralComp { |
1839 | map(system:p1, system:p1); // mapping system port to itself: error expected |
1840 | setverdict(pass); |
1841 | } |
1842 | |
1843 | control{ |
1844 | execute(TC_NegSem_0901_Communication_ports_009()); |
1845 | } |
1846 | } |
1847 | <END_MODULE> |
1848 | |
1849 | <RESULT COUNT 1> |
1850 | error: Both endpoints of the mapping are system ports |
1851 | <END_RESULT> |
1852 | |
1853 | <END_TC> |
1854 | :exmp |
1855 | |
1856 | *---------------------------------------------------------------------* |
1857 | :h3. NegSyn_0901_Communication_ports_001 negative test |
1858 | .*---------------------------------------------------------------------* |
1859 | :xmp tab=0. |
1860 | |
1861 | <TC - Verify that a two TSI port cannot be connected > |
1862 | |
1863 | <COMPILE> |
1864 | |
1865 | <MODULE TTCN NegSyn_0901_Communication_ports_001 NegSem_0901_Communication_ports_001.ttcn > |
1866 | /*************************************************** |
1867 | ** @version 0.0.1 |
1868 | ** @purpose 1:9.1, Verify that a two TSI port cannot be connected |
1869 | ** @verdict pass reject, noexecution |
1870 | ***************************************************/ |
1871 | |
1872 | /*NOTE: see Figure 7(f): Two TSI port cannot be connected |
1873 | * */ |
1874 | |
1875 | module NegSyn_0901_Communication_ports_001 { |
1876 | |
1877 | type port P message { |
1878 | inout integer |
1879 | } |
1880 | |
1881 | type component GeneralComp |
1882 | { |
1883 | port P p1, p2; |
1884 | } |
1885 | |
1886 | type component General_System_Comp |
1887 | { |
1888 | port P p_system_1, p_system_2; |
1889 | } |
1890 | |
1891 | testcase TC_NegSyn_0901_Communication_ports_001() runs on GeneralComp system General_System_Comp { |
1892 | |
1893 | connect(system:p_system_1, system:p_system_2); // error: p_system_1 and p_system_2 cannot be connected |
1894 | |
1895 | setverdict(pass); |
1896 | } |
1897 | |
1898 | control{ |
1899 | execute(TC_NegSyn_0901_Communication_ports_001()); |
1900 | } |
1901 | } |
1902 | <END_MODULE> |
1903 | |
1904 | <RESULT COUNT 2> |
1905 | error: The `system' component reference shall not be used in `connect' operation |
1906 | <END_RESULT> |
1907 | |
1908 | <END_TC> |
1909 | :exmp |
1910 | |
1911 | *---------------------------------------------------------------------* |
1912 | :h3. NegSem_0902_Communication_ports_003 negative test |
1913 | .*---------------------------------------------------------------------* |
1914 | :xmp tab=0. |
1915 | |
1916 | <TC - Ensure that the two system interf. port cannot connect > |
1917 | |
1918 | <COMPILE> |
1919 | |
1920 | <MODULE TTCN NegSem_0902_Communication_ports_003 NegSem_0902_Communication_ports_003.ttcn > |
1921 | /*************************************************** |
1922 | ** @version 0.0.1 |
1923 | ** @purpose 1:9, Ensure that the two system interf. port cannot connect |
1924 | ** @verdict pass reject |
1925 | ***************************************************/ |
1926 | |
1927 | //Two system interface ports are not allowed to connect |
1928 | module NegSem_0902_Communication_ports_003{ |
1929 | |
1930 | type port loopbackPort message { |
1931 | inout integer |
1932 | } with {extension "internal"} |
1933 | |
1934 | type component MyTestSystemInterface |
1935 | { |
1936 | port loopbackPort messagePortA,messagePortB |
1937 | } |
1938 | // MyTestSystemInterface is the test system interface |
1939 | |
1940 | testcase TC_NegSem_0902_Communication_ports_003() runs on MyTestSystemInterface { |
1941 | // establishing the port connections |
1942 | map(system:messagePortA, system:messagePortB); // not allowed |
1943 | |
1944 | setverdict(fail); |
1945 | |
1946 | } |
1947 | control{ |
1948 | execute(TC_NegSem_0902_Communication_ports_003()); |
1949 | } |
1950 | } |
1951 | <END_MODULE> |
1952 | |
1953 | <RESULT COUNT 1> |
1954 | error: Both endpoints of the mapping are system ports |
1955 | <END_RESULT> |
1956 | |
1957 | <END_TC> |
1958 | :exmp |
1959 | |
1960 | .*---------------------------------------------------------------------* |
1961 | :h2. 10_constants folder |
1962 | .*---------------------------------------------------------------------* |
1963 | |
1964 | *---------------------------------------------------------------------* |
1965 | :h3. NegSem_10_Constants_001 negative test |
1966 | .*---------------------------------------------------------------------* |
1967 | :xmp tab=0. |
1968 | |
1969 | <TC - Assign rnd to constant used in type, not allowed since constant expressions used in types have to be known at compile-time. > |
1970 | |
1971 | <COMPILE> |
1972 | |
1973 | <MODULE TTCN NegSem_10_Constants_001 NegSem_10_Constants_001.ttcn > |
1974 | /*************************************************** |
1975 | ** @version 0.0.1 |
1976 | ** @purpose 1:10, Assign rnd to constant used in type, not allowed since constant expressions used in types have to be known at compile-time. |
1977 | ** @verdict pass reject |
1978 | ***************************************************/ |
1979 | module NegSem_10_Constants_001 { |
1980 | |
1981 | const float c_i := rnd(314E-2); // not allowed by standard |
1982 | type float MyFloat (c_i); |
1983 | |
1984 | type component GeneralComp {} |
1985 | |
1986 | testcase TC_NegSem_10_Constants_001() runs on GeneralComp { |
1987 | var MyFloat v_f := c_i; |
1988 | log(v_f); |
1989 | setverdict(pass); |
1990 | } |
1991 | |
1992 | control{ |
1993 | execute(TC_NegSem_10_Constants_001()); |
1994 | } |
1995 | } |
1996 | <END_MODULE> |
1997 | |
1998 | <RESULT COUNT 1> |
02f1ec01 |
1999 | error: An evaluable constant value was expected instead of operation `rnd \(seed\)' |
8930eefa |
2000 | <END_RESULT> |
2001 | |
2002 | <END_TC> |
2003 | :exmp |
2004 | |
2005 | *---------------------------------------------------------------------* |
2006 | :h3. NegSem_10_Constants_002 negative test |
2007 | .*---------------------------------------------------------------------* |
2008 | :xmp tab=0. |
2009 | |
2010 | <TC - A value is assigned only once to a constant. > |
2011 | |
2012 | <COMPILE> |
2013 | |
2014 | <MODULE TTCN NegSem_10_Constants_002 NegSem_10_Constants_002.ttcn > |
2015 | /*************************************************** |
2016 | ** @version 0.0.1 |
2017 | ** @purpose 1:10, A value is assigned only once to a constant |
2018 | ** @verdict pass reject |
2019 | ***************************************************/ |
2020 | module NegSem_10_Constants_002 { |
2021 | |
2022 | const float c_i := 3.14; |
2023 | |
2024 | |
2025 | type component GeneralComp {} |
2026 | |
2027 | testcase TC_NegSem_10_Constants_002() runs on GeneralComp { |
2028 | c_i := 3.15; //error because value is assigned only once to the constant |
2029 | } |
2030 | |
2031 | control{ |
2032 | execute(TC_NegSem_10_Constants_002()); |
2033 | } |
2034 | } |
2035 | <END_MODULE> |
2036 | |
2037 | <RESULT COUNT 1> |
2038 | error: Reference to a variable or template variable was expected instead of constant `@NegSem_10_Constants_002.c_i' |
2039 | <END_RESULT> |
2040 | |
2041 | <END_TC> |
2042 | :exmp |
2043 | |
2044 | *---------------------------------------------------------------------* |
2045 | :h3. NegSem_10_Constants_003 negative test |
2046 | .*---------------------------------------------------------------------* |
2047 | :xmp tab=0. |
2048 | |
2049 | <TC - Constant shall not be of port type > |
2050 | |
2051 | <COMPILE> |
2052 | |
2053 | <MODULE TTCN NegSem_10_Constants_003 NegSem_10_Constants_003.ttcn > |
2054 | /*************************************************** |
2055 | ** @version 0.0.1 |
2056 | ** @purpose 1:10, Constant shall not be of port type |
2057 | ** @verdict pass reject |
2058 | ***************************************************/ |
2059 | module NegSem_10_Constants_003 { |
2060 | |
2061 | //only for negSyn constant shall not be of port type |
2062 | type port MyMessagePortType message |
2063 | { |
2064 | inout integer |
2065 | } with {extension "internal"} |
2066 | |
2067 | |
2068 | type component GeneralComp { |
2069 | } |
2070 | |
2071 | testcase TC_NegSem_10_Constants_003() runs on GeneralComp { |
2072 | const MyMessagePortType c_port:= 5;//error - constant shall not be of port type |
2073 | }//end testcase |
2074 | |
2075 | control{ |
2076 | execute(TC_NegSem_10_Constants_003()); |
2077 | } |
2078 | } |
2079 | <END_MODULE> |
2080 | |
2081 | <RESULT COUNT 1> |
2082 | error: Constant cannot be defined for port type `@NegSem_10_Constants_003.MyMessagePortType' |
2083 | <END_RESULT> |
2084 | |
2085 | <END_TC> |
2086 | :exmp |
2087 | |
2088 | *---------------------------------------------------------------------* |
2089 | :h2. 11_variables folder |
2090 | .*---------------------------------------------------------------------* |
2091 | |
2092 | *---------------------------------------------------------------------* |
2093 | :h3. NegSem_1101_ValueVars_001 negative test |
2094 | .*---------------------------------------------------------------------* |
2095 | :xmp tab=0. |
2096 | |
2097 | <TC - Variables should be assigned only by values > |
2098 | |
2099 | <COMPILE> |
2100 | |
2101 | <MODULE TTCN NegSem_1101_ValueVars_001 NegSem_1101_ValueVars_001.ttcn > |
2102 | /*************************************************** |
2103 | ** @version 0.0.1 |
2104 | ** @purpose 1:11.1, Variables should be assigned only by values |
2105 | ** @verdict pass reject |
2106 | ***************************************************/ |
2107 | module NegSem_1101_ValueVars_001 { |
2108 | type component GeneralComp {} |
2109 | |
2110 | testcase TC_NegSem_1101_ValueVars_001() runs on GeneralComp { |
2111 | var integer v_i := ?; // ? is not a value |
2112 | setverdict(pass); |
2113 | } |
2114 | |
2115 | control { |
2116 | execute(TC_NegSem_1101_ValueVars_001()); |
2117 | } |
2118 | } |
2119 | <END_MODULE> |
2120 | |
2121 | <RESULT COUNT 1> |
2122 | error: at or before token `\?': syntax error, unexpected '\?' |
2123 | <END_RESULT> |
2124 | |
2125 | <END_TC> |
2126 | :exmp |
2127 | |
2128 | *---------------------------------------------------------------------* |
2129 | :h3. NegSem_1101_ValueVars_002 negative test |
2130 | .*---------------------------------------------------------------------* |
2131 | :xmp tab=0. |
2132 | |
2133 | <TC - Ensure that partially initialized variables are evaluated correctly. > |
2134 | |
2135 | <COMPILE> |
2136 | <EXECUTE_PARALLEL> |
2137 | |
2138 | <MODULE TTCN NegSem_1101_ValueVars_002 NegSem_1101_ValueVars_002.ttcn > |
2139 | /***************************************************************** |
2140 | ** @version 0.0.1 |
2141 | ** @purpose 1:11.1, Ensure that partially initialized variables are evaluated correctly. |
2142 | ** @verdict pass reject |
2143 | *****************************************************************/ |
2144 | |
2145 | module NegSem_1101_ValueVars_002 { |
2146 | |
2147 | type component GeneralComp { |
2148 | } |
2149 | |
2150 | type set IntegerSet { |
2151 | integer a1 optional, |
2152 | integer a2 optional, |
2153 | integer a3 optional |
2154 | }; |
2155 | |
2156 | testcase TC_NegSem_1101_ValueVars_002() runs on GeneralComp { |
2157 | var IntegerSet v_set := {a1:=1,a2:=omit}; |
2158 | |
2159 | if ( v_set == {a1:=1,a2:=omit,a3:=3} ) { //attempted use of partially initialized variable |
2160 | setverdict(pass); |
2161 | } else { |
2162 | setverdict(fail); |
2163 | } |
2164 | } |
2165 | |
2166 | control{ |
2167 | execute(TC_NegSem_1101_ValueVars_002()); |
2168 | } |
2169 | |
2170 | } |
2171 | <END_MODULE> |
2172 | |
2173 | <RESULT COUNT 1> |
2174 | Dynamic test case error: The left operand of comparison is an unbound optional value. |
2175 | <END_RESULT> |
2176 | |
2177 | <END_TC> |
2178 | :exmp |
2179 | |
2180 | *---------------------------------------------------------------------* |
2181 | :h3. NegSyn_1101_ValueVars_001 negative test |
2182 | .*---------------------------------------------------------------------* |
2183 | :xmp tab=0. |
2184 | |
2185 | <TC - Define variables in module scope > |
2186 | |
2187 | <COMPILE> |
2188 | |
2189 | <MODULE TTCN NegSyn_1101_ValueVars_001 NegSyn_1101_ValueVars_001.ttcn > |
2190 | /*************************************************** |
2191 | ** @version 0.0.1 |
2192 | ** @purpose 1:11.1, Define variables in module scope |
2193 | ** @verdict pass reject |
2194 | ***************************************************/ |
2195 | module NegSyn_1101_ValueVars_001 { |
2196 | var integer v_i1 := 5; |
2197 | } |
2198 | <END_MODULE> |
2199 | |
2200 | <RESULT COUNT 1> |
2201 | error: at or before token `var': syntax error, unexpected VarKeyword |
2202 | <END_RESULT> |
2203 | |
2204 | <END_TC> |
2205 | :exmp |
2206 | |
2207 | *---------------------------------------------------------------------* |
2208 | :h3. NegSem_1102_TemplateVars_001 negative test |
2209 | .*---------------------------------------------------------------------* |
2210 | :xmp tab=0. |
2211 | |
2212 | <TC - Template variables should be assigned with unitialized variables > |
2213 | |
2214 | <COMPILE> |
2215 | <EXECUTE_PARALLEL> |
2216 | |
2217 | <MODULE TTCN NegSem_1102_TemplateVars_001 NegSem_1102_TemplateVars_001.ttcn > |
2218 | /*************************************************** |
2219 | ** @version 0.0.1 |
2220 | ** @purpose 1:11.2, Template variables should be assigned with unitialized variables |
2221 | ** @verdict pass reject |
2222 | ***************************************************/ |
2223 | module NegSem_1102_TemplateVars_001 { |
2224 | type component GeneralComp {} |
2225 | |
2226 | testcase TC_NegSem_1102_TemplateVars_001() runs on GeneralComp { |
2227 | var template integer v_i1; |
2228 | var template integer v_i2 := v_i1; // v_i1 is not initialized |
2229 | |
2230 | setverdict(pass); |
2231 | } |
2232 | |
2233 | control { |
2234 | execute(TC_NegSem_1102_TemplateVars_001()); |
2235 | } |
2236 | } |
2237 | <END_MODULE> |
2238 | |
2239 | <RESULT COUNT 1> |
2240 | Dynamic test case error: Copying an uninitialized/unsupported integer template. |
2241 | <END_RESULT> |
2242 | |
2243 | <END_TC> |
2244 | :exmp |
2245 | |
2246 | *---------------------------------------------------------------------* |
2247 | :h3. NegSyn_1102_TemplateVars_001 negative test |
2248 | .*---------------------------------------------------------------------* |
2249 | :xmp tab=0. |
2250 | |
2251 | <TC - Define template variables in module scope > |
2252 | |
2253 | <COMPILE> |
2254 | |
2255 | <MODULE TTCN NegSyn_1102_TemplateVars_001 NegSyn_1102_TemplateVars_001.ttcn > |
2256 | /*************************************************** |
2257 | ** @version 0.0.1 |
2258 | ** @purpose 1:11.2, Define template variables in module scope |
2259 | ** @verdict pass reject |
2260 | ***************************************************/ |
2261 | module NegSyn_1102_TemplateVars_001 { |
2262 | var template integer v_i1 := 5; |
2263 | } |
2264 | <END_MODULE> |
2265 | |
2266 | <RESULT COUNT 1> |
2267 | error: at or before token `var': syntax error, unexpected VarKeyword |
2268 | <END_RESULT> |
2269 | |
2270 | <END_TC> |
2271 | :exmp |
2272 | |
2273 | *---------------------------------------------------------------------* |
2274 | :h2. 12_timers folder |
2275 | .*---------------------------------------------------------------------* |
2276 | |
2277 | *---------------------------------------------------------------------* |
2278 | :h3. NegSem_12_toplevel_timer_001 negative test |
2279 | .*---------------------------------------------------------------------* |
2280 | :xmp tab=0. |
2281 | |
2282 | <TC - Ensure timer can not be initialized with negative duration > |
2283 | |
2284 | <COMPILE> |
2285 | |
2286 | <MODULE TTCN NegSem_12_toplevel_timer_001 NegSem_12_toplevel_timer_001.ttcn > |
2287 | /*************************************************** |
2288 | ** @version 0.0.1 |
2289 | ** @purpose 1:12, Ensure timer can not be initialized with negative duration |
2290 | ** @verdict pass reject |
2291 | ***************************************************/ |
2292 | /* |
2293 | * #reqname /Requirements/12 Declaring timers/Timer value is non-neg float |
2294 | **/ |
2295 | |
2296 | |
2297 | module NegSem_12_toplevel_timer_001 { |
2298 | type component TComp{ |
2299 | timer t_timer := -1.0; // not allowed |
2300 | } |
2301 | testcase TC_NegSem_12_toplevel_timer_001() runs on TComp{ |
2302 | t_timer.start; |
2303 | } |
2304 | control{ |
2305 | |
2306 | execute(TC_NegSem_12_toplevel_timer_001()) |
2307 | |
2308 | |
2309 | } |
2310 | } |
2311 | <END_MODULE> |
2312 | |
2313 | <RESULT COUNT 1> |
2314 | error: A non-negative float value was expected as timer duration instead of `-1.0e0' |
2315 | <END_RESULT> |
2316 | |
2317 | <END_TC> |
2318 | :exmp |
2319 | |
2320 | *---------------------------------------------------------------------* |
2321 | :h3. NegSem_12_toplevel_timer_002 negative test |
2322 | .*---------------------------------------------------------------------* |
2323 | :xmp tab=0. |
2324 | |
2325 | <TC - Ensure timer in array can not be initialized with negative duration > |
2326 | |
2327 | <COMPILE> |
2328 | |
2329 | <MODULE TTCN NegSem_12_toplevel_timer_002 NegSem_12_toplevel_timer_002.ttcn > |
2330 | /*************************************************** |
2331 | ** @version 0.0.1 |
2332 | ** @purpose 1:12, Ensure timer in array can not be initialized with negative duration |
2333 | ** @verdict pass reject |
2334 | ***************************************************/ |
2335 | /* |
2336 | * #reqname /Requirements/12 Declaring timers/Timer value is non-neg float |
2337 | **/ |
2338 | |
2339 | |
2340 | module NegSem_12_toplevel_timer_002 { |
2341 | |
2342 | type component TComp{ |
2343 | timer t_timer[2] := {-1.0, 1.0}; |
2344 | } |
2345 | |
2346 | testcase TC_NegSem_12_toplevel_timer_002() runs on TComp{ |
2347 | t_timer[0].start; |
2348 | } |
2349 | |
2350 | control{ |
2351 | execute(TC_NegSem_12_toplevel_timer_002()); |
2352 | } |
2353 | } |
2354 | <END_MODULE> |
2355 | |
2356 | <RESULT COUNT 1> |
2357 | error: A non-negative float value was expected as timer duration instead of `-1.0e0' |
2358 | <END_RESULT> |
2359 | |
2360 | <END_TC> |
2361 | :exmp |
2362 | |
2363 | *---------------------------------------------------------------------* |
2364 | :h3. NegSem_12_toplevel_timer_003 negative test |
2365 | .*---------------------------------------------------------------------* |
2366 | :xmp tab=0. |
2367 | |
2368 | <TC - Ensure uninitialized timer can't be started > |
2369 | |
2370 | <COMPILE> |
2371 | |
2372 | <MODULE TTCN NegSem_12_toplevel_timer_003 NegSem_12_toplevel_timer_003.ttcn > |
2373 | /*************************************************** |
2374 | ** @version 0.0.1 |
2375 | ** @purpose 1:12, Ensure uninitialized timer can't be started |
2376 | ** @verdict pass reject |
2377 | ***************************************************/ |
2378 | /* |
2379 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2380 | **/ |
2381 | |
2382 | |
2383 | module NegSem_12_toplevel_timer_003 { |
2384 | |
2385 | type component TComp{ |
2386 | timer t_timer; |
2387 | } |
2388 | |
2389 | testcase TC_NegSem_12_toplevel_timer_003() runs on TComp{ |
2390 | t_timer.start; |
2391 | } |
2392 | |
2393 | control{ |
2394 | execute(TC_NegSem_12_toplevel_timer_003()) |
2395 | } |
2396 | } |
2397 | <END_MODULE> |
2398 | |
2399 | <RESULT COUNT 1> |
2400 | error: Missing duration: timer `@NegSem_12_toplevel_timer_003.TComp.t_timer' does not have default duration |
2401 | <END_RESULT> |
2402 | |
2403 | <END_TC> |
2404 | :exmp |
2405 | |
2406 | *---------------------------------------------------------------------* |
2407 | :h3. NegSem_12_toplevel_timer_004 negative test |
2408 | .*---------------------------------------------------------------------* |
2409 | :xmp tab=0. |
2410 | |
2411 | <TC - Ensure uninitialized timer in array can't be started > |
2412 | |
2413 | <COMPILE> |
2414 | |
2415 | <MODULE TTCN NegSem_12_toplevel_timer_004 NegSem_12_toplevel_timer_004.ttcn > |
2416 | /*************************************************** |
2417 | ** @version 0.0.1 |
2418 | ** @purpose 1:12, Ensure uninitialized timer in array can't be started |
2419 | ** @verdict pass reject |
2420 | ***************************************************/ |
2421 | /* |
2422 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2423 | **/ |
2424 | |
2425 | |
2426 | module NegSem_12_toplevel_timer_004 { |
2427 | type component TComp{ |
2428 | timer t_timer[2] := {-, 1.0}; |
2429 | } |
2430 | |
2431 | testcase TC_NegSem_12_toplevel_timer_004() runs on TComp{ |
2432 | t_timer[0].start; |
2433 | } |
2434 | |
2435 | control{ |
2436 | execute(TC_NegSem_12_toplevel_timer_004()); |
2437 | } |
2438 | } |
2439 | <END_MODULE> |
2440 | |
2441 | <RESULT COUNT 1> |
2442 | error: Missing duration: timer `@NegSem_12_toplevel_timer_004.TComp.t_timer' does not have default duration |
2443 | <END_RESULT> |
2444 | |
2445 | <END_TC> |
2446 | :exmp |
2447 | |
2448 | *---------------------------------------------------------------------* |
2449 | :h3. NegSem_12_toplevel_timer_005 negative test |
2450 | .*---------------------------------------------------------------------* |
2451 | :xmp tab=0. |
2452 | |
2453 | <TC - Ensure uninitialized timer in array can't be started > |
2454 | |
2455 | <COMPILE> |
2456 | |
2457 | <MODULE TTCN NegSem_12_toplevel_timer_005 NegSem_12_toplevel_timer_005.ttcn > |
2458 | /*************************************************** |
2459 | ** @version 0.0.1 |
2460 | ** @purpose 1:12, Ensure uninitialized timer in array can't be started |
2461 | ** @verdict pass reject |
2462 | ***************************************************/ |
2463 | /* |
2464 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2465 | **/ |
2466 | |
2467 | |
2468 | module NegSem_12_toplevel_timer_005 { |
2469 | |
2470 | type component TComp{ |
2471 | timer t_timer[2]; |
2472 | } |
2473 | |
2474 | testcase TC_NegSem_12_toplevel_timer_005() runs on TComp{ |
2475 | t_timer[0].start; |
2476 | } |
2477 | |
2478 | control{ |
2479 | execute(TC_NegSem_12_toplevel_timer_005()) |
2480 | } |
2481 | } |
2482 | <END_MODULE> |
2483 | |
2484 | <RESULT COUNT 1> |
2485 | error: Missing duration: timer `@NegSem_12_toplevel_timer_005.TComp.t_timer' does not have default duration |
2486 | <END_RESULT> |
2487 | |
2488 | <END_TC> |
2489 | :exmp |
2490 | |
2491 | *---------------------------------------------------------------------* |
2492 | :h3. NegSem_12_toplevel_timer_006 negative test |
2493 | .*---------------------------------------------------------------------* |
2494 | :xmp tab=0. |
2495 | |
2496 | <TC - Ensure timer declaration syntax - reject single timer instance initialized with array > |
2497 | |
2498 | <COMPILE> |
2499 | |
2500 | <MODULE TTCN NegSem_12_toplevel_timer_006 NegSem_12_toplevel_timer_006.ttcn > |
2501 | /*************************************************** |
2502 | ** @version 0.0.1 |
2503 | ** @purpose 1:12, Ensure timer declaration syntax - reject single timer instance initialized with array |
2504 | ** @verdict pass reject |
2505 | ***************************************************/ |
2506 | /* |
2507 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2508 | **/ |
2509 | |
2510 | |
2511 | module NegSem_12_toplevel_timer_006 { |
2512 | |
2513 | type component TComp{ |
2514 | timer t_timer := {1.0, 1.0, 1.0}; |
2515 | } |
2516 | |
2517 | testcase TC_NegSem_12_toplevel_timer_006() runs on TComp{ |
2518 | t_timer[0].start; |
2519 | } |
2520 | |
2521 | control{ |
2522 | execute(TC_NegSem_12_toplevel_timer_006()) |
2523 | } |
2524 | } |
2525 | <END_MODULE> |
2526 | |
2527 | <RESULT COUNT 1> |
2528 | error: A value or expression of type float was expected |
2529 | <END_RESULT> |
2530 | <RESULT COUNT 1> |
2531 | error: Reference to single timer `@NegSem_12_toplevel_timer_006.TComp.t_timer' cannot have field or array sub-references |
2532 | <END_RESULT> |
2533 | |
2534 | <END_TC> |
2535 | :exmp |
2536 | |
2537 | *---------------------------------------------------------------------* |
2538 | :h3. NegSem_12_toplevel_timer_007 negative test |
2539 | .*---------------------------------------------------------------------* |
2540 | :xmp tab=0. |
2541 | |
2542 | <TC - Ensure timer declaration syntax -- reject array initialization with wrong number of initializers > |
2543 | |
2544 | <COMPILE> |
2545 | |
2546 | <MODULE TTCN NegSem_12_toplevel_timer_007 NegSem_12_toplevel_timer_007.ttcn > |
2547 | /*************************************************** |
2548 | ** @version 0.0.1 |
2549 | ** @purpose 1:12, Ensure timer declaration syntax -- reject array initialization with wrong number of initializers |
2550 | ** @verdict pass reject |
2551 | ***************************************************/ |
2552 | /* |
2553 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2554 | **/ |
2555 | |
2556 | |
2557 | module NegSem_12_toplevel_timer_007 { |
2558 | type component TComp{ |
2559 | timer t_timer[4] := {1.0, 1.0, 1.0}; |
2560 | } |
2561 | |
2562 | testcase TC_NegSem_12_toplevel_timer_007() runs on TComp{ |
2563 | t_timer[0].start; |
2564 | } |
2565 | |
2566 | control{ |
2567 | execute(TC_NegSem_12_toplevel_timer_007()) |
2568 | } |
2569 | } |
2570 | <END_MODULE> |
2571 | |
2572 | <RESULT COUNT 1> |
2573 | error: Too few elements in the default duration of timer array: 4 was expected instead of 3 |
2574 | <END_RESULT> |
2575 | |
2576 | <END_TC> |
2577 | :exmp |
2578 | |
2579 | *---------------------------------------------------------------------* |
2580 | :h3. NegSem_12_toplevel_timer_008 negative test |
2581 | .*---------------------------------------------------------------------* |
2582 | :xmp tab=0. |
2583 | |
2584 | <TC - Ensure timer declaration syntax -- reject array of timers initizlized with a single float value > |
2585 | |
2586 | <COMPILE> |
2587 | |
2588 | <MODULE TTCN NegSem_12_toplevel_timer_008 NegSem_12_toplevel_timer_008.ttcn > |
2589 | /*************************************************** |
2590 | ** @version 0.0.1 |
2591 | ** @purpose 1:12, Ensure timer declaration syntax -- reject array of timers initizlized with a single float value |
2592 | ** @verdict pass reject |
2593 | ***************************************************/ |
2594 | /* |
2595 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2596 | **/ |
2597 | |
2598 | |
2599 | module NegSyn_12_toplevel_timer_008 { |
2600 | |
2601 | type component TComp{ |
2602 | timer t_timer[4] := 1.0; |
2603 | } |
2604 | |
2605 | testcase TC_NegSyn_12_toplevel_timer_008() runs on TComp{ |
2606 | t_timer[0].start; |
2607 | } |
2608 | |
2609 | control{ |
2610 | execute(TC_NegSyn_12_toplevel_timer_008()) |
2611 | } |
2612 | } |
2613 | <END_MODULE> |
2614 | |
2615 | <RESULT COUNT 1> |
2616 | error: An array value \(with 4 elements\) was expected as default duration of timer array |
2617 | <END_RESULT> |
2618 | |
2619 | <END_TC> |
2620 | :exmp |
2621 | |
2622 | *---------------------------------------------------------------------* |
2623 | :h3. NegSyn_12_toplevel_timer_001 negative test |
2624 | .*---------------------------------------------------------------------* |
2625 | :xmp tab=0. |
2626 | |
2627 | <TC - Ensure timer can`t be used in module control parts when declared in components > |
2628 | |
2629 | <COMPILE> |
2630 | |
2631 | <MODULE TTCN NegSyn_12_toplevel_timer_001 NegSyn_12_toplevel_timer_001.ttcn > |
2632 | /*************************************************** |
2633 | ** @version 0.0.1 |
2634 | ** @purpose 1:12, Ensure timer can`t be used in module control parts when declared in components |
2635 | ** @verdict pass reject |
2636 | ***************************************************/ |
2637 | /* |
2638 | * #reqname /Requirements/12 Declaring timers/Timers can be declared in component and used in test cases, functions, altsteps on this component |
2639 | **/ |
2640 | |
2641 | |
2642 | module NegSyn_12_toplevel_timer_001 { |
2643 | |
2644 | type component TComp{ |
2645 | timer t_timer:= 1.0; |
2646 | } |
2647 | |
2648 | testcase TC_NegSyn_12_toplevel_timer_001(integer f) runs on TComp{ |
2649 | if (f==0){ |
2650 | setverdict(fail); |
2651 | } |
2652 | else{ |
2653 | setverdict(pass); |
2654 | } |
2655 | } |
2656 | |
2657 | control{ |
2658 | |
2659 | t_timer.start; |
2660 | if (t_timer.running){ |
2661 | execute(TC_NegSyn_12_toplevel_timer_001(0)) |
2662 | } |
2663 | else{ |
2664 | execute(TC_NegSyn_12_toplevel_timer_001(1)) |
2665 | } |
2666 | |
2667 | } |
2668 | } |
2669 | <END_MODULE> |
2670 | |
2671 | <RESULT COUNT 2> |
2672 | error: There is no local or imported definition with name `t_timer' |
2673 | <END_RESULT> |
2674 | |
2675 | <END_TC> |
2676 | :exmp |
2677 | |
2678 | *---------------------------------------------------------------------* |
2679 | :h3. NegSyn_12_toplevel_timer_002 negative test |
2680 | .*---------------------------------------------------------------------* |
2681 | :xmp tab=0. |
2682 | |
2683 | <TC - Ensure timer declaration syntax > |
2684 | |
2685 | <COMPILE> |
2686 | |
2687 | <MODULE TTCN NegSyn_12_toplevel_timer_002 NegSyn_12_toplevel_timer_002.ttcn > |
2688 | /*************************************************** |
2689 | ** @version 0.0.1 |
2690 | ** @purpose 1:12, Ensure timer declaration syntax |
2691 | ** @verdict pass reject |
2692 | ***************************************************/ |
2693 | /* |
2694 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2695 | **/ |
2696 | |
2697 | |
2698 | module NegSyn_12_toplevel_timer_002 { |
2699 | |
2700 | type component TComp{ |
2701 | timer := 10.0; |
2702 | } |
2703 | |
2704 | testcase TC_NegSyn_12_toplevel_timer_002() runs on TComp{ |
2705 | |
2706 | } |
2707 | control{ |
2708 | execute(TC_NegSyn_12_toplevel_timer_002()) |
2709 | } |
2710 | } |
2711 | <END_MODULE> |
2712 | |
2713 | <RESULT COUNT 1> |
2714 | error: at or before token `:=': syntax error, unexpected :=, expecting Identifier |
2715 | <END_RESULT> |
2716 | |
2717 | <END_TC> |
2718 | :exmp |
2719 | |
2720 | *---------------------------------------------------------------------* |
2721 | :h3. NegSyn_12_toplevel_timer_003 negative test |
2722 | .*---------------------------------------------------------------------* |
2723 | :xmp tab=0. |
2724 | |
2725 | <TC - Ensure timer declaration syntax > |
2726 | |
2727 | <COMPILE> |
2728 | |
2729 | <MODULE TTCN NegSyn_12_toplevel_timer_003 NegSyn_12_toplevel_timer_003.ttcn > |
2730 | /*************************************************** |
2731 | ** @version 0.0.1 |
2732 | ** @purpose 1:12, Ensure timer declaration syntax |
2733 | ** @verdict pass reject |
2734 | ***************************************************/ |
2735 | /* |
2736 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2737 | **/ |
2738 | |
2739 | |
2740 | module NegSyn_12_toplevel_timer_003 { |
2741 | |
2742 | type component TComp{ |
2743 | timer t_timer :=; |
2744 | } |
2745 | |
2746 | testcase TC_NegSyn_12_toplevel_timer_003() runs on TComp{ |
2747 | |
2748 | } |
2749 | control{ |
2750 | execute(TC_NegSyn_12_toplevel_timer_003()) |
2751 | } |
2752 | } |
2753 | <END_MODULE> |
2754 | |
2755 | <RESULT COUNT 1> |
2756 | error: at or before token `;': syntax error, unexpected ';' |
2757 | <END_RESULT> |
2758 | |
2759 | <END_TC> |
2760 | :exmp |
2761 | |
2762 | *---------------------------------------------------------------------* |
2763 | :h3. NegSyn_12_toplevel_timer_004 negative test |
2764 | .*---------------------------------------------------------------------* |
2765 | :xmp tab=0. |
2766 | |
2767 | <TC - Ensure timer declaration syntax > |
2768 | |
2769 | <COMPILE> |
2770 | |
2771 | <MODULE TTCN NegSyn_12_toplevel_timer_004 NegSyn_12_toplevel_timer_004.ttcn > |
2772 | /*************************************************** |
2773 | ** @version 0.0.1 |
2774 | ** @purpose 1:04, Ensure timer declaration syntax |
2775 | ** @verdict pass reject |
2776 | ***************************************************/ |
2777 | /* |
2778 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2779 | **/ |
2780 | |
2781 | |
2782 | module NegSyn_04_toplevel_timer_004 { |
2783 | |
2784 | type component TComp{ |
2785 | timer t_timer 0.0; |
2786 | } |
2787 | |
2788 | testcase TC_NegSyn_04_toplevel_timer_004() runs on TComp{ |
2789 | |
2790 | } |
2791 | |
2792 | control{ |
2793 | execute(TC_NegSyn_04_toplevel_timer_004()) |
2794 | } |
2795 | } |
2796 | <END_MODULE> |
2797 | |
2798 | <RESULT COUNT 1> |
2799 | error: at or before token `0.0': syntax error, unexpected FloatValue |
2800 | <END_RESULT> |
2801 | |
2802 | <END_TC> |
2803 | :exmp |
2804 | |
2805 | *---------------------------------------------------------------------* |
2806 | :h3. NegSyn_12_toplevel_timer_005 negative test |
2807 | .*---------------------------------------------------------------------* |
2808 | :xmp tab=0. |
2809 | |
2810 | <TC - Ensure timer declaration syntax > |
2811 | |
2812 | <COMPILE> |
2813 | |
2814 | <MODULE TTCN NegSyn_12_toplevel_timer_005 NegSyn_12_toplevel_timer_005.ttcn > |
2815 | /*************************************************** |
2816 | ** @version 0.0.1 |
2817 | ** @purpose 1:12, Ensure timer declaration syntax |
2818 | ** @verdict pass reject |
2819 | ***************************************************/ |
2820 | /* |
2821 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2822 | **/ |
2823 | |
2824 | |
2825 | module NegSyn_12_toplevel_timer_005 { |
2826 | |
2827 | type component TComp{ |
2828 | timer t_timer := 1; |
2829 | } |
2830 | |
2831 | testcase TC_NegSyn_12_toplevel_timer_005() runs on TComp{ |
2832 | |
2833 | } |
2834 | |
2835 | control{ |
2836 | execute(TC_NegSyn_12_toplevel_timer_005()) |
2837 | } |
2838 | } |
2839 | <END_MODULE> |
2840 | |
2841 | <RESULT COUNT 1> |
2842 | error: A value or expression of type float was expected |
2843 | <END_RESULT> |
2844 | |
2845 | <END_TC> |
2846 | :exmp |
2847 | |
2848 | *---------------------------------------------------------------------* |
2849 | :h3. NegSyn_12_toplevel_timer_006 negative test |
2850 | .*---------------------------------------------------------------------* |
2851 | :xmp tab=0. |
2852 | |
2853 | <TC - Ensure timer array declaration syntax > |
2854 | |
2855 | <COMPILE> |
2856 | |
2857 | <MODULE TTCN NegSyn_12_toplevel_timer_006 NegSyn_12_toplevel_timer_006.ttcn > |
2858 | /*************************************************** |
2859 | ** @version 0.0.1 |
2860 | ** @purpose 1:12, Ensure timer array declaration syntax |
2861 | ** @verdict pass reject |
2862 | ***************************************************/ |
2863 | /* |
2864 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2865 | **/ |
2866 | |
2867 | |
2868 | module NegSyn_12_toplevel_timer_006 { |
2869 | |
2870 | type component TComp{ |
2871 | timer t_timer[5] := 1.0, 1.0, 1.0, 1.0, 1.0}; |
2872 | } |
2873 | |
2874 | testcase TC_NegSyn_12_toplevel_timer_006() runs on TComp{ |
2875 | |
2876 | } |
2877 | |
2878 | control{ |
2879 | execute(TC_NegSyn_12_toplevel_timer_006()) |
2880 | } |
2881 | } |
2882 | <END_MODULE> |
2883 | |
2884 | <RESULT COUNT 1> |
2885 | error: at or before token `1.0': syntax error, unexpected FloatValue, expecting Identifier |
2886 | <END_RESULT> |
2887 | |
2888 | <END_TC> |
2889 | :exmp |
2890 | |
2891 | |
2892 | *---------------------------------------------------------------------* |
2893 | :h3. NegSyn_12_toplevel_timer_007 negative test |
2894 | .*---------------------------------------------------------------------* |
2895 | :xmp tab=0. |
2896 | |
2897 | <TC - Ensure timer array declaration syntax > |
2898 | |
2899 | <COMPILE> |
2900 | |
2901 | <MODULE TTCN NegSyn_12_toplevel_timer_007 NegSyn_12_toplevel_timer_007.ttcn > |
2902 | /*************************************************** |
2903 | ** @version 0.0.1 |
2904 | ** @purpose 1:12, Ensure timer array declaration syntax |
2905 | ** @verdict pass reject |
2906 | ***************************************************/ |
2907 | /* |
2908 | * #reqname /Requirements/12 Declaring timers/Timer declaration syntax |
2909 | **/ |
2910 | |
2911 | |
2912 | module NegSyn_12_toplevel_timer_007 { |
2913 | |
2914 | type component TComp{ |
2915 | timer t_timer[5] := {1.0 1.0, 1.0, 1.0, 1.0}; |
2916 | } |
2917 | |
2918 | testcase TC_NegSyn_12_toplevel_timer_007() runs on TComp{ |
2919 | |
2920 | } |
2921 | |
2922 | control{ |
2923 | execute(TC_NegSyn_12_toplevel_timer_007()) |
2924 | } |
2925 | } |
2926 | <END_MODULE> |
2927 | |
2928 | <RESULT COUNT 1> |
2929 | error: at or before token `1.0': syntax error, unexpected FloatValue, expecting '\}' or ',' |
2930 | <END_RESULT> |
2931 | |
2932 | <END_TC> |
2933 | :exmp |
2934 | |
2935 | *---------------------------------------------------------------------* |
2936 | :h2. 14_procedure_signatures folder |
2937 | .*---------------------------------------------------------------------* |
2938 | *---------------------------------------------------------------------* |
2939 | :h3. egSem_1400_procedure_signatures_001 negative test |
2940 | .*---------------------------------------------------------------------* |
2941 | :xmp tab=0. |
2942 | |
2943 | <TC - Ensure that nonblocking signature contains in parameter > |
2944 | |
2945 | <COMPILE> |
2946 | |
2947 | <MODULE TTCN egSem_1400_procedure_signatures_001 egSem_1400_procedure_signatures_001.ttcn > |
2948 | /***************************************************************** |
2949 | ** @version 0.0.1 |
2950 | ** @purpose 1:22.3.1, Ensure that nonblocking signature contains in parameter |
2951 | ** @verdict pass reject |
2952 | *****************************************************************/ |
2953 | |
2954 | module NegSem_1400_procedure_signatures_001 { |
2955 | |
2956 | signature p_procedure_signatures_001(out integer p_par1) noblock; // noblock keyword, shall only have in parameters |
2957 | |
2958 | template p_procedure_signatures_001 s_returnTemplate := { |
2959 | p_par1 := - } |
2960 | |
2961 | type port remotePort procedure { |
2962 | inout p_procedure_signatures_001; |
2963 | } with {extension "internal"} |
2964 | |
2965 | type component GeneralComp { |
2966 | port remotePort PCO; |
2967 | } |
2968 | |
2969 | function f_ClientQuery() runs on GeneralComp { } |
2970 | |
2971 | testcase TC_NegSem_1400_procedure_signatures_001() runs on GeneralComp system GeneralComp { |
2972 | var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); |
2973 | var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); |
2974 | |
2975 | // map the PTCs to the system port |
2976 | connect(server:PCO, client:PCO); |
2977 | |
2978 | |
2979 | client.start(f_ClientQuery()); |
2980 | |
2981 | alt { |
2982 | [] client.done { |
2983 | server.stop; |
2984 | } |
2985 | } |
2986 | |
2987 | alt { |
2988 | [] all component.done {} |
2989 | } |
2990 | |
2991 | disconnect(server:PCO, client:PCO); |
2992 | } |
2993 | |
2994 | control{ |
2995 | execute(TC_NegSem_1400_procedure_signatures_001()); |
2996 | } |
2997 | |
2998 | } |
2999 | <END_MODULE> |
3000 | |
3001 | <RESULT COUNT 1> |
3002 | error: A non-blocking signature cannot have `out' parameter |
3003 | <END_RESULT> |
3004 | |
3005 | <END_TC> |
3006 | :exmp |
3007 | |
3008 | *---------------------------------------------------------------------* |
3009 | :h3. egSem_1400_procedure_signatures_002 negative test |
3010 | .*---------------------------------------------------------------------* |
3011 | :xmp tab=0. |
3012 | |
3013 | <TC - Ensure that blocking calls needs response or exception handling > |
3014 | |
3015 | <COMPILE> |
3016 | |
3017 | <MODULE TTCN egSem_1400_procedure_signatures_002 egSem_1400_procedure_signatures_002.ttcn > |
3018 | /***************************************************************** |
3019 | ** @version 0.0.1 |
3020 | ** @purpose 1:14, Ensure that blocking calls needs response or exception handling |
3021 | ** @verdict pass reject |
3022 | *****************************************************************/ |
3023 | // Multiple calls requires response or exception handling if the signature is blocking |
3024 | |
3025 | module NegSem_1400_procedure_signatures_002 { |
3026 | |
3027 | signature p_Sig1_001( in charstring key ); // noblock needed for multiple calls without response or exections |
3028 | |
3029 | type port remotePort procedure { |
3030 | inout p_Sig1_001; |
3031 | } with {extension "internal"} |
3032 | |
3033 | type component GeneralComp { |
3034 | port remotePort PCO; |
3035 | var integer MyComp; |
3036 | } |
3037 | |
3038 | |
3039 | function f_Server() runs on GeneralComp { |
3040 | timer t_guard; |
3041 | |
3042 | const charstring key[3] := {"My String1", "hello", "Probe string"}; |
3043 | |
3044 | t_guard.start( 5.0 ); |
3045 | |
3046 | for ( var integer i := 0; i < 3; i := i + 1 ) { |
3047 | PCO.call( p_Sig1_001:{key[i]});} |
3048 | setverdict(pass); |
3049 | |
3050 | t_guard.timeout; |
3051 | setverdict(fail); |
3052 | } |
3053 | |
3054 | function f_client() runs on GeneralComp { |
3055 | |
3056 | } |
3057 | |
3058 | testcase TC_NegSem_1400_procedure_signatures_002() runs on GeneralComp system GeneralComp { |
3059 | |
3060 | var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); |
3061 | var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); |
3062 | |
3063 | |
3064 | connect(server:PCO, client:PCO); |
3065 | |
3066 | server.start(f_Server()); |
3067 | client.start(f_client()); |
3068 | |
3069 | alt { |
3070 | [] client.done { |
3071 | server.stop; |
3072 | } |
3073 | } |
3074 | |
3075 | alt { |
3076 | [] all component.done {} |
3077 | } |
3078 | |
3079 | disconnect(server:PCO, client:PCO); |
3080 | } |
3081 | |
3082 | control{ |
3083 | execute(TC_NegSem_1400_procedure_signatures_002()); |
3084 | } |
3085 | |
3086 | } |
3087 | <END_MODULE> |
3088 | |
3089 | <RESULT COUNT 1> |
3090 | error: Response and exception handling part is missing from blocking call operation |
3091 | <END_RESULT> |
3092 | |
3093 | <END_TC> |
3094 | :exmp |
3095 | |
3096 | .*---------------------------------------------------------------------* |
3097 | :h1.References |
3098 | .*---------------------------------------------------------------------* |
3099 | :list. |
3100 | :li D='[1]'.1/174 02-CRL 113 200/5 Uen |
3101 | :nl.Statement of Compliance for TITAN project |
3102 | :li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): |
3103 | :nl.Testing and Test Control Notation version 3., |
3104 | :nl.Part 1: TTCN-3 Core Language |
3105 | :elist. |