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 06_types_and_values folder. |
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. 0601_basic_types_and_values folder |
54 | .*---------------------------------------------------------------------* |
55 | |
56 | *---------------------------------------------------------------------* |
57 | :h3. NegSem_0501_Identifier_001 negative test |
58 | .*---------------------------------------------------------------------* |
59 | :xmp tab=0. |
60 | |
61 | <TC - Assign float to integer values > |
62 | |
63 | <COMPILE> |
64 | |
65 | <MODULE TTCN NegSem_0501_Identifier_001 NegSem_0501_Identifier_001.ttcn > |
66 | /*************************************************** |
67 | ** @version 0.0.1 |
68 | ** @purpose 1:6.1.0, Assign float to integer values |
69 | ** @verdict pass reject |
70 | ***************************************************/ |
71 | module NegSyn_060100_SimpleBasicTypes_001 { |
72 | const integer c_i1 := 0.0; // not an integer value |
73 | } |
74 | <END_MODULE> |
75 | |
76 | <RESULT COUNT 1> |
77 | error: integer value was expected |
78 | <END_RESULT> |
79 | |
80 | <END_TC> |
81 | :exmp |
82 | |
83 | *---------------------------------------------------------------------* |
84 | :h3. NegSem_0501_Identifier_002 negative test |
85 | .*---------------------------------------------------------------------* |
86 | :xmp tab=0. |
87 | |
88 | <TC - Assign boolean to integer values > |
89 | |
90 | <COMPILE> |
91 | |
92 | <MODULE TTCN NegSem_0501_Identifier_002 NegSem_0501_Identifier_002.ttcn > |
93 | /*************************************************** |
94 | ** @version 0.0.1 |
95 | ** @purpose 1:6.1.0, Assign boolean to integer values |
96 | ** @verdict pass reject |
97 | ***************************************************/ |
98 | module NegSyn_060100_SimpleBasicTypes_002 { |
99 | const integer c_i1 := true; // not an integer value |
100 | } |
101 | <END_MODULE> |
102 | |
103 | <RESULT COUNT 1> |
104 | error: integer value was expected |
105 | <END_RESULT> |
106 | |
107 | <END_TC> |
108 | :exmp |
109 | |
110 | *---------------------------------------------------------------------* |
111 | :h3. NegSem_0501_Identifier_003 negative test |
112 | .*---------------------------------------------------------------------* |
113 | :xmp tab=0. |
114 | |
115 | <TC - Assign integer to float values > |
116 | |
117 | <COMPILE> |
118 | |
119 | <MODULE TTCN NegSem_0501_Identifier_003 NegSem_0501_Identifier_003.ttcn > |
120 | /*************************************************** |
121 | ** @version 0.0.1 |
122 | ** @purpose 1:6.1.0, Assign integer to float values |
123 | ** @verdict pass reject |
124 | ***************************************************/ |
125 | module NegSyn_060100_SimpleBasicTypes_003 { |
126 | const float c_f1 := 0; // not a float value |
127 | } |
128 | <END_MODULE> |
129 | |
130 | <RESULT COUNT 1> |
131 | error: float value was expected |
132 | <END_RESULT> |
133 | |
134 | <END_TC> |
135 | :exmp |
136 | |
137 | *---------------------------------------------------------------------* |
138 | :h3. NegSem_0501_Identifier_004 negative test |
139 | .*---------------------------------------------------------------------* |
140 | :xmp tab=0. |
141 | |
142 | <TC - Assign boolean to float values > |
143 | |
144 | <COMPILE> |
145 | |
146 | <MODULE TTCN NegSem_0501_Identifier_004 NegSem_0501_Identifier_004.ttcn > |
147 | /*************************************************** |
148 | ** @version 0.0.1 |
149 | ** @purpose 1:6.1.0, Assign boolean to float values |
150 | ** @verdict pass reject |
151 | ***************************************************/ |
152 | module NegSyn_060100_SimpleBasicTypes_004 { |
153 | const float c_f1 := true; // not a float value |
154 | } |
155 | <END_MODULE> |
156 | |
157 | <RESULT COUNT 1> |
158 | error: float value was expected |
159 | <END_RESULT> |
160 | |
161 | <END_TC> |
162 | :exmp |
163 | |
164 | *---------------------------------------------------------------------* |
165 | :h3. NegSem_0501_Identifier_005 negative test |
166 | .*---------------------------------------------------------------------* |
167 | :xmp tab=0. |
168 | |
169 | <TC - Assign verdicttype to float values > |
170 | |
171 | <COMPILE> |
172 | |
173 | <MODULE TTCN NegSem_0501_Identifier_005 NegSem_0501_Identifier_005.ttcn > |
174 | /*************************************************** |
175 | ** @version 0.0.1 |
176 | ** @purpose 1:6.1.0, Assign verdicttype to float values |
177 | ** @verdict pass reject |
178 | ***************************************************/ |
179 | module NegSyn_060100_SimpleBasicTypes_005 { |
180 | const float c_f1 := pass; // not a float value |
181 | } |
182 | <END_MODULE> |
183 | |
184 | <RESULT COUNT 1> |
185 | error: float value was expected |
186 | <END_RESULT> |
187 | |
188 | <END_TC> |
189 | :exmp |
190 | |
191 | *---------------------------------------------------------------------* |
192 | :h3. NegSem_0501_Identifier_006 negative test |
193 | .*---------------------------------------------------------------------* |
194 | :xmp tab=0. |
195 | |
196 | <TC - Assign integer to verdicttype values > |
197 | |
198 | <COMPILE> |
199 | |
200 | <MODULE TTCN NegSem_0501_Identifier_006 NegSem_0501_Identifier_006.ttcn > |
201 | /*************************************************** |
202 | ** @version 0.0.1 |
203 | ** @purpose 1:6.1.0, Assign integer to verdicttype values |
204 | ** @verdict pass reject |
205 | ***************************************************/ |
206 | module NegSyn_060100_SimpleBasicTypes_006 { |
207 | const verdicttype c_v1 := 1; // not a verdict |
208 | } |
209 | <END_MODULE> |
210 | |
211 | <RESULT COUNT 1> |
212 | error: verdict value was expected |
213 | <END_RESULT> |
214 | |
215 | <END_TC> |
216 | :exmp |
217 | |
218 | *---------------------------------------------------------------------* |
219 | :h3. NegSyn_060101_TopLevel_001 negative test |
220 | .*---------------------------------------------------------------------* |
221 | :xmp tab=0. |
222 | |
223 | <TC - Assign invalid bitstring value > |
224 | |
225 | <COMPILE> |
226 | |
227 | <MODULE TTCN NegSyn_060101_TopLevel_001 NegSyn_060101_TopLevel_001.ttcn > |
228 | /*************************************************** |
229 | ** @version 0.0.1 |
230 | ** @purpose 1:6.1.1, Assign invalid bitstring value |
231 | ** @verdict pass reject |
232 | ***************************************************/ |
233 | module NegSyn_060101_TopLevel_001 { |
234 | const bitstring c_b1 := '2'B; // not an bitstring value |
235 | } |
236 | <END_MODULE> |
237 | |
238 | <RESULT COUNT 1> |
239 | error: Bitstring value contains invalid character |
240 | <END_RESULT> |
241 | |
242 | <END_TC> |
243 | :exmp |
244 | |
245 | *---------------------------------------------------------------------* |
246 | :h3. NegSyn_060101_TopLevel_002 negative test |
247 | .*---------------------------------------------------------------------* |
248 | :xmp tab=0. |
249 | |
250 | <TC - Assign string to bitstring values > |
251 | |
252 | <COMPILE> |
253 | |
254 | <MODULE TTCN NegSyn_060101_TopLevel_002 NegSyn_060101_TopLevel_002.ttcn > |
255 | /*************************************************** |
256 | ** @version 0.0.1 |
257 | ** @purpose 1:6.1.1, Assign string to bitstring values |
258 | ** @verdict pass reject |
259 | ***************************************************/ |
260 | module NegSyn_060101_TopLevel_002 { |
261 | const bitstring c_b1 := "1"; // not an bitstring value |
262 | } |
263 | <END_MODULE> |
264 | |
265 | <RESULT COUNT 1> |
266 | error: bitstring value was expected |
267 | <END_RESULT> |
268 | |
269 | <END_TC> |
270 | :exmp |
271 | |
272 | *---------------------------------------------------------------------* |
273 | :h3. NegSyn_060101_TopLevel_003 negative test |
274 | .*---------------------------------------------------------------------* |
275 | :xmp tab=0. |
276 | |
277 | <TC - Assign octetstring to bitstring values > |
278 | |
279 | <COMPILE> |
280 | |
281 | <MODULE TTCN NegSyn_060101_TopLevel_003 NegSyn_060101_TopLevel_003.ttcn > |
282 | /*************************************************** |
283 | ** @version 0.0.1 |
284 | ** @purpose 1:6.1.1, Assign octetstring to bitstring values |
285 | ** @verdict pass reject |
286 | ***************************************************/ |
287 | module NegSyn_060101_TopLevel_003 { |
288 | const bitstring c_b1 := '01'O; // not an bitstring value |
289 | } |
290 | <END_MODULE> |
291 | |
292 | <RESULT COUNT 1> |
293 | error: bitstring value was expected |
294 | <END_RESULT> |
295 | |
296 | <END_TC> |
297 | :exmp |
298 | |
299 | *---------------------------------------------------------------------* |
300 | :h3. NegSyn_060101_TopLevel_004 negative test |
301 | .*---------------------------------------------------------------------* |
302 | :xmp tab=0. |
303 | |
304 | <TC - Assign invalid hexstring value > |
305 | |
306 | <COMPILE> |
307 | |
308 | <MODULE TTCN NegSyn_060101_TopLevel_004 NegSyn_060101_TopLevel_004.ttcn > |
309 | /*************************************************** |
310 | ** @version 0.0.1 |
311 | ** @purpose 1:6.1.1, Assign invalid hexstring value |
312 | ** @verdict pass reject |
313 | ***************************************************/ |
314 | module NegSyn_060101_TopLevel_004 { |
315 | const hexstring c_b1 := '01H'O; // not an hexstring value |
316 | } |
317 | <END_MODULE> |
318 | |
319 | <RESULT COUNT 1> |
320 | error: Invalid character `H' \(0x48\) in binary string |
321 | <END_RESULT> |
322 | |
323 | <END_TC> |
324 | :exmp |
325 | |
326 | *---------------------------------------------------------------------* |
327 | :h3. NegSyn_060101_TopLevel_005 negative test |
328 | .*---------------------------------------------------------------------* |
329 | :xmp tab=0. |
330 | |
331 | <TC - Assign string to hexstring values > |
332 | |
333 | <COMPILE> |
334 | |
335 | <MODULE TTCN NegSyn_060101_TopLevel_005 NegSyn_060101_TopLevel_005.ttcn > |
336 | /*************************************************** |
337 | ** @version 0.0.1 |
338 | ** @purpose 1:6.1.1, Assign string to hexstring values |
339 | ** @verdict pass reject |
340 | ***************************************************/ |
341 | module NegSyn_060101_TopLevel_005 { |
342 | const hexstring c_b1 := "010"; // not an hexstring value |
343 | } |
344 | <END_MODULE> |
345 | |
346 | <RESULT COUNT 1> |
347 | error: hexstring value was expected |
348 | <END_RESULT> |
349 | |
350 | <END_TC> |
351 | :exmp |
352 | |
353 | *---------------------------------------------------------------------* |
354 | :h3. NegSyn_060101_TopLevel_006 negative test |
355 | .*---------------------------------------------------------------------* |
356 | :xmp tab=0. |
357 | |
358 | <TC - Assign octetstring to hexstring values > |
359 | |
360 | <COMPILE> |
361 | |
362 | <MODULE TTCN NegSyn_060101_TopLevel_006 NegSyn_060101_TopLevel_006.ttcn > |
363 | /*************************************************** |
364 | ** @version 0.0.1 |
365 | ** @purpose 1:6.1.1, Assign octetstring to hexstring values |
366 | ** @verdict pass reject |
367 | ***************************************************/ |
368 | module NegSyn_060101_TopLevel_006 { |
369 | const hexstring c_b1 := '01'O; // not an hexstring value |
370 | } |
371 | <END_MODULE> |
372 | |
373 | <RESULT COUNT 1> |
374 | error: hexstring value was expected |
375 | <END_RESULT> |
376 | |
377 | <END_TC> |
378 | :exmp |
379 | |
380 | *---------------------------------------------------------------------* |
381 | :h3. NegSyn_060101_TopLevel_007 negative test |
382 | .*---------------------------------------------------------------------* |
383 | :xmp tab=0. |
384 | |
385 | <TC - Assign invalid octetstring value > |
386 | |
387 | <COMPILE> |
388 | |
389 | <MODULE TTCN NegSyn_060101_TopLevel_007 NegSyn_060101_TopLevel_007.ttcn > |
390 | /*************************************************** |
391 | ** @version 0.0.1 |
392 | ** @purpose 1:6.1.1, Assign invalid octetstring value |
393 | ** @verdict pass reject |
394 | ***************************************************/ |
395 | module NegSyn_060101_TopLevel_007 { |
396 | const octetstring c_b1 := '1FA'O; // not an octetstring value, odd number of nibbles |
397 | } |
398 | <END_MODULE> |
399 | |
400 | <RESULT COUNT 1> |
401 | error: Octetstring value contains odd number of hexadecimal digits |
402 | <END_RESULT> |
403 | |
404 | <END_TC> |
405 | :exmp |
406 | |
407 | *---------------------------------------------------------------------* |
408 | :h3. NegSyn_060101_TopLevel_008 negative test |
409 | .*---------------------------------------------------------------------* |
410 | :xmp tab=0. |
411 | |
412 | <TC - Assign string to octetstring values > |
413 | |
414 | <COMPILE> |
415 | |
416 | <MODULE TTCN NegSyn_060101_TopLevel_008 NegSyn_060101_TopLevel_008.ttcn > |
417 | /*************************************************** |
418 | ** @version 0.0.1 |
419 | ** @purpose 1:6.1.1, Assign string to octetstring values |
420 | ** @verdict pass reject |
421 | ***************************************************/ |
422 | module NegSyn_060101_TopLevel_008 { |
423 | const octetstring c_b1 := "F15A"; // not an octetstring value |
424 | } |
425 | <END_MODULE> |
426 | |
427 | <RESULT COUNT 1> |
428 | error: octetstring value was expected |
429 | <END_RESULT> |
430 | |
431 | <END_TC> |
432 | :exmp |
433 | |
434 | *---------------------------------------------------------------------* |
435 | :h3. NegSyn_060101_TopLevel_009 negative test |
436 | .*---------------------------------------------------------------------* |
437 | :xmp tab=0. |
438 | |
439 | <TC - Assign hexstring to octetstring values > |
440 | |
441 | <COMPILE> |
442 | |
443 | <MODULE TTCN NegSyn_060101_TopLevel_009 NegSyn_060101_TopLevel_009.ttcn > |
444 | /*************************************************** |
445 | ** @version 0.0.1 |
446 | ** @purpose 1:6.1.1, Assign hexstring to octetstring values |
447 | ** @verdict pass reject |
448 | ***************************************************/ |
449 | module NegSyn_060101_TopLevel_009 { |
450 | const octetstring c_b1 := 'FA'H; // not an octetstring value |
451 | } |
452 | <END_MODULE> |
453 | |
454 | <RESULT COUNT 1> |
455 | error: octetstring value was expected |
456 | <END_RESULT> |
457 | |
458 | <END_TC> |
459 | :exmp |
460 | |
461 | *---------------------------------------------------------------------* |
462 | :h3. NegSyn_060101_TopLevel_010 negative test |
463 | .*---------------------------------------------------------------------* |
464 | :xmp tab=0. |
465 | |
466 | <TC - Assign invalid hexstring value > |
467 | |
468 | <COMPILE> |
469 | |
470 | <MODULE TTCN NegSyn_060101_TopLevel_010 NegSyn_060101_TopLevel_010.ttcn > |
471 | /*************************************************** |
472 | ** @version 0.0.1 |
473 | ** @purpose 1:6.1.1, Assign invalid hexstring value |
474 | ** @verdict pass reject |
475 | ***************************************************/ |
476 | module NegSyn_060101_TopLevel_010 { |
477 | const octetstring c_b1 := '1FAH'O; // not an octetstring value, H not valid |
478 | } |
479 | <END_MODULE> |
480 | |
481 | <RESULT COUNT 1> |
482 | error: Invalid character `H' \(0x48\) in binary string |
483 | <END_RESULT> |
484 | |
485 | <END_TC> |
486 | :exmp |
487 | |
488 | *---------------------------------------------------------------------* |
489 | :h3. NegSem_06010201_ListOfValues_001 negative test |
490 | .*---------------------------------------------------------------------* |
491 | :xmp tab=0. |
492 | |
493 | <TC - Assign values to restricted bitstring. > |
494 | |
495 | <COMPILE> |
496 | |
497 | <MODULE TTCN NegSem_06010201_ListOfValues_001 NegSem_06010201_ListOfValues_001.ttcn > |
498 | /*************************************************** |
499 | ** @version 0.0.1 |
500 | ** @purpose 1:6.1.2.1, Assign values to restricted bitstring. |
501 | ** @verdict pass reject |
502 | ***************************************************/ |
503 | module NegSem_06010201_ListOfValues_001 { |
504 | type bitstring MyListOfBitStrings ('01'B, '10'B, '11'B); |
505 | |
506 | type component GeneralComp {} |
507 | |
508 | testcase TC_NegSem_06010201_ListOfValues_001() runs on GeneralComp { |
509 | var MyListOfBitStrings v_b := '00'B; // value is not defined by the type |
510 | setverdict(pass); |
511 | } |
512 | |
513 | control{ |
514 | execute(TC_NegSem_06010201_ListOfValues_001()); |
515 | } |
516 | } |
517 | <END_MODULE> |
518 | |
519 | <RESULT COUNT 1> |
520 | error: '00'B is not a valid value for type `bitstring' which has subtype length\(2\) except \('00'B\) |
521 | <END_RESULT> |
522 | |
523 | <END_TC> |
524 | :exmp |
525 | |
526 | *---------------------------------------------------------------------* |
527 | :h3. NegSem_06010201_ListOfValues_002 negative test |
528 | .*---------------------------------------------------------------------* |
529 | :xmp tab=0. |
530 | |
531 | <TC - Assign values to restricted hexstring. > |
532 | |
533 | <COMPILE> |
534 | |
535 | <MODULE TTCN NegSem_06010201_ListOfValues_002 NegSem_06010201_ListOfValues_002.ttcn > |
536 | /*************************************************** |
537 | ** @version 0.0.1 |
538 | ** @purpose 1:6.1.2.1, Assign values to restricted hexstring. |
539 | ** @verdict pass reject |
540 | ***************************************************/ |
541 | module NegSem_06010201_ListOfValues_002 { |
542 | type hexstring MyListOfHexStrings ('01'H, '10'H); |
543 | |
544 | type component GeneralComp {} |
545 | |
546 | testcase TC_NegSem_06010201_ListOfValues_002() runs on GeneralComp { |
547 | var MyListOfHexStrings v_h := '00'H; // value is not defined by the type |
548 | setverdict(pass); |
549 | } |
550 | |
551 | control{ |
552 | execute(TC_NegSem_06010201_ListOfValues_002()); |
553 | } |
554 | } |
555 | <END_MODULE> |
556 | |
557 | <RESULT COUNT 1> |
558 | error: '00'H is not a valid value for type `hexstring' which has subtype \('01'H,'10'H\) |
559 | <END_RESULT> |
560 | |
561 | <END_TC> |
562 | :exmp |
563 | |
564 | *---------------------------------------------------------------------* |
565 | :h3. NegSem_06010201_ListOfValues_003 negative test |
566 | .*---------------------------------------------------------------------* |
567 | :xmp tab=0. |
568 | |
569 | <TC - Assign values to restricted octetstring. > |
570 | |
571 | <COMPILE> |
572 | |
573 | <MODULE TTCN NegSem_06010201_ListOfValues_003 NegSem_06010201_ListOfValues_003.ttcn > |
574 | /*************************************************** |
575 | ** @version 0.0.1 |
576 | ** @purpose 1:6.1.2.1, Assign values to restricted octetstring. |
577 | ** @verdict pass reject |
578 | ***************************************************/ |
579 | module NegSem_06010201_ListOfValues_003 { |
580 | type octetstring MyListOfOctetStrings ('01'O, '10'O); |
581 | |
582 | type component GeneralComp {} |
583 | |
584 | testcase TC_NegSem_06010201_ListOfValues_003() runs on GeneralComp { |
585 | var MyListOfOctetStrings v_h := '00'O; // value is not defined by the type |
586 | setverdict(pass); |
587 | } |
588 | |
589 | control{ |
590 | execute(TC_NegSem_06010201_ListOfValues_003()); |
591 | } |
592 | } |
593 | <END_MODULE> |
594 | |
595 | <RESULT COUNT 1> |
596 | error: '00'O is not a valid value for type `octetstring' which has subtype \('01'O,'10'O\) |
597 | <END_RESULT> |
598 | |
599 | <END_TC> |
600 | :exmp |
601 | |
602 | *---------------------------------------------------------------------* |
603 | :h3. NegSem_06010201_ListOfValues_004 negative test |
604 | .*---------------------------------------------------------------------* |
605 | :xmp tab=0. |
606 | |
607 | <TC - Assign values to restricted charstring. > |
608 | |
609 | <COMPILE> |
610 | |
611 | <MODULE TTCN NegSem_06010201_ListOfValues_004 NegSem_06010201_ListOfValues_004.ttcn > |
612 | /*************************************************** |
613 | ** @version 0.0.1 |
614 | ** @purpose 1:6.1.2.1, Assign values to restricted charstring. |
615 | ** @verdict pass reject |
616 | ***************************************************/ |
617 | module NegSem_06010201_ListOfValues_004 { |
618 | type charstring MyCharstr ("a", "abc"); |
619 | |
620 | type component GeneralComp {} |
621 | |
622 | testcase TC_NegSem_06010201_ListOfValues_004() runs on GeneralComp { |
623 | var MyCharstr v_b := "d"; // value is not defined by the type |
624 | setverdict(pass); |
625 | } |
626 | |
627 | control{ |
628 | execute(TC_NegSem_06010201_ListOfValues_004()); |
629 | } |
630 | } |
631 | <END_MODULE> |
632 | |
633 | <RESULT COUNT 1> |
634 | error: "d" is not a valid value for type `charstring' which has subtype \("a","abc"\) |
635 | <END_RESULT> |
636 | |
637 | <END_TC> |
638 | :exmp |
639 | |
640 | *---------------------------------------------------------------------* |
641 | :h3. NegSem_06010201_ListOfValues_005 negative test |
642 | .*---------------------------------------------------------------------* |
643 | :xmp tab=0. |
644 | |
645 | <TC - Assign values to restricted integer. > |
646 | |
647 | <COMPILE> |
648 | |
649 | <MODULE TTCN NegSem_06010201_ListOfValues_005 NegSem_06010201_ListOfValues_005.ttcn > |
650 | /*************************************************** |
651 | ** @version 0.0.1 |
652 | ** @purpose 1:6.1.2.1, Assign values to restricted integer. |
653 | ** @verdict pass reject |
654 | ***************************************************/ |
655 | module NegSem_06010201_ListOfValues_005 { |
656 | type integer MyInt (1, 5); |
657 | |
658 | type component GeneralComp {} |
659 | |
660 | testcase TC_NegSem_06010201_ListOfValues_005() runs on GeneralComp { |
661 | var MyInt v_i := 2; // value is not defined by the type |
662 | setverdict(pass); |
663 | } |
664 | |
665 | control{ |
666 | execute(TC_NegSem_06010201_ListOfValues_005()); |
667 | } |
668 | } |
669 | <END_MODULE> |
670 | |
671 | <RESULT COUNT 1> |
672 | error: 2 is not a valid value for type `integer' which has subtype \(1,5\) |
673 | <END_RESULT> |
674 | |
675 | <END_TC> |
676 | :exmp |
677 | |
678 | *---------------------------------------------------------------------* |
679 | :h3. NegSem_06010201_ListOfValues_006 negative test |
680 | .*---------------------------------------------------------------------* |
681 | :xmp tab=0. |
682 | |
683 | <TC - Assign values to restricted float. > |
684 | |
685 | <COMPILE> |
686 | |
687 | <MODULE TTCN NegSem_06010201_ListOfValues_006 NegSem_06010201_ListOfValues_006.ttcn > |
688 | /*************************************************** |
689 | ** @version 0.0.1 |
690 | ** @purpose 1:6.1.2.1, Assign values to restricted float. |
691 | ** @verdict pass reject |
692 | ***************************************************/ |
693 | module NegSem_06010201_ListOfValues_006 { |
694 | type float MyFloat (1.0, 5.0); |
695 | |
696 | type component GeneralComp {} |
697 | |
698 | testcase TC_NegSem_06010201_ListOfValues_006() runs on GeneralComp { |
699 | var MyFloat v_f := 2.0; // value is not defined by the type |
700 | setverdict(pass); |
701 | } |
702 | |
703 | control{ |
704 | execute(TC_NegSem_06010201_ListOfValues_006()); |
705 | } |
706 | } |
707 | <END_MODULE> |
708 | |
709 | <RESULT COUNT 1> |
710 | error: 2.0e0 is not a valid value for type `float' which has subtype \(1.0e0,5.0e0\) |
711 | <END_RESULT> |
712 | |
713 | <END_TC> |
714 | :exmp |
715 | |
716 | *---------------------------------------------------------------------* |
717 | :h3. NegSem_06010202_ListOfTypes_001 negative test |
718 | .*---------------------------------------------------------------------* |
719 | :xmp tab=0. |
720 | |
721 | <TC - Assign invalid values to list of types restricted bitstring. > |
722 | |
723 | <COMPILE> |
724 | |
725 | <MODULE TTCN NegSem_06010202_ListOfTypes_001 NegSem_06010202_ListOfTypes_001.ttcn > |
726 | /*************************************************** |
727 | ** @version 0.0.1 |
728 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted bitstring. |
729 | ** @verdict pass reject |
730 | ***************************************************/ |
731 | module NegSem_06010202_ListOfTypes_001 { |
732 | type bitstring BitStrings1 ('0'B, '1'B ); |
733 | type bitstring BitStrings2 ('00'B, '01'B, '10'B, '10'B); |
734 | type bitstring BitStrings_1_2 (BitStrings1, BitStrings2); |
735 | |
736 | type component GeneralComp {} |
737 | |
738 | testcase TC_NegSem_06010202_ListOfTypes_001() runs on GeneralComp { |
739 | var BitStrings_1_2 v_b := '11'B; // 11 is not defined by the type |
740 | setverdict(pass); |
741 | } |
742 | |
743 | control{ |
744 | execute(TC_NegSem_06010202_ListOfTypes_001()); |
745 | } |
746 | } |
747 | <END_MODULE> |
748 | |
749 | <RESULT COUNT 1> |
750 | error: '11'B is not a valid value for type `bitstring' which has subtype length\(1..2\) except \('11'B\) |
751 | <END_RESULT> |
752 | |
753 | <END_TC> |
754 | :exmp |
755 | |
756 | *---------------------------------------------------------------------* |
757 | :h3. NegSem_06010202_ListOfTypes_002 negative test |
758 | .*---------------------------------------------------------------------* |
759 | :xmp tab=0. |
760 | |
761 | <TC - Assign invalid values to list of types restricted hexstring. > |
762 | |
763 | <COMPILE> |
764 | |
765 | <MODULE TTCN NegSem_06010202_ListOfTypes_002 NegSem_06010202_ListOfTypes_002.ttcn > |
766 | /*************************************************** |
767 | ** @version 0.0.1 |
768 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted hexstring. |
769 | ** @verdict pass reject |
770 | ***************************************************/ |
771 | module NegSem_06010202_ListOfTypes_002 { |
772 | type hexstring HexStrings1 ('FE80'H, '01'H ); |
773 | type hexstring HexStrings2 ('00'H, '7F'H, 'B8'H, 'A0'H); |
774 | type hexstring HexStrings_1_2 (HexStrings1, HexStrings2); |
775 | |
776 | type component GeneralComp {} |
777 | |
778 | testcase TC_NegSem_06010202_ListOfTypes_002() runs on GeneralComp { |
779 | var HexStrings_1_2 v_b; |
780 | v_b := 'FE70'H; //FE70 value is not defined by any hexstrings |
781 | setverdict(pass); |
782 | } |
783 | |
784 | control{ |
785 | execute(TC_NegSem_06010202_ListOfTypes_002()); |
786 | } |
787 | } |
788 | <END_MODULE> |
789 | |
790 | <RESULT COUNT 1> |
791 | error: 'FE70'H is not a valid value for type `hexstring' which has subtype \('00'H,'01'H,'7F'H,'A0'H,'B8'H,'FE80'H\) |
792 | <END_RESULT> |
793 | |
794 | <END_TC> |
795 | :exmp |
796 | |
797 | *---------------------------------------------------------------------* |
798 | :h3. NegSem_06010202_ListOfTypes_003 negative test |
799 | .*---------------------------------------------------------------------* |
800 | :xmp tab=0. |
801 | |
802 | <TC - Assign invalid values to list of types restricted octetstring. > |
803 | |
804 | <COMPILE> |
805 | |
806 | <MODULE TTCN NegSem_06010202_ListOfTypes_003 NegSem_06010202_ListOfTypes_003.ttcn > |
807 | /*************************************************** |
808 | ** @version 0.0.1 |
809 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted octetstring. |
810 | ** @verdict pass reject |
811 | ***************************************************/ |
812 | module NegSem_06010202_ListOfTypes_003 { |
813 | type octetstring Firstoctetstrings('0036'O,'0050'O); //30 and 40 in decimal |
814 | type octetstring Secondtoctetstrings ('0074'O,'0120'O); //50 and 60 in decimal |
815 | type octetstring octetStrings_1_2 (Firstoctetstrings, Secondtoctetstrings); |
816 | |
817 | type component GeneralComp {} |
818 | |
819 | testcase TC_NegSem_06010202_ListOfTypes_003() runs on GeneralComp { |
820 | var octetStrings_1_2 v_b; |
821 | v_b := '0014'O; // '0014'O value is not defined |
822 | setverdict(pass); |
823 | } |
824 | |
825 | control{ |
826 | execute(TC_NegSem_06010202_ListOfTypes_003()); |
827 | } |
828 | } |
829 | <END_MODULE> |
830 | |
831 | <RESULT COUNT 1> |
832 | error: '0014'O is not a valid value for type `octetstring' which has subtype \('0036'O,'0050'O,'0074'O,'0120'O\) |
833 | <END_RESULT> |
834 | |
835 | <END_TC> |
836 | :exmp |
837 | |
838 | *---------------------------------------------------------------------* |
839 | :h3. NegSem_06010202_ListOfTypes_004 negative test |
840 | .*---------------------------------------------------------------------* |
841 | :xmp tab=0. |
842 | |
843 | <TC - Assign invalid values to list of types restricted charstring. > |
844 | |
845 | <COMPILE> |
846 | |
847 | <MODULE TTCN NegSem_06010202_ListOfTypes_004 NegSem_06010202_ListOfTypes_004.ttcn > |
848 | /*************************************************** |
849 | ** @version 0.0.1 |
850 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted charstring. |
851 | ** @verdict pass reject |
852 | ***************************************************/ |
853 | module NegSem_06010202_ListOfTypes_004 { |
854 | type charstring Firstcharstrings("abc", "def"); |
855 | type charstring Secondcharstrings("ghi", "jkl"); |
856 | type charstring charStrings_1_2 (Firstcharstrings,Secondcharstrings); |
857 | |
858 | type component GeneralComp {} |
859 | |
860 | testcase TC_NegSem_06010202_ListOfTypes_004() runs on GeneralComp { |
861 | var charStrings_1_2 v_b; |
862 | v_b := "xyz"; // invalid charsting |
863 | setverdict(pass); |
864 | } |
865 | |
866 | control{ |
867 | execute(TC_NegSem_06010202_ListOfTypes_004()); |
868 | } |
869 | } |
870 | <END_MODULE> |
871 | |
872 | <RESULT COUNT 1> |
873 | error: "xyz" is not a valid value for type `charstring' which has subtype \("abc","def","ghi","jkl"\) |
874 | <END_RESULT> |
875 | |
876 | <END_TC> |
877 | :exmp |
878 | |
879 | *---------------------------------------------------------------------* |
880 | :h3. NegSem_06010202_ListOfTypes_005 negative test |
881 | .*---------------------------------------------------------------------* |
882 | :xmp tab=0. |
883 | |
884 | <TC - Assign invalid values to list of types restricted universal charstrings. > |
885 | |
886 | <COMPILE> |
887 | |
888 | <MODULE TTCN NegSem_06010202_ListOfTypes_005 NegSem_06010202_ListOfTypes_005.ttcn > |
889 | /*************************************************** |
890 | ** @version 0.0.1 |
891 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted universal charstrings. |
892 | ** @verdict pass reject |
893 | ***************************************************/ |
894 | module NegSem_06010202_ListOfTypes_005 { |
895 | type universal charstring unicharString1 ("0" .. "9","A".."Z"); // charstring between "0" and "9" and "A".."Z" |
896 | type universal charstring unicharString2 ("a".."z"); // charstring between "a" to "z" |
897 | type universal charstring unicharStrings_1_2 (unicharString1, unicharString2); |
898 | type component GeneralComp {} |
899 | |
900 | testcase TC_NegSem_06010202_ListOfTypes_005() runs on GeneralComp { |
901 | var unicharStrings_1_2 v_b; |
902 | v_b:="?"; // invalid |
903 | setverdict(pass); |
904 | } |
905 | |
906 | control{ |
907 | execute(TC_NegSem_06010202_ListOfTypes_005()); |
908 | } |
909 | } |
910 | <END_MODULE> |
911 | |
912 | <RESULT COUNT 1> |
913 | error: "\?" is not a valid value for type `universal charstring' which has subtype \(from\("0".."9","A".."Z"\) union from\("a".."z"\)\) |
914 | <END_RESULT> |
915 | |
916 | <END_TC> |
917 | :exmp |
918 | |
919 | *---------------------------------------------------------------------* |
920 | :h3. NegSem_06010202_ListOfTypes_006 negative test |
921 | .*---------------------------------------------------------------------* |
922 | :xmp tab=0. |
923 | |
924 | <TC - Assign invalid values to list of types restricted integers. > |
925 | |
926 | <COMPILE> |
927 | |
928 | <MODULE TTCN NegSem_06010202_ListOfTypes_006 NegSem_06010202_ListOfTypes_006.ttcn > |
929 | /*************************************************** |
930 | ** @version 0.0.1 |
931 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted integers. |
932 | ** @verdict pass reject |
933 | ***************************************************/ |
934 | module NegSem_06010202_ListOfTypes_006 { |
935 | type integer Integer1 (0..9 ); |
936 | type integer Integer2 (20..30); |
937 | type integer Integer_1_2 (Integer1, Integer2); |
938 | |
939 | type component GeneralComp {} |
940 | |
941 | testcase TC_NegSem_06010202_ListOfTypes_006() runs on GeneralComp { |
942 | var Integer_1_2 v_b; |
943 | v_b := 15; //invalid |
944 | setverdict(pass); |
945 | } |
946 | |
947 | control{ |
948 | execute(TC_NegSem_06010202_ListOfTypes_006()); |
949 | } |
950 | } |
951 | <END_MODULE> |
952 | |
953 | <RESULT COUNT 1> |
954 | error: 15 is not a valid value for type `integer' which has subtype \(0..9,20..30\) |
955 | <END_RESULT> |
956 | |
957 | <END_TC> |
958 | :exmp |
959 | |
960 | *---------------------------------------------------------------------* |
961 | :h3. NegSem_06010202_ListOfTypes_007 negative test |
962 | .*---------------------------------------------------------------------* |
963 | :xmp tab=0. |
964 | |
965 | <TC - Assign invalid values to list of types restricted floats. > |
966 | |
967 | <COMPILE> |
968 | |
969 | <MODULE TTCN NegSem_06010202_ListOfTypes_007 NegSem_06010202_ListOfTypes_007.ttcn > |
970 | /*************************************************** |
971 | ** @version 0.0.1 |
972 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted floats. |
973 | ** @verdict pass reject |
974 | ***************************************************/ |
975 | module NegSem_06010202_ListOfTypes_007 { |
976 | type float Float1 (1.0E0..9E0); //float values between 1 and 9 |
977 | type float Float2 (2.0E1..3.0E1); //float values between 20 and 30 |
978 | type float Float_1_2 (Float1, Float2); |
979 | |
980 | type component GeneralComp {} |
981 | |
982 | testcase TC_NegSem_06010202_ListOfTypes_007() runs on GeneralComp { |
983 | var Float_1_2 v_b; |
984 | v_b := 15.5E0; //invalid |
985 | setverdict(pass); |
986 | } |
987 | |
988 | control{ |
989 | execute(TC_NegSem_06010202_ListOfTypes_007()); |
990 | } |
991 | } |
992 | <END_MODULE> |
993 | |
994 | <RESULT COUNT 1> |
995 | error: 1.55e1 is not a valid value for type `float' which has subtype \(1.0e0..9.0e0,2.0e1..3.0e1\) |
996 | <END_RESULT> |
997 | |
998 | <END_TC> |
999 | :exmp |
1000 | |
1001 | *---------------------------------------------------------------------* |
1002 | :h3. NegSem_06010202_ListOfTypes_008 negative test |
1003 | .*---------------------------------------------------------------------* |
1004 | :xmp tab=0. |
1005 | |
1006 | <TC - Assign invalid values to list of types restricted boolean value. > |
1007 | |
1008 | <COMPILE> |
1009 | |
1010 | <MODULE TTCN NegSem_06010202_ListOfTypes_008 NegSem_06010202_ListOfTypes_008.ttcn > |
1011 | /*************************************************** |
1012 | ** @version 0.0.1 |
1013 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted boolean value. |
1014 | ** @verdict pass reject |
1015 | ***************************************************/ |
1016 | module NegSem_06010202_ListOfTypes_008 { |
1017 | type boolean MyBoolean1 (false); //only "false" is accepted |
1018 | type boolean MyBoolean2 (false); |
1019 | type boolean MyBoolean_1_2 (MyBoolean1, MyBoolean2); |
1020 | |
1021 | type component GeneralComp {} |
1022 | |
1023 | testcase TC_NegSem_06010202_ListOfTypes_008() runs on GeneralComp { |
1024 | var MyBoolean_1_2 v_b; |
1025 | v_b := true; // invalid |
1026 | setverdict(pass); |
1027 | } |
1028 | |
1029 | control{ |
1030 | execute(TC_NegSem_06010202_ListOfTypes_008()); |
1031 | } |
1032 | } |
1033 | <END_MODULE> |
1034 | |
1035 | <RESULT COUNT 1> |
1036 | error: true is not a valid value for type `boolean' which has subtype \(false\) |
1037 | <END_RESULT> |
1038 | |
1039 | <END_TC> |
1040 | :exmp |
1041 | |
1042 | *---------------------------------------------------------------------* |
1043 | :h3. NegSem_06010202_ListOfTypes_009 negative test |
1044 | .*---------------------------------------------------------------------* |
1045 | :xmp tab=0. |
1046 | |
1047 | <TC - Assign invalid values to list of types restricted verdicttype. > |
1048 | |
1049 | <COMPILE> |
1050 | |
1051 | <MODULE TTCN NegSem_06010202_ListOfTypes_009 NegSem_06010202_ListOfTypes_009.ttcn > |
1052 | /*************************************************** |
1053 | ** @version 0.0.1 |
1054 | ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted verdicttype. |
1055 | ** @verdict pass reject |
1056 | ***************************************************/ |
1057 | module NegSem_06010202_ListOfTypes_009 { |
1058 | type verdicttype Myverdict1 (pass, error); //only "pass" and "error" values are listed |
1059 | type verdicttype Myverdict2 (inconc, none); //only "inconc" and "none" values are listed |
1060 | type verdicttype Myverdict_1_2 (Myverdict1, Myverdict2); |
1061 | |
1062 | |
1063 | type component GeneralComp {} |
1064 | |
1065 | testcase TC_NegSem_06010202_ListOfTypes_009() runs on GeneralComp { |
1066 | var Myverdict_1_2 v_b; |
1067 | v_b := fail; //invalid |
1068 | setverdict(pass); |
1069 | } |
1070 | control{ |
1071 | execute(TC_NegSem_06010202_ListOfTypes_009()); |
1072 | } |
1073 | } |
1074 | <END_MODULE> |
1075 | |
1076 | <RESULT COUNT 1> |
1077 | error: fail is not a valid value for type `verdicttype' which has subtype \(none,pass,inconc,error\) |
1078 | <END_RESULT> |
1079 | |
1080 | <END_TC> |
1081 | :exmp |
1082 | |
1083 | *---------------------------------------------------------------------* |
1084 | :h3. NegSem_06010203_Ranges_001 negative test |
1085 | .*---------------------------------------------------------------------* |
1086 | :xmp tab=0. |
1087 | |
1088 | <TC - Assign invalid values to restricted integer. > |
1089 | |
1090 | <COMPILE> |
1091 | |
1092 | <MODULE TTCN NegSem_06010203_Ranges_001 NegSem_06010203_Ranges_001.ttcn > |
1093 | /*************************************************** |
1094 | ** @version 0.0.1 |
1095 | ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer. |
1096 | ** @verdict pass reject |
1097 | ***************************************************/ |
1098 | module NegSem_06010203_Ranges_001 { |
1099 | type integer MyIntegerRange (0 .. 255); |
1100 | |
1101 | type component GeneralComp {} |
1102 | |
1103 | testcase TC_NegSem_06010203_Ranges_001() runs on GeneralComp { |
1104 | var MyIntegerRange v_i := -1; // -1 is outside range |
1105 | setverdict(pass); |
1106 | } |
1107 | |
1108 | control{ |
1109 | execute(TC_NegSem_06010203_Ranges_001()); |
1110 | } |
1111 | } |
1112 | <END_MODULE> |
1113 | |
1114 | <RESULT COUNT 1> |
1115 | error: -1 is not a valid value for type `integer' which has subtype \(0..255\) |
1116 | <END_RESULT> |
1117 | |
1118 | <END_TC> |
1119 | :exmp |
1120 | |
1121 | *---------------------------------------------------------------------* |
1122 | :h3. NegSem_06010203_Ranges_002 negative test |
1123 | .*---------------------------------------------------------------------* |
1124 | :xmp tab=0. |
1125 | |
1126 | <TC - Assign invalid values to restricted integer. > |
1127 | |
1128 | <COMPILE> |
1129 | |
1130 | <MODULE TTCN NegSem_06010203_Ranges_002 NegSem_06010203_Ranges_002.ttcn > |
1131 | /*************************************************** |
1132 | ** @version 0.0.1 |
1133 | ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer. |
1134 | ** @verdict pass reject |
1135 | ***************************************************/ |
1136 | module NegSem_06010203_Ranges_002 { |
1137 | type integer MyIntegerRange (-infinity .. 0); |
1138 | |
1139 | type component GeneralComp {} |
1140 | |
1141 | testcase TC_NegSem_06010203_Ranges_002() runs on GeneralComp { |
1142 | var MyIntegerRange v_i := 1; // 1 is outside range |
1143 | setverdict(pass); |
1144 | } |
1145 | |
1146 | control{ |
1147 | execute(TC_NegSem_06010203_Ranges_002()); |
1148 | } |
1149 | } |
1150 | <END_MODULE> |
1151 | |
1152 | <RESULT COUNT 1> |
1153 | error: 1 is not a valid value for type `integer' which has subtype \(-infinity..0\) |
1154 | <END_RESULT> |
1155 | |
1156 | <END_TC> |
1157 | :exmp |
1158 | |
1159 | *---------------------------------------------------------------------* |
1160 | :h3. NegSem_06010203_Ranges_003 negative test |
1161 | .*---------------------------------------------------------------------* |
1162 | :xmp tab=0. |
1163 | |
1164 | <TC - Assure that not_a_number is not allowed in float range subtyping. > |
1165 | |
1166 | <COMPILE> |
1167 | |
1168 | <MODULE TTCN NegSem_06010203_Ranges_003 NegSem_06010203_Ranges_003.ttcn > |
1169 | /*************************************************** |
1170 | ** @version 0.0.1 |
1171 | ** @purpose 1:6.1.2.3, Assure that not_a_number is not allowed in float range subtyping. |
1172 | ** @verdict pass reject |
1173 | ***************************************************/ |
1174 | module NegSem_06010203_Ranges_003 { |
1175 | // causes an error as not_a_number is not allowed in range subtyping |
1176 | type float MyFloatRange (-infinity .. not_a_number); |
1177 | |
1178 | type component GeneralComp {} |
1179 | |
1180 | testcase TC_NegSem_06010203_Ranges_003() runs on GeneralComp { |
1181 | var MyFloatRange v_i; |
1182 | setverdict(pass); |
1183 | } |
1184 | |
1185 | control{ |
1186 | execute(TC_NegSem_06010203_Ranges_003()); |
1187 | } |
1188 | } |
1189 | <END_MODULE> |
1190 | |
1191 | <RESULT COUNT 1> |
1192 | error: upper boundary cannot be not_a_number in float subtype range |
1193 | <END_RESULT> |
1194 | |
1195 | <END_TC> |
1196 | :exmp |
1197 | |
1198 | *---------------------------------------------------------------------* |
1199 | :h3. NegSem_06010203_Ranges_004 negative test |
1200 | .*---------------------------------------------------------------------* |
1201 | :xmp tab=0. |
1202 | |
1203 | <TC - Assign invalid values to restricted integer with exclusive bounds. > |
1204 | |
1205 | <COMPILE> |
1206 | |
1207 | <MODULE TTCN NegSem_06010203_Ranges_004 NegSem_06010203_Ranges_004.ttcn > |
1208 | /*************************************************** |
1209 | ** @version 0.0.1 |
1210 | ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer with exclusive bounds. |
1211 | ** @verdict pass reject |
1212 | ***************************************************/ |
1213 | module NegSem_06010203_Ranges_004 { |
1214 | type integer MyIntegerRange (!-3 .. 0); |
1215 | |
1216 | type component GeneralComp {} |
1217 | |
1218 | testcase TC_NegSem_06010203_Ranges_004() runs on GeneralComp { |
1219 | var MyIntegerRange v_i := -3; // -3 is outside range |
1220 | setverdict(pass); |
1221 | } |
1222 | |
1223 | control{ |
1224 | execute(TC_NegSem_06010203_Ranges_004()); |
1225 | } |
1226 | } |
1227 | <END_MODULE> |
1228 | |
1229 | <RESULT COUNT 1> |
1230 | error: -3 is not a valid value for type `integer' which has subtype \(-2..0\) |
1231 | <END_RESULT> |
1232 | |
1233 | <END_TC> |
1234 | :exmp |
1235 | |
1236 | *---------------------------------------------------------------------* |
1237 | :h3. NegSem_06010203_Ranges_005 negative test |
1238 | .*---------------------------------------------------------------------* |
1239 | :xmp tab=0. |
1240 | |
1241 | <TC - Assign invalid values to restricted integer with exclusive bounds. > |
1242 | |
1243 | <COMPILE> |
1244 | |
1245 | <MODULE TTCN NegSem_06010203_Ranges_005 NegSem_06010203_Ranges_005.ttcn > |
1246 | /*************************************************** |
1247 | ** @version 0.0.1 |
1248 | ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer with exclusive bounds. |
1249 | ** @verdict pass reject |
1250 | ***************************************************/ |
1251 | module NegSem_06010203_Ranges_005 { |
1252 | type integer MyIntegerRange (-infinity .. !0); |
1253 | |
1254 | type component GeneralComp {} |
1255 | |
1256 | testcase TC_NegSem_06010203_Ranges_005() runs on GeneralComp { |
1257 | var MyIntegerRange v_i := 0; // 0 is outside range |
1258 | setverdict(pass); |
1259 | } |
1260 | |
1261 | control{ |
1262 | execute(TC_NegSem_06010203_Ranges_005()); |
1263 | } |
1264 | } |
1265 | <END_MODULE> |
1266 | |
1267 | <RESULT COUNT 1> |
1268 | error: 0 is not a valid value for type `integer' which has subtype \(-infinity..-1\) |
1269 | <END_RESULT> |
1270 | |
1271 | <END_TC> |
1272 | :exmp |
1273 | |
1274 | *---------------------------------------------------------------------* |
1275 | :h3. NegSem_06010203_Ranges_006 negative test |
1276 | .*---------------------------------------------------------------------* |
1277 | :xmp tab=0. |
1278 | |
1279 | <TC - Assign range to boolean not permitted. > |
1280 | |
1281 | <COMPILE> |
1282 | |
1283 | <MODULE TTCN NegSem_06010203_Ranges_006 NegSem_06010203_Ranges_006.ttcn > |
1284 | /*************************************************** |
1285 | ** @version 0.0.1 |
1286 | ** @purpose 1:6.1.2.3, Assign range to boolean not permitted. |
1287 | ** @verdict pass reject |
1288 | ***************************************************/ |
1289 | module NegSem_06010203_Ranges_006 { |
1290 | // only restrictions for integer, float, charstring and universal charstring are allowed in ranges |
1291 | type boolean MyBooleanRange (false .. true); // should be rejected |
1292 | |
1293 | type component GeneralComp {} |
1294 | |
1295 | testcase TC_NegSem_06010203_Ranges_006() runs on GeneralComp { |
1296 | var MyBooleanRange v_b1; |
1297 | v_b1 := true; |
1298 | v_b1 := false; |
1299 | setverdict(pass); |
1300 | } |
1301 | |
1302 | control{ |
1303 | execute(TC_NegSem_06010203_Ranges_006()); |
1304 | } |
1305 | } |
1306 | <END_MODULE> |
1307 | |
1308 | <RESULT COUNT 1> |
1309 | error: Range subtyping is not allowed for type `boolean' |
1310 | <END_RESULT> |
1311 | |
1312 | <END_TC> |
1313 | :exmp |
1314 | |
1315 | *---------------------------------------------------------------------* |
1316 | :h3. NegSem_06010203_Ranges_007 negative test |
1317 | .*---------------------------------------------------------------------* |
1318 | :xmp tab=0. |
1319 | |
1320 | <TC - Assign invalid value to range constrained charstring. > |
1321 | |
1322 | <COMPILE> |
1323 | |
1324 | <MODULE TTCN NegSem_06010203_Ranges_007 NegSem_06010203_Ranges_007.ttcn > |
1325 | /*************************************************** |
1326 | ** @version 0.0.1 |
1327 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. |
1328 | ** @verdict pass reject |
1329 | ***************************************************/ |
1330 | module NegSem_06010203_Ranges_007 { |
1331 | type charstring MyCharstringRange (!"a"..!"f"); |
1332 | |
1333 | type component GeneralComp {} |
1334 | |
1335 | testcase TC_NegSem_06010203_Ranges_007() runs on GeneralComp { |
1336 | var MyCharstringRange v_c1; |
1337 | v_c1 := "a"; |
1338 | setverdict(pass); |
1339 | } |
1340 | |
1341 | control{ |
1342 | execute(TC_NegSem_06010203_Ranges_007()); |
1343 | } |
1344 | } |
1345 | <END_MODULE> |
1346 | |
1347 | <RESULT COUNT 1> |
1348 | error: "a" is not a valid value for type `charstring' which has subtype from\("b".."e"\) |
1349 | <END_RESULT> |
1350 | |
1351 | <END_TC> |
1352 | :exmp |
1353 | |
1354 | *---------------------------------------------------------------------* |
1355 | :h3. NegSem_06010203_Ranges_008 negative test |
1356 | .*---------------------------------------------------------------------* |
1357 | :xmp tab=0. |
1358 | |
1359 | <TC - Assign invalid value to range constrained charstring. > |
1360 | |
1361 | <COMPILE> |
1362 | |
1363 | <MODULE TTCN NegSem_06010203_Ranges_008 NegSem_06010203_Ranges_008.ttcn > |
1364 | /*************************************************** |
1365 | ** @version 0.0.1 |
1366 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. |
1367 | ** @verdict pass reject |
1368 | ***************************************************/ |
1369 | module NegSem_06010203_Ranges_008 { |
1370 | type charstring MyCharstringRange ("a"..!"f"); |
1371 | |
1372 | type component GeneralComp {} |
1373 | |
1374 | testcase TC_NegSem_06010203_Ranges_008() runs on GeneralComp { |
1375 | var MyCharstringRange v_c1; |
1376 | v_c1 := "f"; |
1377 | setverdict(pass); |
1378 | } |
1379 | |
1380 | control{ |
1381 | execute(TC_NegSem_06010203_Ranges_008()); |
1382 | } |
1383 | } |
1384 | <END_MODULE> |
1385 | |
1386 | <RESULT COUNT 1> |
1387 | error: "f" is not a valid value for type `charstring' which has subtype from\("a".."e"\) |
1388 | <END_RESULT> |
1389 | |
1390 | <END_TC> |
1391 | :exmp |
1392 | |
1393 | *---------------------------------------------------------------------* |
1394 | :h3. NegSem_06010203_Ranges_009 negative test |
1395 | .*---------------------------------------------------------------------* |
1396 | :xmp tab=0. |
1397 | |
1398 | <TC - Assign invalid value to range constrained charstring. > |
1399 | |
1400 | <COMPILE> |
1401 | |
1402 | <MODULE TTCN NegSem_06010203_Ranges_009 NegSem_06010203_Ranges_009.ttcn > |
1403 | /*************************************************** |
1404 | ** @version 0.0.1 |
1405 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. |
1406 | ** @verdict pass reject |
1407 | ***************************************************/ |
1408 | module NegSem_06010203_Ranges_009 { |
1409 | type charstring MyCharstringRange ("a".."f"); |
1410 | |
1411 | type component GeneralComp {} |
1412 | |
1413 | testcase TC_NegSem_06010203_Ranges_009() runs on GeneralComp { |
1414 | var MyCharstringRange v_c1; |
1415 | v_c1 := "g"; |
1416 | setverdict(pass); |
1417 | } |
1418 | |
1419 | control{ |
1420 | execute(TC_NegSem_06010203_Ranges_009()); |
1421 | } |
1422 | } |
1423 | <END_MODULE> |
1424 | |
1425 | <RESULT COUNT 1> |
1426 | error: "g" is not a valid value for type `charstring' which has subtype from\("a".."f"\) |
1427 | <END_RESULT> |
1428 | |
1429 | <END_TC> |
1430 | :exmp |
1431 | |
1432 | *---------------------------------------------------------------------* |
1433 | :h3. NegSem_06010203_Ranges_010 negative test |
1434 | .*---------------------------------------------------------------------* |
1435 | :xmp tab=0. |
1436 | |
1437 | <TC - Assign invalid values to restricted float. > |
1438 | |
1439 | <COMPILE> |
1440 | |
1441 | <MODULE TTCN NegSem_06010203_Ranges_010 NegSem_06010203_Ranges_010.ttcn > |
1442 | /*************************************************** |
1443 | ** @version 0.0.1 |
1444 | ** @purpose 1:6.1.2.3, Assign invalid values to restricted float. |
1445 | ** @verdict pass reject |
1446 | ***************************************************/ |
1447 | module NegSem_06010203_Ranges_010 { |
1448 | type float MyFloatRange (-infinity .. 0.0); |
1449 | |
1450 | type component GeneralComp {} |
1451 | |
1452 | testcase TC_NegSem_06010203_Ranges_010() runs on GeneralComp { |
1453 | var MyFloatRange v_f := 1.0; // 1.0 is outside range |
1454 | setverdict(pass); |
1455 | } |
1456 | |
1457 | control{ |
1458 | execute(TC_NegSem_06010203_Ranges_010()); |
1459 | } |
1460 | } |
1461 | <END_MODULE> |
1462 | |
1463 | <RESULT COUNT 1> |
1464 | error: 1.0e0 is not a valid value for type `float' which has subtype \(-INF..0.0e0\) |
1465 | <END_RESULT> |
1466 | |
1467 | <END_TC> |
1468 | :exmp |
1469 | |
1470 | *---------------------------------------------------------------------* |
1471 | :h3. NegSem_06010203_Ranges_011 negative test |
1472 | .*---------------------------------------------------------------------* |
1473 | :xmp tab=0. |
1474 | |
1475 | <TC - Assign invalid values to restricted float. > |
1476 | |
1477 | <COMPILE> |
1478 | |
1479 | <MODULE TTCN NegSem_06010203_Ranges_011 NegSem_06010203_Ranges_011.ttcn > |
1480 | /*************************************************** |
1481 | ** @version 0.0.1 |
1482 | ** @purpose 1:6.1.2.3, Assign invalid values to range restricted float. |
1483 | ** @verdict pass reject |
1484 | ***************************************************/ |
1485 | module NegSem_06010203_Ranges_011 { |
1486 | type float MyFloatRange (-5.0 .. 0.0); |
1487 | |
1488 | type component GeneralComp {} |
1489 | |
1490 | testcase TC_NegSem_06010203_Ranges_011() runs on GeneralComp { |
1491 | var MyFloatRange v_f := 10.0; // 10.0 is outside range |
1492 | setverdict(pass); |
1493 | } |
1494 | |
1495 | control{ |
1496 | execute(TC_NegSem_06010203_Ranges_011()); |
1497 | } |
1498 | } |
1499 | <END_MODULE> |
1500 | |
1501 | <RESULT COUNT 1> |
1502 | error: 1.0e1 is not a valid value for type `float' which has subtype \(-5.0e0..0.0e0\) |
1503 | <END_RESULT> |
1504 | |
1505 | <END_TC> |
1506 | :exmp |
1507 | |
1508 | *---------------------------------------------------------------------* |
1509 | :h3. NegSem_06010203_Ranges_012 negative test |
1510 | .*---------------------------------------------------------------------* |
1511 | :xmp tab=0. |
1512 | |
1513 | <TC - Assign invalid values to range excluded restricted float. > |
1514 | |
1515 | <COMPILE> |
1516 | |
1517 | <MODULE TTCN NegSem_06010203_Ranges_012 NegSem_06010203_Ranges_012.ttcn > |
1518 | /*************************************************** |
1519 | ** @version 0.0.1 |
1520 | ** @purpose 1:6.1.2.3, Assign invalid values to range excluded restricted float. |
1521 | ** @verdict pass reject |
1522 | ***************************************************/ |
1523 | module NegSem_06010203_Ranges_012 { |
1524 | type float MyFloatRange (-1.0 .. !10.0); |
1525 | |
1526 | type component GeneralComp {} |
1527 | |
1528 | testcase TC_NegSem_06010203_Ranges_012() runs on GeneralComp { |
1529 | var MyFloatRange v_f := 10.0; // 10.0 is outside range |
1530 | setverdict(pass); |
1531 | } |
1532 | |
1533 | control{ |
1534 | execute(TC_NegSem_06010203_Ranges_012()); |
1535 | } |
1536 | } |
1537 | <END_MODULE> |
1538 | |
1539 | <RESULT COUNT 1> |
1540 | error: 1.0e1 is not a valid value for type `float' which has subtype \(-1.0e0..!1.0e1\) |
1541 | <END_RESULT> |
1542 | |
1543 | <END_TC> |
1544 | :exmp |
1545 | |
1546 | *---------------------------------------------------------------------* |
1547 | :h3. NegSem_06010203_Ranges_013 negative test |
1548 | .*---------------------------------------------------------------------* |
1549 | :xmp tab=0. |
1550 | |
1551 | <TC - Assign invalid value to range constrained universal charstring. > |
1552 | |
1553 | <COMPILE> |
1554 | |
1555 | <MODULE TTCN NegSem_06010203_Ranges_013 NegSem_06010203_Ranges_013.ttcn > |
1556 | /*************************************************** |
1557 | ** @version 0.0.1 |
1558 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained universal charstring. |
1559 | ** @verdict pass reject |
1560 | ***************************************************/ |
1561 | module NegSem_06010203_Ranges_013 { |
1562 | type universal charstring MyUCharString (char(0, 0, 1, 111) .. !char(0, 0, 1, 113)); |
1563 | |
1564 | type component GeneralComp {} |
1565 | |
1566 | testcase TC_NegSem_06010203_Ranges_013() runs on GeneralComp { |
1567 | var MyUCharString v_uc1; |
1568 | v_uc1 := char(0, 0, 1, 100); // out of range |
1569 | setverdict(pass); |
1570 | } |
1571 | |
1572 | control{ |
1573 | execute(TC_NegSem_06010203_Ranges_013()); |
1574 | } |
1575 | } |
1576 | <END_MODULE> |
1577 | |
1578 | <RESULT COUNT 1> |
1579 | error: char\(0, 0, 1, 100\) is not a valid value for type `universal charstring' which has subtype from\(char\(0, 0, 1, 111\)..char\(0, 0, 1, 112\)\) |
1580 | <END_RESULT> |
1581 | |
1582 | <END_TC> |
1583 | :exmp |
1584 | |
1585 | *---------------------------------------------------------------------* |
1586 | :h3. NegSem_06010203_Ranges_014 negative test |
1587 | .*---------------------------------------------------------------------* |
1588 | :xmp tab=0. |
1589 | |
1590 | <TC - Assign invalid value to range constrained universal charstring with mixed bounds. > |
1591 | |
1592 | <COMPILE> |
1593 | |
1594 | <MODULE TTCN NegSem_06010203_Ranges_014 NegSem_06010203_Ranges_014.ttcn > |
1595 | /*************************************************** |
1596 | ** @version 0.0.1 |
1597 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained universal charstring with mixed bounds. |
1598 | ** @verdict pass reject |
1599 | ***************************************************/ |
1600 | module NegSem_06010203_Ranges_014 { |
1601 | type universal charstring MyUCharString (char(0, 0, 1, 111) .. !char(0, 0, 1, 113)); |
1602 | |
1603 | type component GeneralComp {} |
1604 | |
1605 | testcase TC_NegSem_06010203_Ranges_014() runs on GeneralComp { |
1606 | var MyUCharString v_uc1; |
1607 | v_uc1 := char(0, 0, 1, 113); // 113 is excluded |
1608 | setverdict(pass); |
1609 | } |
1610 | |
1611 | control{ |
1612 | execute(TC_NegSem_06010203_Ranges_014()); |
1613 | } |
1614 | } |
1615 | <END_MODULE> |
1616 | |
1617 | <RESULT COUNT 1> |
1618 | error: char\(0, 0, 1, 113\) is not a valid value for type `universal charstring' which has subtype from\(char\(0, 0, 1, 111\)..char\(0, 0, 1, 112\)\) |
1619 | <END_RESULT> |
1620 | |
1621 | <END_TC> |
1622 | :exmp |
1623 | |
1624 | *---------------------------------------------------------------------* |
1625 | :h3. NegSem_06010203_Ranges_015 negative test |
1626 | .*---------------------------------------------------------------------* |
1627 | :xmp tab=0. |
1628 | |
1629 | <TC - Assign invalid value to range constrained charstring. > |
1630 | |
1631 | <COMPILE> |
1632 | |
1633 | <MODULE TTCN NegSem_06010203_Ranges_015 NegSem_06010203_Ranges_015.ttcn > |
1634 | /*************************************************** |
1635 | ** @version 0.0.1 |
1636 | ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. |
1637 | ** @verdict pass reject |
1638 | ***************************************************/ |
1639 | module NegSem_06010203_Ranges_015 { |
1640 | type charstring MyCharstringRange ("a".."f"); |
1641 | |
1642 | type component GeneralComp {} |
1643 | |
1644 | testcase TC_NegSem_06010203_Ranges_015() runs on GeneralComp { |
1645 | var MyCharstringRange v_c1; |
1646 | v_c1 := "abcgef"; // g not allowed |
1647 | setverdict(pass); |
1648 | } |
1649 | |
1650 | control{ |
1651 | execute(TC_NegSem_06010203_Ranges_015()); |
1652 | } |
1653 | } |
1654 | <END_MODULE> |
1655 | |
1656 | <RESULT COUNT 1> |
1657 | error: "abcgef" is not a valid value for type `charstring' which has subtype from\("a".."f"\) |
1658 | <END_RESULT> |
1659 | |
1660 | <END_TC> |
1661 | :exmp |
1662 | |
1663 | *---------------------------------------------------------------------* |
1664 | :h3. NegSem_06010203_Ranges_016 negative test |
1665 | .*---------------------------------------------------------------------* |
1666 | :xmp tab=0. |
1667 | |
1668 | <TC - Invalid value infinity for range constrained charstring. > |
1669 | |
1670 | <COMPILE> |
1671 | |
1672 | <MODULE TTCN NegSem_06010203_Ranges_016 NegSem_06010203_Ranges_016.ttcn > |
1673 | /*************************************************** |
1674 | ** @version 0.0.1 |
1675 | ** @purpose 1:6.1.2.3, Invalid value infinity for range constrained charstring. |
1676 | ** @verdict pass reject |
1677 | ***************************************************/ |
1678 | module NegSem_06010203_Ranges_016 { |
1679 | type charstring MyCharstringRange ("a"..infinity); // infinity not allowed for charstring |
1680 | |
1681 | type component GeneralComp {} |
1682 | |
1683 | testcase TC_NegSem_06010203_Ranges_016() runs on GeneralComp { |
1684 | var MyCharstringRange v_c1; |
1685 | v_c1 := "abcgef"; |
1686 | setverdict(pass); |
1687 | } |
1688 | |
1689 | control{ |
1690 | execute(TC_NegSem_06010203_Ranges_016()); |
1691 | } |
1692 | } |
1693 | <END_MODULE> |
1694 | |
1695 | <RESULT COUNT 1> |
1696 | error: upper boundary of a charstring subtype range cannot be infinity |
1697 | <END_RESULT> |
1698 | |
1699 | <END_TC> |
1700 | :exmp |
1701 | |
1702 | *---------------------------------------------------------------------* |
1703 | :h3. NegSem_06010203_Ranges_017 negative test |
1704 | .*---------------------------------------------------------------------* |
1705 | :xmp tab=0. |
1706 | |
1707 | <TC - Invalid value -infinity for range constrained charstring. > |
1708 | |
1709 | <COMPILE> |
1710 | |
1711 | <MODULE TTCN NegSem_06010203_Ranges_017 NegSem_06010203_Ranges_017.ttcn > |
1712 | /*************************************************** |
1713 | ** @version 0.0.1 |
1714 | ** @purpose 1:6.1.2.3, Invalid value -infinity for range constrained charstring. |
1715 | ** @verdict pass reject |
1716 | ***************************************************/ |
1717 | module NegSem_06010203_Ranges_017 { |
1718 | type charstring MyCharstringRange (-infinity.."d"); // -infinity not allowed for charstring |
1719 | |
1720 | type component GeneralComp {} |
1721 | |
1722 | testcase TC_NegSem_06010203_Ranges_017() runs on GeneralComp { |
1723 | var MyCharstringRange v_c1; |
1724 | v_c1 := "abcgef"; |
1725 | setverdict(pass); |
1726 | } |
1727 | |
1728 | control{ |
1729 | execute(TC_NegSem_06010203_Ranges_017()); |
1730 | } |
1731 | } |
1732 | <END_MODULE> |
1733 | |
1734 | <RESULT COUNT 1> |
1735 | error: lower boundary of a charstring subtype range cannot be -infinity |
1736 | <END_RESULT> |
1737 | |
1738 | <END_TC> |
1739 | :exmp |
1740 | |
1741 | *---------------------------------------------------------------------* |
1742 | :h3. NegSem_06010204_StringLengthRestrict_001 negative test |
1743 | .*---------------------------------------------------------------------* |
1744 | :xmp tab=0. |
1745 | |
1746 | <TC - Invalid value -infinity for range constrained charstring. > |
1747 | |
1748 | <COMPILE> |
1749 | |
1750 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_001 NegSem_06010204_StringLengthRestrict_001.ttcn > |
1751 | /*************************************************** |
1752 | ** @version 0.0.1 |
1753 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted bitstring. |
1754 | ** @verdict pass reject |
1755 | ***************************************************/ |
1756 | module NegSem_06010204_StringLengthRestrict_001 { |
1757 | type bitstring BitStrings length(1 .. 2); |
1758 | |
1759 | type component GeneralComp {} |
1760 | |
1761 | testcase TC_NegSem_06010204_StringLengthRestrict_001() runs on GeneralComp { |
1762 | var BitStrings v_b := '111'B; // value length 3 != type length is 1 or 2 |
1763 | setverdict(pass); |
1764 | } |
1765 | |
1766 | control{ |
1767 | execute(TC_NegSem_06010204_StringLengthRestrict_001()); |
1768 | } |
1769 | } |
1770 | <END_MODULE> |
1771 | |
1772 | <RESULT COUNT 1> |
1773 | error: '111'B is not a valid value for type `bitstring' which has subtype length\(1..2\) |
1774 | <END_RESULT> |
1775 | |
1776 | <END_TC> |
1777 | :exmp |
1778 | |
1779 | *---------------------------------------------------------------------* |
1780 | :h3. NegSem_06010204_StringLengthRestrict_002 negative test |
1781 | .*---------------------------------------------------------------------* |
1782 | :xmp tab=0. |
1783 | |
1784 | <TC - Assign invalid values to length restricted bitstring. > |
1785 | |
1786 | <COMPILE> |
1787 | |
1788 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_002 NegSem_06010204_StringLengthRestrict_002.ttcn > |
1789 | /*************************************************** |
1790 | ** @version 0.0.1 |
1791 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted bitstring. |
1792 | ** @verdict pass reject |
1793 | ***************************************************/ |
1794 | module NegSem_06010204_StringLengthRestrict_002 { |
1795 | type bitstring BitStrings length(2); |
1796 | |
1797 | type component GeneralComp {} |
1798 | |
1799 | testcase TC_NegSem_06010204_StringLengthRestrict_002() runs on GeneralComp { |
1800 | var BitStrings v_b := '111'B; // value length 3 != type length is 2 |
1801 | setverdict(pass); |
1802 | } |
1803 | |
1804 | control{ |
1805 | execute(TC_NegSem_06010204_StringLengthRestrict_002()); |
1806 | } |
1807 | } |
1808 | <END_MODULE> |
1809 | |
1810 | <RESULT COUNT 1> |
1811 | error: '111'B is not a valid value for type `bitstring' which has subtype length\(2\) |
1812 | <END_RESULT> |
1813 | |
1814 | <END_TC> |
1815 | :exmp |
1816 | |
1817 | *---------------------------------------------------------------------* |
1818 | :h3. NegSem_06010204_StringLengthRestrict_003 negative test |
1819 | .*---------------------------------------------------------------------* |
1820 | :xmp tab=0. |
1821 | |
1822 | <TC - Assign invalid values to length restricted hexstring > |
1823 | |
1824 | <COMPILE> |
1825 | |
1826 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_003 NegSem_06010204_StringLengthRestrict_003.ttcn > |
1827 | /*************************************************** |
1828 | ** @version 0.0.1 |
1829 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted hexstring |
1830 | ** @verdict pass reject |
1831 | ***************************************************/ |
1832 | module NegSem_06010204_StringLengthRestrict_003 { |
1833 | type hexstring HexStrings1 length(3); //3 hexadecimal digits |
1834 | |
1835 | type component GeneralComp {} |
1836 | |
1837 | testcase TC_NegSem_06010204_StringLengthRestrict_003() runs on GeneralComp { |
1838 | var HexStrings1 v_b1; |
1839 | v_b1 := 'FE00'H; //invalid length 4 |
1840 | setverdict(pass); |
1841 | } |
1842 | |
1843 | control{ |
1844 | execute(TC_NegSem_06010204_StringLengthRestrict_003()); |
1845 | } |
1846 | } |
1847 | <END_MODULE> |
1848 | |
1849 | <RESULT COUNT 1> |
1850 | error: 'FE00'H is not a valid value for type `hexstring' which has subtype length\(3\) |
1851 | <END_RESULT> |
1852 | |
1853 | <END_TC> |
1854 | :exmp |
1855 | |
1856 | *---------------------------------------------------------------------* |
1857 | :h3. NegSem_06010204_StringLengthRestrict_004 negative test |
1858 | .*---------------------------------------------------------------------* |
1859 | :xmp tab=0. |
1860 | |
1861 | <TC - Assign invalid values to length restricted hexstring > |
1862 | |
1863 | <COMPILE> |
1864 | |
1865 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_004 NegSem_06010204_StringLengthRestrict_004.ttcn > |
1866 | /*************************************************** |
1867 | ** @version 0.0.1 |
1868 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted hexstring |
1869 | ** @verdict pass reject |
1870 | ***************************************************/ |
1871 | module NegSem_06010204_StringLengthRestrict_004 { |
1872 | type hexstring HexStrings1 length(2 .. infinity); //hexadecimal digits between 2 and 5 |
1873 | |
1874 | type component GeneralComp {} |
1875 | |
1876 | testcase TC_NegSem_06010204_StringLengthRestrict_004() runs on GeneralComp { |
1877 | var HexStrings1 v_b1; |
1878 | v_b1 := 'A'H; //invalid length 1 |
1879 | setverdict(pass); |
1880 | } |
1881 | |
1882 | control{ |
1883 | execute(TC_NegSem_06010204_StringLengthRestrict_004()); |
1884 | } |
1885 | } |
1886 | <END_MODULE> |
1887 | |
1888 | <RESULT COUNT 1> |
1889 | error: 'A'H is not a valid value for type `hexstring' which has subtype length\(2..infinity\) |
1890 | <END_RESULT> |
1891 | |
1892 | <END_TC> |
1893 | :exmp |
1894 | |
1895 | *---------------------------------------------------------------------* |
1896 | :h3. NegSem_06010204_StringLengthRestrict_005 negative test |
1897 | .*---------------------------------------------------------------------* |
1898 | :xmp tab=0. |
1899 | |
1900 | <TC - Assign invalid values to length restricted octetstring > |
1901 | |
1902 | <COMPILE> |
1903 | |
1904 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_005 NegSem_06010204_StringLengthRestrict_005.ttcn > |
1905 | /*************************************************** |
1906 | ** @version 0.0.1 |
1907 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted octetstring |
1908 | ** @verdict pass reject |
1909 | ***************************************************/ |
1910 | module NegSem_06010204_StringLengthRestrict_005 { |
1911 | type octetstring ocStrings1 length(4); |
1912 | |
1913 | type component GeneralComp {} |
1914 | |
1915 | testcase TC_NegSem_06010204_StringLengthRestrict_005() runs on GeneralComp { |
1916 | var ocStrings1 v_b1; |
1917 | v_b1 := 'FE8001'O; //3 octets invalid length |
1918 | setverdict(pass); |
1919 | } |
1920 | |
1921 | control{ |
1922 | execute(TC_NegSem_06010204_StringLengthRestrict_005()); |
1923 | } |
1924 | } |
1925 | <END_MODULE> |
1926 | |
1927 | <RESULT COUNT 1> |
1928 | error: 'FE8001'O is not a valid value for type `octetstring' which has subtype length\(4\) |
1929 | <END_RESULT> |
1930 | |
1931 | <END_TC> |
1932 | :exmp |
1933 | |
1934 | *---------------------------------------------------------------------* |
1935 | :h3. NegSem_06010204_StringLengthRestrict_006 negative test |
1936 | .*---------------------------------------------------------------------* |
1937 | :xmp tab=0. |
1938 | |
1939 | <TC - Assign invalid values to length restricted octetstring > |
1940 | |
1941 | <COMPILE> |
1942 | |
1943 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_006 NegSem_06010204_StringLengthRestrict_006.ttcn > |
1944 | /*************************************************** |
1945 | ** @version 0.0.1 |
1946 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted octetstring |
1947 | ** @verdict pass reject |
1948 | ***************************************************/ |
1949 | module NegSem_06010204_StringLengthRestrict_006 { |
1950 | type octetstring ocStrings1 length(2..infinity); |
1951 | |
1952 | type component GeneralComp {} |
1953 | |
1954 | testcase TC_NegSem_06010204_StringLengthRestrict_006() runs on GeneralComp { |
1955 | var ocStrings1 v_b1; |
1956 | v_b1 := 'FE'O; //1 octet invalid length |
1957 | setverdict(pass); |
1958 | } |
1959 | |
1960 | control{ |
1961 | execute(TC_NegSem_06010204_StringLengthRestrict_006()); |
1962 | } |
1963 | } |
1964 | <END_MODULE> |
1965 | |
1966 | <RESULT COUNT 1> |
1967 | error: 'FE'O is not a valid value for type `octetstring' which has subtype length\(2..infinity\) |
1968 | <END_RESULT> |
1969 | |
1970 | <END_TC> |
1971 | :exmp |
1972 | |
1973 | *---------------------------------------------------------------------* |
1974 | :h3. NegSem_06010204_StringLengthRestrict_007 negative test |
1975 | .*---------------------------------------------------------------------* |
1976 | :xmp tab=0. |
1977 | |
1978 | <TC - Assign invalid values to length restricted charstring > |
1979 | |
1980 | <COMPILE> |
1981 | |
1982 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_007 NegSem_06010204_StringLengthRestrict_007.ttcn > |
1983 | /*************************************************** |
1984 | ** @version 0.0.1 |
1985 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted charstring |
1986 | ** @verdict pass reject |
1987 | ***************************************************/ |
1988 | module NegSem_06010204_StringLengthRestrict_007{ |
1989 | type charstring myStrings1 length(2..infinity); |
1990 | |
1991 | type component GeneralComp {} |
1992 | |
1993 | testcase TC_NegSem_06010204_StringLengthRestrict_007() runs on GeneralComp { |
1994 | var myStrings1 v_b1; |
1995 | v_b1 := "a"; //1 charc. length |
1996 | setverdict(pass); |
1997 | } |
1998 | |
1999 | control{ |
2000 | execute(TC_NegSem_06010204_StringLengthRestrict_007()); |
2001 | } |
2002 | } |
2003 | <END_MODULE> |
2004 | |
2005 | <RESULT COUNT 1> |
2006 | error: "a" is not a valid value for type `charstring' which has subtype length\(2..infinity\) |
2007 | <END_RESULT> |
2008 | |
2009 | <END_TC> |
2010 | :exmp |
2011 | |
2012 | *---------------------------------------------------------------------* |
2013 | :h3. NegSem_06010204_StringLengthRestrict_008 negative test |
2014 | .*---------------------------------------------------------------------* |
2015 | :xmp tab=0. |
2016 | |
2017 | <TC - Assign invalid values to length restricted charstring > |
2018 | |
2019 | <COMPILE> |
2020 | |
2021 | <MODULE TTCN NegSem_06010204_StringLengthRestrict_008 NegSem_06010204_StringLengthRestrict_008.ttcn > |
2022 | /*************************************************** |
2023 | ** @version 0.0.1 |
2024 | ** @purpose 1:6.1.2.4, Assign invalid values to length restricted charstring |
2025 | ** @verdict pass reject |
2026 | ***************************************************/ |
2027 | module NegSem_06010204_StringLengthRestrict_008{ |
2028 | type charstring myStrings1 length(2); |
2029 | |
2030 | type component GeneralComp {} |
2031 | |
2032 | testcase TC_NegSem_06010204_StringLengthRestrict_008() runs on GeneralComp { |
2033 | var myStrings1 v_b1; |
2034 | v_b1 := "abc"; //2 characters length req. |
2035 | setverdict(pass); |
2036 | } |
2037 | |
2038 | control{ |
2039 | execute(TC_NegSem_06010204_StringLengthRestrict_008()); |
2040 | } |
2041 | } |
2042 | <END_MODULE> |
2043 | |
2044 | <RESULT COUNT 1> |
2045 | error: "abc" is not a valid value for type `charstring' which has subtype length\(2\) |
2046 | <END_RESULT> |
2047 | |
2048 | <END_TC> |
2049 | :exmp |
2050 | |
2051 | *---------------------------------------------------------------------* |
2052 | :h3. NegSyn_06010204_StringLengthRestrict_001 negative test |
2053 | .*---------------------------------------------------------------------* |
2054 | :xmp tab=0. |
2055 | |
2056 | <TC - upper boundary should be greater than lower boundary in string length restictions > |
2057 | |
2058 | <COMPILE> |
2059 | |
2060 | <MODULE TTCN NegSyn_06010204_StringLengthRestrict_001 NegSyn_06010204_StringLengthRestrict_001.ttcn > |
2061 | /*************************************************** |
2062 | ** @version 0.0.1 |
2063 | ** @purpose 1:6.1.2.4, upper boundary should be greater than lower boundary in string length restictions |
2064 | ** @verdict pass reject |
2065 | ***************************************************/ |
2066 | module NegSyn_06010204_StringLengthRestrict_001 { |
2067 | type hexstring HexStrings1 length(3 .. 1); // upper bound is smaller than lower bound |
2068 | |
2069 | } |
2070 | <END_MODULE> |
2071 | |
2072 | <RESULT COUNT 1> |
2073 | error: The upper boundary of the length restriction \(1\) cannot be smaller than the lower boundary \(3\) |
2074 | <END_RESULT> |
2075 | |
2076 | <END_TC> |
2077 | :exmp |
2078 | |
2079 | *---------------------------------------------------------------------* |
2080 | :h3. NegSyn_06010204_StringLengthRestrict_002 negative test |
2081 | .*---------------------------------------------------------------------* |
2082 | :xmp tab=0. |
2083 | |
2084 | <TC - boundary integers should be non negative integers > |
2085 | |
2086 | <COMPILE> |
2087 | |
2088 | <MODULE TTCN NegSyn_06010204_StringLengthRestrict_002 NegSyn_06010204_StringLengthRestrict_002.ttcn > |
2089 | /*************************************************** |
2090 | ** @version 0.0.1 |
2091 | ** @purpose 1:6.1.2.4, boundary integers should be non negative integers |
2092 | ** @verdict pass reject |
2093 | ***************************************************/ |
2094 | module NegSyn_06010204_StringLengthRestrict_002 { |
2095 | type hexstring HexStrings1 length(0 .. -5); // negative boundary for length |
2096 | |
2097 | } |
2098 | <END_MODULE> |
2099 | |
2100 | <RESULT COUNT 1> |
2101 | error: The upper boundary of the length restriction must be a non-negative integer value instead of -5 |
2102 | <END_RESULT> |
2103 | |
2104 | <END_TC> |
2105 | :exmp |
2106 | |
2107 | *---------------------------------------------------------------------* |
2108 | :h3. NegSem_06010205_StringPattern_001 negative test |
2109 | .*---------------------------------------------------------------------* |
2110 | :xmp tab=0. |
2111 | |
2112 | <TC - Assign invalid values to pattern restricted character strings. > |
2113 | |
2114 | <COMPILE> |
2115 | |
2116 | <MODULE TTCN NegSem_06010205_StringPattern_001 NegSem_06010205_StringPattern_001.ttcn > |
2117 | /*************************************************** |
2118 | ** @version 0.0.1 |
2119 | ** @purpose 1:6.1.2.5, Assign invalid values to pattern restricted character strings. |
2120 | ** @verdict pass reject |
2121 | ***************************************************/ |
2122 | module NegSem_06010205_StringPattern_001 { |
2123 | type charstring MyString (pattern "?bc*xyz"); |
2124 | |
2125 | type component GeneralComp {} |
2126 | |
2127 | testcase TC_NegSem_06010205_StringPattern_001() runs on GeneralComp { |
2128 | var MyString v_c := "abcyz"; // value missing x |
2129 | setverdict(pass); |
2130 | } |
2131 | |
2132 | control{ |
2133 | execute(TC_NegSem_06010205_StringPattern_001()); |
2134 | } |
2135 | } |
2136 | <END_MODULE> |
2137 | |
2138 | <RESULT COUNT 1> |
2139 | error: "abcyz" is not a valid value for type `charstring' which has subtype pattern\(\?bc\*xyz\) |
2140 | <END_RESULT> |
2141 | |
2142 | <END_TC> |
2143 | :exmp |
2144 | |
2145 | *---------------------------------------------------------------------* |
2146 | :h3. NegSyn_06010205_StringPattern_002 negative test |
2147 | .*---------------------------------------------------------------------* |
2148 | :xmp tab=0. |
2149 | |
2150 | <TC - Assign quadruple values to pattern restricted character strings. > |
2151 | |
2152 | <COMPILE> |
2153 | |
2154 | <MODULE TTCN NegSyn_06010205_StringPattern_002 NegSyn_06010205_StringPattern_002.ttcn > |
2155 | /*************************************************** |
2156 | ** @version 0.0.1 |
2157 | ** @purpose 1:6.1.2.5, Assign quadruple values to pattern restricted character strings. |
2158 | ** @verdict pass reject, noexecution |
2159 | ***************************************************/ |
2160 | |
2161 | module NegSyn_06010205_StringPattern_002 { |
2162 | type charstring MyString (pattern "\q{0,0,1,116}abc"); //error: not a legal character for the TTCN 3 charstring type |
2163 | |
2164 | |
2165 | type component GeneralComp {} |
2166 | |
2167 | testcase TC_NegSyn_06010205_StringPattern_002() runs on GeneralComp { |
2168 | var MyString v_c := "Å´abc"; //error: not a legal character of the TTCN 3 charstring type |
2169 | } |
2170 | |
2171 | control{ |
2172 | execute(TC_NegSyn_06010205_StringPattern_002()); |
2173 | } |
2174 | } |
2175 | <END_MODULE> |
2176 | |
2177 | <RESULT COUNT 1> |
2178 | error: char\(0, 0, 0, 197\) & char\(0, 0, 0, 180\) \& "abc" is not a valid value for type `charstring' which has subtype pattern\(\\q\{0,0,1,116\}abc\) |
2179 | <END_RESULT> |
2180 | |
2181 | <END_TC> |
2182 | :exmp |
2183 | |
2184 | *---------------------------------------------------------------------* |
2185 | :h3. NegSem_0601020601_MixingSubtype_001 negative test |
2186 | .*---------------------------------------------------------------------* |
2187 | :xmp tab=0. |
2188 | |
2189 | <TC - Assign invalid values to mixed restricted floats. > |
2190 | |
2191 | <COMPILE> |
2192 | |
2193 | <MODULE TTCN NegSem_0601020601_MixingSubtype_001 NegSem_0601020601_MixingSubtype_001.ttcn > |
2194 | /*************************************************** |
2195 | ** @version 0.0.1 |
2196 | ** @purpose 1:6.1.2.6.1, Assign invalid values to mixed restricted floats. |
2197 | ** @verdict pass reject |
2198 | ***************************************************/ |
2199 | module NegSem_0601020601_MixingSubtype_001 { |
2200 | type float lessThanPiAndNaN (-infinity .. 3142E-3, not_a_number); |
2201 | |
2202 | type component GeneralComp {} |
2203 | |
2204 | testcase TC_NegSem_0601020601_MixingSubtype_001() runs on GeneralComp { |
2205 | var lessThanPiAndNaN v_f := 4.0; // value out of range |
2206 | setverdict(pass); |
2207 | } |
2208 | |
2209 | control{ |
2210 | execute(TC_NegSem_0601020601_MixingSubtype_001()); |
2211 | } |
2212 | } |
2213 | <END_MODULE> |
2214 | |
2215 | <RESULT COUNT 1> |
2216 | error: 4.0e0 is not a valid value for type `float' which has subtype \(-INF..3.142e0,NaN\) |
2217 | <END_RESULT> |
2218 | |
2219 | <END_TC> |
2220 | :exmp |
2221 | |
2222 | *---------------------------------------------------------------------* |
2223 | :h3. NegSem_0601020601_MixingSubtype_002 negative test |
2224 | .*---------------------------------------------------------------------* |
2225 | :xmp tab=0. |
2226 | |
2227 | <TC - Assign invalid values to mixed restricted integers. > |
2228 | |
2229 | <COMPILE> |
2230 | |
2231 | <MODULE TTCN NegSem_0601020601_MixingSubtype_002 NegSem_0601020601_MixingSubtype_002.ttcn > |
2232 | /*************************************************** |
2233 | ** @version 0.0.1 |
2234 | ** @purpose 1:6.1.2.6.1, Assign invalid values to mixed restricted integers. |
2235 | ** @verdict pass reject |
2236 | ***************************************************/ |
2237 | module NegSem_0601020601_MixingSubtype_002 { |
2238 | type integer MyInt (1, 5, 10, 100 .. infinity); |
2239 | |
2240 | type component GeneralComp {} |
2241 | |
2242 | testcase TC_NegSem_0601020601_MixingSubtype_002() runs on GeneralComp { |
2243 | var MyInt v_i := 6; // value out of range |
2244 | setverdict(pass); |
2245 | } |
2246 | |
2247 | control{ |
2248 | execute(TC_NegSem_0601020601_MixingSubtype_002()); |
2249 | } |
2250 | } |
2251 | <END_MODULE> |
2252 | |
2253 | <RESULT COUNT 1> |
2254 | error: 6 is not a valid value for type `integer' which has subtype \(1,5,10,100..infinity\) |
2255 | <END_RESULT> |
2256 | |
2257 | <END_TC> |
2258 | :exmp |
2259 | |
2260 | *---------------------------------------------------------------------* |
2261 | :h3. NegSem_0601020602_StringMixing_001 negative test |
2262 | .*---------------------------------------------------------------------* |
2263 | :xmp tab=0. |
2264 | |
2265 | <TC - Assign invalid values to mixed restricted character strings. > |
2266 | |
2267 | <COMPILE> |
2268 | |
2269 | <MODULE TTCN NegSem_0601020602_StringMixing_001 NegSem_0601020602_StringMixing_001.ttcn > |
2270 | /*************************************************** |
2271 | ** @version 0.0.1 |
2272 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. |
2273 | ** @verdict pass reject |
2274 | ***************************************************/ |
2275 | module NegSem_0601020602_StringMixing_001 { |
2276 | type charstring MyString (pattern "?bc*xyz") length (5 .. 8); |
2277 | |
2278 | type component GeneralComp {} |
2279 | |
2280 | testcase TC_NegSem_0601020602_StringMixing_001() runs on GeneralComp { |
2281 | var MyString v_c := "abcyz"; // value missing x |
2282 | setverdict(pass); |
2283 | } |
2284 | |
2285 | control{ |
2286 | execute(TC_NegSem_0601020602_StringMixing_001()); |
2287 | } |
2288 | } |
2289 | <END_MODULE> |
2290 | |
2291 | <RESULT COUNT 1> |
2292 | error: "abcyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) |
2293 | <END_RESULT> |
2294 | |
2295 | <END_TC> |
2296 | :exmp |
2297 | |
2298 | *---------------------------------------------------------------------* |
2299 | :h3. NegSem_0601020602_StringMixing_002 negative test |
2300 | .*---------------------------------------------------------------------* |
2301 | :xmp tab=0. |
2302 | |
2303 | <TC - Assign invalid values to mixed restricted character strings. > |
2304 | |
2305 | <COMPILE> |
2306 | |
2307 | <MODULE TTCN NegSem_0601020602_StringMixing_002 NegSem_0601020602_StringMixing_002.ttcn > |
2308 | /*************************************************** |
2309 | ** @version 0.0.1 |
2310 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. |
2311 | ** @verdict pass reject |
2312 | ***************************************************/ |
2313 | module NegSem_0601020602_StringMixing_002 { |
2314 | type charstring MyString (pattern "?bc*xyz") length (5 .. 8); |
2315 | |
2316 | type component GeneralComp {} |
2317 | |
2318 | testcase TC_NegSem_0601020602_StringMixing_002() runs on GeneralComp { |
2319 | var MyString v_c := "abc123xyz"; // value length 9 exceeds 8 |
2320 | setverdict(pass); |
2321 | } |
2322 | |
2323 | control{ |
2324 | execute(TC_NegSem_0601020602_StringMixing_002()); |
2325 | } |
2326 | } |
2327 | <END_MODULE> |
2328 | |
2329 | <RESULT COUNT 1> |
2330 | error: "abc123xyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) |
2331 | <END_RESULT> |
2332 | |
2333 | <END_TC> |
2334 | :exmp |
2335 | |
2336 | *---------------------------------------------------------------------* |
2337 | :h3. NegSem_0601020602_StringMixing_003 negative test |
2338 | .*---------------------------------------------------------------------* |
2339 | :xmp tab=0. |
2340 | |
2341 | <TC - Assign invalid values to mixed restricted character strings. > |
2342 | |
2343 | <COMPILE> |
2344 | |
2345 | <MODULE TTCN NegSem_0601020602_StringMixing_003 NegSem_0601020602_StringMixing_003.ttcn > |
2346 | /*************************************************** |
2347 | ** @version 0.0.1 |
2348 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. |
2349 | ** @verdict pass reject |
2350 | ***************************************************/ |
2351 | module NegSem_0601020602_StringMixing_003 { |
2352 | type charstring MyString ("a".."z") length (3 .. 8); |
2353 | |
2354 | type component GeneralComp {} |
2355 | |
2356 | testcase TC_NegSem_0601020602_StringMixing_003() runs on GeneralComp { |
2357 | var MyString v_c := "abc1xyz"; // char 1 not allowed |
2358 | setverdict(pass); |
2359 | } |
2360 | |
2361 | control{ |
2362 | execute(TC_NegSem_0601020602_StringMixing_003()); |
2363 | } |
2364 | } |
2365 | <END_MODULE> |
2366 | |
2367 | <RESULT COUNT 1> |
2368 | error: "abc1xyz" is not a valid value for type `charstring' which has subtype \(from\("a".."z"\) intersection length\(3..8\)\) |
2369 | <END_RESULT> |
2370 | |
2371 | <END_TC> |
2372 | :exmp |
2373 | |
2374 | *---------------------------------------------------------------------* |
2375 | :h3. NegSem_0601020602_StringMixing_004 negative test |
2376 | .*---------------------------------------------------------------------* |
2377 | :xmp tab=0. |
2378 | |
2379 | <TC - Assign invalid values to mixed restricted bit strings. > |
2380 | |
2381 | <COMPILE> |
2382 | |
2383 | <MODULE TTCN NegSem_0601020602_StringMixing_004 NegSem_0601020602_StringMixing_004.ttcn > |
2384 | /*************************************************** |
2385 | ** @version 0.0.1 |
2386 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted bit strings. |
2387 | ** @verdict pass reject |
2388 | ***************************************************/ |
2389 | module NegSem_0601020602_StringMixing_004 { |
2390 | type bitstring MyString ('111'B, '101010'B, '111111'B) length (4 .. 8); |
2391 | |
2392 | type component GeneralComp {} |
2393 | |
2394 | testcase TC_NegSem_0601020602_StringMixing_004() runs on GeneralComp { |
2395 | var MyString v_c := '111'B; // value lenght 3 not allowed |
2396 | setverdict(pass); |
2397 | } |
2398 | |
2399 | control{ |
2400 | execute(TC_NegSem_0601020602_StringMixing_004()); |
2401 | } |
2402 | } |
2403 | <END_MODULE> |
2404 | |
2405 | <RESULT COUNT 1> |
2406 | error: '111'B is not a valid value for type `bitstring' which has subtype \('101010'B,'111111'B\) |
2407 | <END_RESULT> |
2408 | |
2409 | <END_TC> |
2410 | :exmp |
2411 | |
2412 | *---------------------------------------------------------------------* |
2413 | :h3. NegSem_0601020602_StringMixing_005 negative test |
2414 | .*---------------------------------------------------------------------* |
2415 | :xmp tab=0. |
2416 | |
2417 | <TC - Assign invalid values to mixed restricted hex strings. > |
2418 | |
2419 | <COMPILE> |
2420 | |
2421 | <MODULE TTCN NegSem_0601020602_StringMixing_005 NegSem_0601020602_StringMixing_005.ttcn > |
2422 | /*************************************************** |
2423 | ** @version 0.0.1 |
2424 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted hex strings. |
2425 | ** @verdict pass reject |
2426 | ***************************************************/ |
2427 | module NegSem_0601020602_StringMixing_005 { |
2428 | type hexstring MyString ('1F1'H, '103A10'H, '111111'H) length (4 .. 8); |
2429 | |
2430 | type component GeneralComp {} |
2431 | |
2432 | testcase TC_NegSem_0601020602_StringMixing_005() runs on GeneralComp { |
2433 | var MyString v_c := '1F1'H; // value length 3 not allowed |
2434 | setverdict(pass); |
2435 | } |
2436 | |
2437 | control{ |
2438 | execute(TC_NegSem_0601020602_StringMixing_005()); |
2439 | } |
2440 | } |
2441 | <END_MODULE> |
2442 | |
2443 | <RESULT COUNT 1> |
2444 | error: '1F1'H is not a valid value for type `hexstring' which has subtype \('103A10'H,'111111'H\) |
2445 | <END_RESULT> |
2446 | |
2447 | <END_TC> |
2448 | :exmp |
2449 | |
2450 | *---------------------------------------------------------------------* |
2451 | :h3. NegSem_0601020602_StringMixing_006 negative test |
2452 | .*---------------------------------------------------------------------* |
2453 | :xmp tab=0. |
2454 | |
2455 | <TC -Assign invalid values to mixed restricted octet strings. > |
2456 | |
2457 | <COMPILE> |
2458 | |
2459 | <MODULE TTCN NegSem_0601020602_StringMixing_006 NegSem_0601020602_StringMixing_006.ttcn > |
2460 | /*************************************************** |
2461 | ** @version 0.0.1 |
2462 | ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted octet strings. |
2463 | ** @verdict pass reject |
2464 | ***************************************************/ |
2465 | module NegSem_0601020602_StringMixing_006 { |
2466 | type octetstring MyString ('FF1111'O, '101010A3'O, 'FFFFFFFFFF'O) length (4); |
2467 | |
2468 | type component GeneralComp {} |
2469 | |
2470 | testcase TC_NegSem_0601020602_StringMixing_006() runs on GeneralComp { |
2471 | var MyString v_c := 'FF1111'O; // value length 3 not allowed |
2472 | setverdict(pass); |
2473 | } |
2474 | |
2475 | control{ |
2476 | execute(TC_NegSem_0601020602_StringMixing_006()); |
2477 | } |
2478 | } |
2479 | <END_MODULE> |
2480 | |
2481 | <RESULT COUNT 1> |
2482 | error: 'FF1111'O is not a valid value for type `octetstring' which has subtype \('101010A3'O\) |
2483 | <END_RESULT> |
2484 | |
2485 | <END_TC> |
2486 | :exmp |
2487 | |
2488 | *---------------------------------------------------------------------* |
2489 | :h2. 0602_structured_types_and_values folder |
2490 | .*---------------------------------------------------------------------* |
2491 | |
2492 | *---------------------------------------------------------------------* |
2493 | :h3. NegSem_0602_TopLevel_001 negative test |
2494 | .*---------------------------------------------------------------------* |
2495 | :xmp tab=0. |
2496 | |
2497 | <TC - Ensure that value list notation can not be used for a union type. > |
2498 | |
2499 | <COMPILE> |
2500 | |
2501 | <MODULE TTCN NegSem_0602_TopLevel_001 NegSem_0602_TopLevel_001.ttcn > |
2502 | /*************************************************** |
2503 | ** @version 0.0.1 |
2504 | ** @purpose 1:6.2, Ensure that value list notation can not be used for a union type. |
2505 | ** @verdict pass reject |
2506 | ***************************************************/ |
2507 | module NegSem_0602_TopLevel_001 { |
2508 | |
2509 | type component GeneralComp { |
2510 | } |
2511 | |
2512 | type union MyUnion { |
2513 | integer field1, |
2514 | charstring field2, |
2515 | float field3 |
2516 | } |
2517 | |
2518 | testcase TC_NegSem_0602_TopLevel_001() runs on GeneralComp { |
2519 | |
2520 | var MyUnion v_myUnion := {5}; //value list notation can not be used for a union type |
2521 | |
2522 | } |
2523 | |
2524 | control { |
2525 | execute(TC_NegSem_0602_TopLevel_001()); |
2526 | } |
2527 | } |
2528 | <END_MODULE> |
2529 | |
2530 | <RESULT COUNT 1> |
2531 | error: union value was expected for type `@NegSem_0602_TopLevel_001.MyUnion' |
2532 | <END_RESULT> |
2533 | |
2534 | <END_TC> |
2535 | :exmp |
2536 | |
2537 | *---------------------------------------------------------------------* |
2538 | :h3. NegSem_0602_TopLevel_002 negative test |
2539 | .*---------------------------------------------------------------------* |
2540 | :xmp tab=0. |
2541 | |
2542 | <TC - Ensure that indexed notation can not be used for a record type. > |
2543 | |
2544 | <COMPILE> |
2545 | |
2546 | <MODULE TTCN NegSem_0602_TopLevel_002 NegSem_0602_TopLevel_002.ttcn > |
2547 | /*************************************************** |
2548 | ** @version 0.0.1 |
2549 | ** @purpose 1:6.2, Ensure that indexed notation can not be used for a record type. |
2550 | ** @verdict pass reject |
2551 | ***************************************************/ |
2552 | module NegSem_0602_TopLevel_002 { |
2553 | |
2554 | type component GeneralComp { |
2555 | } |
2556 | |
2557 | type record MyRecord { |
2558 | integer field1, |
2559 | charstring field2, |
2560 | float field3 |
2561 | } |
2562 | |
2563 | testcase TC_NegSem_0602_TopLevel_002() runs on GeneralComp { |
2564 | |
2565 | var MyRecord v_myRecord := { |
2566 | field1 := 5, |
2567 | field2 := "hi", |
2568 | field3 := 3.14 |
2569 | }; |
2570 | |
2571 | var integer Integer1 :=3; |
2572 | v_myRecord[0] := Integer1;//not possible to use index notation on a record type |
2573 | |
2574 | } |
2575 | |
2576 | control { |
2577 | execute(TC_NegSem_0602_TopLevel_002()); |
2578 | } |
2579 | } |
2580 | <END_MODULE> |
2581 | |
2582 | <RESULT COUNT 1> |
2583 | error: Type `@NegSem_0602_TopLevel_002.MyRecord' cannot be indexed |
2584 | <END_RESULT> |
2585 | |
2586 | <END_TC> |
2587 | :exmp |
2588 | |
2589 | *---------------------------------------------------------------------* |
2590 | :h3. NegSem_0602_TopLevel_003 negative test |
2591 | .*---------------------------------------------------------------------* |
2592 | :xmp tab=0. |
2593 | |
2594 | <TC - Ensure that indexed notation can not be used for a set type. > |
2595 | |
2596 | <COMPILE> |
2597 | |
2598 | <MODULE TTCN NegSem_0602_TopLevel_003 NegSem_0602_TopLevel_003.ttcn > |
2599 | /*************************************************** |
2600 | ** @version 0.0.1 |
2601 | ** @purpose 1:6.2, Ensure that indexed notation can not be used for a set type. |
2602 | ** @verdict pass reject |
2603 | ***************************************************/ |
2604 | module NegSem_0602_TopLevel_003 { |
2605 | |
2606 | type component GeneralComp { |
2607 | } |
2608 | |
2609 | type set MySet { |
2610 | integer field1, |
2611 | charstring field2, |
2612 | float field3 |
2613 | } |
2614 | |
2615 | testcase TC_NegSem_0602_TopLevel_003() runs on GeneralComp { |
2616 | |
2617 | var MySet v_mySet := { |
2618 | field1 := 5, |
2619 | field2 := "hi", |
2620 | field3 := 3.14 |
2621 | }; |
2622 | |
2623 | var integer Integer1 :=3; |
2624 | v_mySet[0] := Integer1;//not possible to use index notation on a set type |
2625 | |
2626 | } |
2627 | |
2628 | control { |
2629 | execute(TC_NegSem_0602_TopLevel_003()); |
2630 | } |
2631 | } |
2632 | <END_MODULE> |
2633 | |
2634 | <RESULT COUNT 1> |
2635 | error: Type `@NegSem_0602_TopLevel_003.MySet' cannot be indexed |
2636 | <END_RESULT> |
2637 | |
2638 | <END_TC> |
2639 | :exmp |
2640 | |
2641 | *---------------------------------------------------------------------* |
2642 | :h3. NegSem_0602_TopLevel_004 negative test |
2643 | .*---------------------------------------------------------------------* |
2644 | :xmp tab=0. |
2645 | |
2646 | <TC - Ensure that indexed notation can not be used for a union type. > |
2647 | |
2648 | <COMPILE> |
2649 | |
2650 | <MODULE TTCN NegSem_0602_TopLevel_004 NegSem_0602_TopLevel_004.ttcn > |
2651 | /*************************************************** |
2652 | ** @version 0.0.1 |
2653 | ** @purpose 1:6.2, Ensure that indexed notation can not be used for a union type. |
2654 | ** @verdict pass reject |
2655 | ***************************************************/ |
2656 | module NegSem_0602_TopLevel_004 { |
2657 | |
2658 | type component GeneralComp { |
2659 | } |
2660 | |
2661 | type union MyUnion { |
2662 | integer field1, |
2663 | charstring field2, |
2664 | float field3 |
2665 | } |
2666 | |
2667 | testcase TC_NegSem_0602_TopLevel_004() runs on GeneralComp { |
2668 | |
2669 | var MyUnion v_myUnion := { |
2670 | field1 := 5 |
2671 | }; |
2672 | |
2673 | var integer Integer1 :=3; |
2674 | v_myUnion[0] := Integer1;//not possible to use index notation on a union type |
2675 | |
2676 | } |
2677 | |
2678 | control { |
2679 | execute(TC_NegSem_0602_TopLevel_004()); |
2680 | } |
2681 | } |
2682 | <END_MODULE> |
2683 | |
2684 | <RESULT COUNT 1> |
2685 | error: Type `@NegSem_0602_TopLevel_004.MyUnion' cannot be indexed |
2686 | <END_RESULT> |
2687 | |
2688 | <END_TC> |
2689 | :exmp |
2690 | |
2691 | *---------------------------------------------------------------------* |
2692 | :h3. NegSyn_0602_TopLevel_001 negative test |
2693 | .*---------------------------------------------------------------------* |
2694 | :xmp tab=0. |
2695 | |
2696 | <TC - Invalid recursive union type definition causing an error > |
2697 | |
2698 | <COMPILE> |
2699 | |
2700 | <MODULE TTCN NegSyn_0602_TopLevel_001 NegSyn_0602_TopLevel_001.ttcn > |
2701 | /*************************************************** |
2702 | ** @version 0.0.1 |
2703 | ** @purpose 1:6.2, Invalid recursive union type definition causing an error |
2704 | ** @verdict pass reject |
2705 | ***************************************************/ |
2706 | module NegSyn_0602_TopLevel_001 { |
2707 | // In case of union types, to avoid infinite recursion, at least one of the alternatives shall not reference its own type. |
2708 | type union MyUnion { |
2709 | MyUnion choice1, |
2710 | MyUnion choice2 |
2711 | } |
2712 | } |
2713 | <END_MODULE> |
2714 | |
2715 | <RESULT COUNT 1> |
2716 | error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice1' -> `@NegSyn_0602_TopLevel_001.MyUnion' |
2717 | <END_RESULT> |
2718 | <RESULT COUNT 1> |
2719 | error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice2' -> `@NegSyn_0602_TopLevel_001.MyUnion' |
2720 | <END_RESULT> |
2721 | |
2722 | <END_TC> |
2723 | :exmp |
2724 | |
2725 | *---------------------------------------------------------------------* |
2726 | :h3. NegSyn_0602_TopLevel_002 negative test |
2727 | .*---------------------------------------------------------------------* |
2728 | :xmp tab=0. |
2729 | |
2730 | <TC - Invalid recursive record type definition causing an error > |
2731 | |
2732 | <COMPILE> |
2733 | |
2734 | <MODULE TTCN NegSyn_0602_TopLevel_002 NegSyn_0602_TopLevel_002.ttcn > |
2735 | /*************************************************** |
2736 | ** @version 0.0.1 |
2737 | ** @purpose 1:6.2, Invalid recursive record type definition causing an error |
2738 | ** @verdict pass reject |
2739 | ***************************************************/ |
2740 | module NegSyn_0602_TopLevel_002 { |
2741 | // In case of record and set types, to avoid infinite recursion, fields referencing to its own type, shall be optional. |
2742 | type record MyRecord { |
2743 | integer field1, |
2744 | MyRecord field2, |
2745 | integer field3 |
2746 | } |
2747 | } |
2748 | <END_MODULE> |
2749 | |
2750 | <RESULT COUNT 1> |
2751 | error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_002.MyRecord' -> `@NegSyn_0602_TopLevel_002.MyRecord.field2' -> `@NegSyn_0602_TopLevel_002.MyRecord' |
2752 | <END_RESULT> |
2753 | |
2754 | <END_TC> |
2755 | :exmp |
2756 | |
2757 | *---------------------------------------------------------------------* |
2758 | :h3. NegSyn_0602_TopLevel_003 negative test |
2759 | .*---------------------------------------------------------------------* |
2760 | :xmp tab=0. |
2761 | |
2762 | <TC - Combined value list and assignment notation not allowed in the same (immediate) context. > |
2763 | |
2764 | <COMPILE> |
2765 | |
2766 | <MODULE TTCN NegSyn_0602_TopLevel_003 NegSyn_0602_TopLevel_003.ttcn > |
2767 | /*************************************************** |
2768 | ** @version 0.0.1 |
2769 | ** @purpose 1:6.2, Combined value list and assignment notation not allowed in the same (immediate) context. |
2770 | ** @verdict pass reject |
2771 | ***************************************************/ |
2772 | module NegSyn_0602_TopLevel_003 { |
2773 | type record MyRecord { |
2774 | integer field1, |
2775 | charstring field2 optional, |
2776 | float field3 |
2777 | } |
2778 | const MyRecord c_rec := { |
2779 | field1 := 5, |
2780 | "hi", // combined value list and assignment notation not allowed in the same (immediate) context. |
2781 | field3 := 3.14 |
2782 | }; |
2783 | } |
2784 | <END_MODULE> |
2785 | |
2786 | <RESULT COUNT 1> |
2787 | error: at or before token `"': syntax error, unexpected Cstring |
2788 | <END_RESULT> |
2789 | |
2790 | <END_TC> |
2791 | :exmp |
2792 | |
2793 | *---------------------------------------------------------------------* |
2794 | :h3. NegSyn_060201_RecordTypeValues_001 negative test |
2795 | .*---------------------------------------------------------------------* |
2796 | :xmp tab=0. |
2797 | |
2798 | <TC - The omit keyword shall not be used for mandatory fields. > |
2799 | |
2800 | <COMPILE> |
2801 | |
2802 | <MODULE TTCN NegSyn_060201_RecordTypeValues_001 NegSyn_060201_RecordTypeValues_001.ttcn > |
2803 | /*************************************************** |
2804 | ** @author STF 409, re-numbering done by STF470 |
2805 | ** @version 0.0.1 |
2806 | ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. |
2807 | ** @verdict pass reject |
2808 | ***************************************************/ |
2809 | module NegSyn_060201_RecordTypeValues_001 { |
2810 | type record MyRecord { |
2811 | integer field1, |
2812 | MyRecord field2 optional, |
2813 | integer field3 |
2814 | } |
2815 | const MyRecord c_rec := { |
2816 | field1 := 5, |
2817 | field2 := omit, |
2818 | field3 := omit // not optional |
2819 | }; |
2820 | } |
2821 | <END_MODULE> |
2822 | |
2823 | <RESULT COUNT 1> |
2824 | error: `omit' value is not allowed in this context |
2825 | <END_RESULT> |
2826 | |
2827 | <END_TC> |
2828 | :exmp |
2829 | |
2830 | *---------------------------------------------------------------------* |
2831 | :h3. NegSyn_060201_RecordTypeValues_002 negative test |
2832 | .*---------------------------------------------------------------------* |
2833 | :xmp tab=0. |
2834 | |
2835 | <TC - The omit keyword shall not be used for mandatory fields. > |
2836 | |
2837 | <COMPILE> |
2838 | |
2839 | <MODULE TTCN NegSyn_060201_RecordTypeValues_002 NegSyn_060201_RecordTypeValues_002.ttcn > |
2840 | /*************************************************** |
2841 | ** @author STF 409, re-numbering done by STF470 |
2842 | ** @version 0.0.1 |
2843 | ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. |
2844 | ** @verdict pass reject |
2845 | ***************************************************/ |
2846 | module NegSyn_060201_RecordTypeValues_002 { |
2847 | type record MyRecord { |
2848 | integer field1, |
2849 | MyRecord field2 optional, |
2850 | integer field3 |
2851 | } |
2852 | const MyRecord c_rec := { |
2853 | field1 := 5, |
2854 | field2 := -, |
2855 | field3 := omit // not optional |
2856 | }; |
2857 | } |
2858 | <END_MODULE> |
2859 | |
2860 | <RESULT COUNT 1> |
2861 | error: `omit' value is not allowed in this context |
2862 | <END_RESULT> |
2863 | |
2864 | <END_TC> |
2865 | :exmp |
2866 | |
2867 | *---------------------------------------------------------------------* |
2868 | :h3. NegSem_06020101_ReferencingRecordFields_001 negative test |
2869 | .*---------------------------------------------------------------------* |
2870 | :xmp tab=0. |
2871 | |
2872 | <TC - The omit keyword shall not be used for mandatory fields. > |
2873 | |
2874 | <COMPILE> |
2875 | |
2876 | <MODULE TTCN NegSem_06020101_ReferencingRecordFields_001 NegSem_06020101_ReferencingRecordFields_001.ttcn > |
2877 | /*************************************************** |
2878 | ** @version 0.0.1 |
2879 | ** @purpose 1:6.2.1.1, The dot notation used in record type definitions is correctly handled |
2880 | ** @verdict pass reject |
2881 | ***************************************************/ |
2882 | module NegSem_06020101_ReferencingRecordFields_001 { |
2883 | |
2884 | type component GeneralComp { |
2885 | } |
2886 | |
2887 | type record R { |
2888 | integer field1 (1 .. 10), |
2889 | charstring field2 optional |
2890 | } |
2891 | |
2892 | type R ConstrainedRecord ({1, omit}, {2, "xyz"}, {3, "zyx"}) ; |
2893 | |
2894 | type ConstrainedRecord.field1 MyInteger; |
2895 | |
2896 | testcase TC_NegSem_06020101_ReferencingRecordFields_001() runs on GeneralComp { |
2897 | |
2898 | var MyInteger v_int := 11; |
2899 | // assignment from outside of the carried over (1 .. 10) range constraint |
2900 | |
2901 | } |
2902 | |
2903 | control { |
2904 | execute(TC_NegSem_06020101_ReferencingRecordFields_001()); |
2905 | } |
2906 | |
2907 | } |
2908 | <END_MODULE> |
2909 | |
2910 | <RESULT COUNT 1> |
2911 | error: 11 is not a valid value for type `integer' which has subtype \(1..10\) |
2912 | <END_RESULT> |
2913 | |
2914 | <END_TC> |
2915 | :exmp |
2916 | |
2917 | *---------------------------------------------------------------------* |
2918 | :h3. NegSem_06020101_ReferencingRecordFields_002 negative test |
2919 | .*---------------------------------------------------------------------* |
2920 | :xmp tab=0. |
2921 | |
2922 | <TC - The omit keyword shall not be used for mandatory fields. > |
2923 | |
2924 | <COMPILE> |
2925 | |
2926 | <MODULE TTCN NegSem_06020101_ReferencingRecordFields_002 NegSem_06020101_ReferencingRecordFields_002.ttcn > |
2927 | /*************************************************** |
2928 | ** @version 0.0.1 |
2929 | ** @purpose 1:6.2.1.1, verify that record fields cannot reference themselves |
2930 | ** @verdict pass reject |
2931 | ***************************************************/ |
2932 | |
2933 | // The following requirement is tested: |
2934 | // Fields of record type definitions shall not reference themselves. |
2935 | |
2936 | module NegSem_06020101_ReferencingRecordFields_002 { |
2937 | |
2938 | type component GeneralComp { |
2939 | } |
2940 | |
2941 | type record R { |
2942 | integer field1, |
2943 | R.field2 field2 optional, // this circular reference is NOT ALLOWED |
2944 | boolean field3 |
2945 | } |
2946 | |
2947 | testcase TC_NegSem_06020101_ReferencingRecordFields_002() runs on GeneralComp { |
2948 | var R v_rec := { field1 := 1, field2 := omit, field3 := true }; |
2949 | if (v_rec.field1 == 1) { |
2950 | setverdict(pass); |
2951 | } else { |
2952 | setverdict(fail); |
2953 | } |
2954 | } |
2955 | |
2956 | control { |
2957 | execute(TC_NegSem_06020101_ReferencingRecordFields_002()); |
2958 | } |
2959 | |
2960 | } |
2961 | <END_MODULE> |
2962 | |
2963 | <RESULT COUNT 1> |
2964 | error: While checking referenced type: Circular reference: `@NegSem_06020101_ReferencingRecordFields_002.R.field2' -> `@NegSem_06020101_ReferencingRecordFields_002.R.field2' |
2965 | <END_RESULT> |
2966 | |
2967 | <END_TC> |
2968 | :exmp |
2969 | |
2970 | *---------------------------------------------------------------------* |
2971 | :h3. NegSem_06020101_ReferencingRecordFields_003 negative test |
2972 | .*---------------------------------------------------------------------* |
2973 | :xmp tab=0. |
2974 | |
2975 | <TC - The omit keyword shall not be used for mandatory fields. > |
2976 | |
2977 | <COMPILE> |
2978 | |
2979 | <EXECUTE_PARALLEL> |
2980 | |
2981 | <MODULE TTCN NegSem_06020101_ReferencingRecordFields_003 NegSem_06020101_ReferencingRecordFields_003.ttcn > |
2982 | /*************************************************** |
2983 | ** @version 0.0.1 |
2984 | ** @purpose 1:6.2.1.1, verify that referencing uninitialized record on the right hand of an assignment is not allowed |
2985 | ** @verdict pass reject |
2986 | ***************************************************/ |
2987 | |
2988 | // The following requirement is tested: |
2989 | // Referencing a subfield of an uninitialized or omitted record field or value on the right |
2990 | // hand side of an assignment shall cause an error. |
2991 | |
2992 | module NegSem_06020101_ReferencingRecordFields_003 { |
2993 | |
2994 | type component GeneralComp { |
2995 | } |
2996 | |
2997 | type record R { |
2998 | record { |
2999 | integer subfield1 |
3000 | } field1, |
3001 | charstring field2 optional |
3002 | } |
3003 | |
3004 | testcase TC_NegSem_06020101_ReferencingRecordFields_003() runs on GeneralComp { |
3005 | var R v_rec; |
3006 | v_rec.field2 := "abc"; |
3007 | if (v_rec.field1.subfield1 == 5) { |
3008 | setverdict(fail); |
3009 | } else { |
3010 | setverdict(pass); |
3011 | } |
3012 | } |
3013 | |
3014 | control { |
3015 | execute(TC_NegSem_06020101_ReferencingRecordFields_003()); |
3016 | } |
3017 | |
3018 | } |
3019 | <END_MODULE> |
3020 | |
3021 | <RESULT COUNT 1> |
3022 | Dynamic test case error: Unbound left operand of integer comparison. |
3023 | <END_RESULT> |
3024 | |
3025 | <END_TC> |
3026 | :exmp |
3027 | |
3028 | *---------------------------------------------------------------------* |
3029 | :h3. NegSem_06020101_ReferencingRecordFields_004 negative test |
3030 | .*---------------------------------------------------------------------* |
3031 | :xmp tab=0. |
3032 | |
3033 | <TC - The omit keyword shall not be used for mandatory fields. > |
3034 | |
3035 | <COMPILE> |
3036 | |
3037 | <EXECUTE_PARALLEL> |
3038 | |
3039 | <MODULE TTCN NegSem_06020101_ReferencingRecordFields_004 NegSem_06020101_ReferencingRecordFields_004.ttcn > |
3040 | /*************************************************** |
3041 | ** @version 0.0.1 |
3042 | ** @purpose 1:6.2.1.1, verify that referencing omitted record on the right hand of an assignment is not allowed |
3043 | ** @verdict pass reject |
3044 | ***************************************************/ |
3045 | |
3046 | // The following requirement is tested: |
3047 | // Referencing a subfield of an uninitialized or omitted record field or value on the right |
3048 | // hand side of an assignment shall cause an error. |
3049 | |
3050 | module NegSem_06020101_ReferencingRecordFields_004 { |
3051 | |
3052 | type component GeneralComp { |
3053 | } |
3054 | |
3055 | type record R { |
3056 | record { |
3057 | integer subfield1 |
3058 | } field1 optional, |
3059 | charstring field2 optional |
3060 | } |
3061 | |
3062 | testcase TC_NegSem_06020101_ReferencingRecordFields_004() runs on GeneralComp { |
3063 | var R v_rec; |
3064 | v_rec.field1 := omit; |
3065 | v_rec.field2 := "abc"; |
3066 | if (v_rec.field1.subfield1 == 5) { |
3067 | setverdict(fail); |
3068 | } else { |
3069 | setverdict(pass); |
3070 | } |
3071 | } |
3072 | |
3073 | control { |
3074 | execute(TC_NegSem_06020101_ReferencingRecordFields_004()); |
3075 | } |
3076 | |
3077 | } |
3078 | <END_MODULE> |
3079 | |
3080 | <RESULT COUNT 1> |
3081 | Dynamic test case error: Using the value of an optional field containing omit. |
3082 | <END_RESULT> |
3083 | |
3084 | <END_TC> |
3085 | :exmp |
3086 | |
3087 | *---------------------------------------------------------------------* |
3088 | :h3. NegSem_060202_SetTypeValues_001 negative test |
3089 | .*---------------------------------------------------------------------* |
3090 | :xmp tab=0. |
3091 | |
3092 | <TC - The omit keyword shall not be used for mandatory fields. > |
3093 | |
3094 | <COMPILE> |
3095 | |
3096 | <MODULE TTCN NegSem_060202_SetTypeValues_001 NegSem_060202_SetTypeValues_001.ttcn > |
3097 | /*************************************************** |
3098 | ** @version 0.0.1 |
3099 | ** @purpose 1:6.2.2, The dot notation used in set type definitions is correctly handled |
3100 | ** @verdict pass reject |
3101 | ***************************************************/ |
3102 | module NegSem_060202_SetTypeValues_001 { |
3103 | |
3104 | type component GeneralComp { |
3105 | } |
3106 | |
3107 | type set S { |
3108 | integer field1 (1 .. 10), |
3109 | charstring field2 optional |
3110 | } |
3111 | |
3112 | //type S ConstrainedSet ({1, omit}, {2, "xyz"}, {3, "zyx"}) ; // value list doesn't work |
3113 | type S ConstrainedSet ({field1 := 1, field2 := omit}, {field1 := 2, field2 := "xyz"}, {field1 := 3, field2 := "zyx"}) ; |
3114 | |
3115 | type ConstrainedSet.field1 MyInteger; |
3116 | |
3117 | testcase TC_NegSem_060202_SetTypeValues_001() runs on GeneralComp { |
3118 | |
3119 | var MyInteger v_int := 11; |
3120 | // assignment from outside of the carried over (1 .. 10) range constraint |
3121 | |
3122 | } |
3123 | |
3124 | control { |
3125 | execute(TC_NegSem_060202_SetTypeValues_001()); |
3126 | } |
3127 | |
3128 | } |
3129 | <END_MODULE> |
3130 | |
3131 | <RESULT COUNT 1> |
3132 | error: 11 is not a valid value for type `integer' which has subtype \(1..10\) |
3133 | <END_RESULT> |
3134 | |
3135 | <END_TC> |
3136 | :exmp |
3137 | |
3138 | *---------------------------------------------------------------------* |
3139 | :h3. NegSyn_060202_SetTypeValues_001 negative test |
3140 | .*---------------------------------------------------------------------* |
3141 | :xmp tab=0. |
3142 | |
3143 | <TC - The omit keyword shall not be used for mandatory fields. > |
3144 | |
3145 | <COMPILE> |
3146 | |
3147 | <MODULE TTCN NegSyn_060202_SetTypeValues_001 NegSyn_060202_SetTypeValues_001.ttcn > |
3148 | /*************************************************** |
3149 | ** @author STF470 |
3150 | ** @version 0.0.1 |
3151 | ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. |
3152 | ** @verdict pass reject |
3153 | ***************************************************/ |
3154 | module NegSyn_060202_SetTypeValues_001 { |
3155 | type set MySet { |
3156 | integer field1, |
3157 | MySet field2 optional, |
3158 | integer field3 |
3159 | } |
3160 | const MySet c_set := { |
3161 | field1 := 5, |
3162 | field2 := omit, |
3163 | field3 := omit // not optional |
3164 | }; |
3165 | } |
3166 | <END_MODULE> |
3167 | |
3168 | <RESULT COUNT 1> |
3169 | error: `omit' value is not allowed in this context |
3170 | <END_RESULT> |
3171 | |
3172 | <END_TC> |
3173 | :exmp |
3174 | |
3175 | *---------------------------------------------------------------------* |
3176 | :h3. NegSyn_060202_SetTypeValues_002 negative test |
3177 | .*---------------------------------------------------------------------* |
3178 | :xmp tab=0. |
3179 | |
3180 | <TC - The omit keyword shall not be used for mandatory fields. > |
3181 | |
3182 | <COMPILE> |
3183 | |
3184 | <MODULE TTCN NegSyn_060202_SetTypeValues_002 NegSyn_060202_SetTypeValues_002.ttcn > |
3185 | /*************************************************** |
3186 | ** @author STF470 |
3187 | ** @version 0.0.1 |
3188 | ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. |
3189 | ** @verdict pass reject |
3190 | ***************************************************/ |
3191 | module NegSyn_060202_SetTypeValues_002 { |
3192 | type record MySet { |
3193 | integer field1, |
3194 | MySet field2 optional, |
3195 | integer field3 |
3196 | } |
3197 | const MySet c_set := { |
3198 | field1 := 5, |
3199 | field2 := -, |
3200 | field3 :=omit // not optional |
3201 | }; |
3202 | } |
3203 | <END_MODULE> |
3204 | |
3205 | <RESULT COUNT 1> |
3206 | error: `omit' value is not allowed in this context |
3207 | <END_RESULT> |
3208 | |
3209 | <END_TC> |
3210 | :exmp |
3211 | |
3212 | *---------------------------------------------------------------------* |
3213 | :h3. NegSem_060203_records_and_sets_of_single_types_001 negative test |
3214 | .*---------------------------------------------------------------------* |
3215 | :xmp tab=0. |
3216 | |
3217 | <TC - ensure that the inner type referencing is correctly handled > |
3218 | |
3219 | <COMPILE> |
3220 | |
3221 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_001 NegSem_060203_records_and_sets_of_single_types_001.ttcn > |
3222 | /*************************************************** |
3223 | ** @version 0.0.1 |
3224 | ** @purpose 1:6.2.3.2, ensure that the inner type referencing is correctly handled |
3225 | ** @verdict pass reject |
3226 | ***************************************************/ |
3227 | module NegSem_060203_records_and_sets_of_single_types_001 { |
3228 | |
3229 | type component GeneralComp { |
3230 | } |
3231 | |
3232 | type record length (5) of record of integer ConstrainedStructure (1 .. 10); |
3233 | type ConstrainedStructure[-] RecordOfInt; |
3234 | |
3235 | testcase TC_NegSem_060203_records_and_sets_of_single_types_001() runs on GeneralComp { |
3236 | |
3237 | var RecordOfInt v_rec := { 8, 11, 2, 3, 4, 5, 6, 7 }; // a value is outside the restricted range |
3238 | |
3239 | } |
3240 | |
3241 | control { |
3242 | execute(TC_NegSem_060203_records_and_sets_of_single_types_001()); |
3243 | } |
3244 | |
3245 | } |
3246 | <END_MODULE> |
3247 | |
3248 | <RESULT COUNT 1> |
3249 | error: 11 is not a valid value for type `integer' which has subtype \(1..10\) |
3250 | <END_RESULT> |
3251 | |
3252 | <END_TC> |
3253 | :exmp |
3254 | |
3255 | *---------------------------------------------------------------------* |
3256 | :h3. NegSem_060203_records_and_sets_of_single_types_002 negative test |
3257 | .*---------------------------------------------------------------------* |
3258 | :xmp tab=0. |
3259 | |
3260 | <TC - ensure that the inner type referencing is correctly handled > |
3261 | |
3262 | <COMPILE> |
3263 | |
3264 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_002 NegSem_060203_records_and_sets_of_single_types_002.ttcn > |
3265 | /*************************************************** |
3266 | ** @version 0.0.1 |
3267 | ** @purpose 1:6.2.3.2, ensure that the inner type referencing is correctly handled |
3268 | ** @verdict pass reject |
3269 | ***************************************************/ |
3270 | module NegSem_060203_records_and_sets_of_single_types_002 { |
3271 | |
3272 | type component GeneralComp { |
3273 | } |
3274 | |
3275 | type record of record length (5) of integer ConstrainedStructure (1 .. 10); |
3276 | type ConstrainedStructure[-] RecordOfInt; |
3277 | |
3278 | testcase TC_NegSem_060203_records_and_sets_of_single_types_002() runs on GeneralComp { |
3279 | |
3280 | var RecordOfInt v_rec := { 8, 1, 2, 3, 4, 5, 6, 7 }; |
3281 | // a record is longer than the restricted length |
3282 | |
3283 | } |
3284 | |
3285 | control { |
3286 | execute(TC_NegSem_060203_records_and_sets_of_single_types_002()); |
3287 | } |
3288 | |
3289 | } |
3290 | <END_MODULE> |
3291 | |
3292 | <RESULT COUNT 1> |
3293 | error: \{ 8, 1, 2, 3, 4, 5, 6, 7 \} is not a valid value for type `@NegSem_060203_records_and_sets_of_single_types_002.ConstrainedStructure.SEQUENCE_OF' which has subtype length\(5\) |
3294 | <END_RESULT> |
3295 | |
3296 | <END_TC> |
3297 | :exmp |
3298 | |
3299 | *---------------------------------------------------------------------* |
3300 | :h3. NegSem_060203_records_and_sets_of_single_types_003 negative test |
3301 | .*---------------------------------------------------------------------* |
3302 | :xmp tab=0. |
3303 | |
3304 | <TC - negative index applied to a record of value on the right hand side of an assignment > |
3305 | |
3306 | <COMPILE> |
3307 | |
3308 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_003 NegSem_060203_records_and_sets_of_single_types_003.ttcn > |
3309 | /*************************************************** |
3310 | ** @version 0.0.1 |
3311 | ** @purpose 1:6.2.3, negative index applied to a record of value on the right hand side of an assignment |
3312 | ** @verdict pass reject |
3313 | ***************************************************/ |
3314 | |
3315 | // The following requirement is tested: |
3316 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3317 | // in TTCN-3:2014) |
3318 | module NegSem_060203_records_and_sets_of_single_types_003 { |
3319 | |
3320 | type component GeneralComp { |
3321 | } |
3322 | |
3323 | type record of integer RoI; |
3324 | |
3325 | testcase TC_NegSem_060203_records_and_sets_of_single_types_003() runs on GeneralComp { |
3326 | |
3327 | var RoI v_rec := { 0, 1, 2 }; |
3328 | var integer i := v_rec[-1]; // error expected |
3329 | setverdict(pass); |
3330 | } |
3331 | |
3332 | control { |
3333 | execute(TC_NegSem_060203_records_and_sets_of_single_types_003()); |
3334 | } |
3335 | |
3336 | } |
3337 | <END_MODULE> |
3338 | |
3339 | <RESULT COUNT 1> |
3340 | error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_003.RoI' instead of `-1' |
3341 | <END_RESULT> |
3342 | |
3343 | <END_TC> |
3344 | :exmp |
3345 | |
3346 | *---------------------------------------------------------------------* |
3347 | :h3. NegSem_060203_records_and_sets_of_single_types_004 negative test |
3348 | .*---------------------------------------------------------------------* |
3349 | :xmp tab=0. |
3350 | |
3351 | <TC - negative index applied to a set of value on the right hand side of an assignment > |
3352 | |
3353 | <COMPILE> |
3354 | |
3355 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_004 NegSem_060203_records_and_sets_of_single_types_004.ttcn > |
3356 | /*************************************************** |
3357 | ** @version 0.0.1 |
3358 | ** @purpose 1:6.2.3, negative index applied to a set of value on the right hand side of an assignment |
3359 | ** @verdict pass reject |
3360 | ***************************************************/ |
3361 | |
3362 | // The following requirement is tested: |
3363 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3364 | // in TTCN-3:2014) |
3365 | module NegSem_060203_records_and_sets_of_single_types_004 { |
3366 | |
3367 | type component GeneralComp { |
3368 | } |
3369 | |
3370 | type set of integer SoI; |
3371 | |
3372 | testcase TC_NegSem_060203_records_and_sets_of_single_types_004() runs on GeneralComp { |
3373 | |
3374 | var SoI v_set := { 0, 1, 2 }; |
3375 | var integer i := v_set[-1]; // error expected |
3376 | setverdict(pass); |
3377 | } |
3378 | |
3379 | control { |
3380 | execute(TC_NegSem_060203_records_and_sets_of_single_types_004()); |
3381 | } |
3382 | |
3383 | } |
3384 | <END_MODULE> |
3385 | |
3386 | <RESULT COUNT 1> |
3387 | error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_004.SoI' instead of `-1' |
3388 | <END_RESULT> |
3389 | |
3390 | <END_TC> |
3391 | :exmp |
3392 | |
3393 | *---------------------------------------------------------------------* |
3394 | :h3. NegSem_060203_records_and_sets_of_single_types_005 negative test |
3395 | .*---------------------------------------------------------------------* |
3396 | :xmp tab=0. |
3397 | |
3398 | <TC -negative index applied to a record of value on the left hand side of an assignment > |
3399 | |
3400 | <COMPILE> |
3401 | |
3402 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_005 NegSem_060203_records_and_sets_of_single_types_005.ttcn > |
3403 | /*************************************************** |
3404 | ** @version 0.0.1 |
3405 | ** @purpose 1:6.2.3, negative index applied to a record of value on the left hand side of an assignment |
3406 | ** @verdict pass reject |
3407 | ***************************************************/ |
3408 | |
3409 | // The following requirement is tested: |
3410 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3411 | // in TTCN-3:2014) |
3412 | module NegSem_060203_records_and_sets_of_single_types_005 { |
3413 | |
3414 | type component GeneralComp { |
3415 | } |
3416 | |
3417 | type record of integer RoI; |
3418 | |
3419 | testcase TC_NegSem_060203_records_and_sets_of_single_types_005() runs on GeneralComp { |
3420 | |
3421 | var RoI v_rec := { 0, 1, 2 }; |
3422 | v_rec[-1] := 10; // error expected |
3423 | setverdict(pass); |
3424 | } |
3425 | |
3426 | control { |
3427 | execute(TC_NegSem_060203_records_and_sets_of_single_types_005()); |
3428 | } |
3429 | |
3430 | } |
3431 | <END_MODULE> |
3432 | |
3433 | <RESULT COUNT 1> |
3434 | error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_005.RoI' instead of `-1' |
3435 | <END_RESULT> |
3436 | |
3437 | <END_TC> |
3438 | :exmp |
3439 | |
3440 | *---------------------------------------------------------------------* |
3441 | :h3. NegSem_060203_records_and_sets_of_single_types_006 negative test |
3442 | .*---------------------------------------------------------------------* |
3443 | :xmp tab=0. |
3444 | |
3445 | <TC -negative index applied to a set of value on the left hand side of an assignment > |
3446 | |
3447 | <COMPILE> |
3448 | |
3449 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_006 NegSem_060203_records_and_sets_of_single_types_006.ttcn > |
3450 | /*************************************************** |
3451 | ** @version 0.0.1 |
3452 | ** @purpose 1:6.2.3, negative index applied to a set of value on the left hand side of an assignment |
3453 | ** @verdict pass reject |
3454 | ***************************************************/ |
3455 | |
3456 | // The following requirement is tested: |
3457 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3458 | // in TTCN-3:2014) |
3459 | module NegSem_060203_records_and_sets_of_single_types_006 { |
3460 | |
3461 | type component GeneralComp { |
3462 | } |
3463 | |
3464 | type set of integer SoI; |
3465 | |
3466 | testcase TC_NegSem_060203_records_and_sets_of_single_types_006() runs on GeneralComp { |
3467 | |
3468 | var SoI v_set := { 0, 1, 2 }; |
3469 | v_set[-1] := 10; // error expected |
3470 | setverdict(pass); |
3471 | } |
3472 | |
3473 | control { |
3474 | execute(TC_NegSem_060203_records_and_sets_of_single_types_006()); |
3475 | } |
3476 | |
3477 | } |
3478 | <END_MODULE> |
3479 | |
3480 | <RESULT COUNT 1> |
3481 | error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_006.SoI' instead of `-1' |
3482 | <END_RESULT> |
3483 | |
3484 | <END_TC> |
3485 | :exmp |
3486 | |
3487 | *---------------------------------------------------------------------* |
3488 | :h3. NegSem_060203_records_and_sets_of_single_types_007 negative test |
3489 | .*---------------------------------------------------------------------* |
3490 | :xmp tab=0. |
3491 | |
3492 | <TC -wrong index type applied to a record of value on the right hand side of an assignment > |
3493 | |
3494 | <COMPILE> |
3495 | |
3496 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_007 NegSem_060203_records_and_sets_of_single_types_007.ttcn > |
3497 | /*************************************************** |
3498 | ** @version 0.0.1 |
3499 | ** @purpose 1:6.2.3, wrong index type applied to a record of value on the right hand side of an assignment |
3500 | ** @verdict pass reject |
3501 | ***************************************************/ |
3502 | |
3503 | // The following requirement is tested: |
3504 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3505 | // in TTCN-3:2014) |
3506 | module NegSem_060203_records_and_sets_of_single_types_007 { |
3507 | |
3508 | type component GeneralComp { |
3509 | } |
3510 | |
3511 | type record of integer RoI; |
3512 | |
3513 | testcase TC_NegSem_060203_records_and_sets_of_single_types_007() runs on GeneralComp { |
3514 | |
3515 | var RoI v_rec := { 0, 1, 2 }; |
3516 | var integer i := v_rec["0"]; // error expected |
3517 | setverdict(pass); |
3518 | } |
3519 | |
3520 | control { |
3521 | execute(TC_NegSem_060203_records_and_sets_of_single_types_007()); |
3522 | } |
3523 | |
3524 | } |
3525 | <END_MODULE> |
3526 | |
3527 | <RESULT COUNT 1> |
3528 | error: A value or expression of type integer was expected |
3529 | <END_RESULT> |
3530 | |
3531 | <END_TC> |
3532 | :exmp |
3533 | |
3534 | *---------------------------------------------------------------------* |
3535 | :h3. NegSem_060203_records_and_sets_of_single_types_008 negative test |
3536 | .*---------------------------------------------------------------------* |
3537 | :xmp tab=0. |
3538 | |
3539 | <TC - wrong index type applied to a set of value on the right hand side of an assignment > |
3540 | |
3541 | <COMPILE> |
3542 | |
3543 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_008 NegSem_060203_records_and_sets_of_single_types_008.ttcn > |
3544 | /*************************************************** |
3545 | ** @version 0.0.1 |
3546 | ** @purpose 1:6.2.3, wrong index type applied to a set of value on the right hand side of an assignment |
3547 | ** @verdict pass reject |
3548 | ***************************************************/ |
3549 | |
3550 | // The following requirement is tested: |
3551 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3552 | // in TTCN-3:2014) |
3553 | module NegSem_060203_records_and_sets_of_single_types_008 { |
3554 | |
3555 | type component GeneralComp { |
3556 | } |
3557 | |
3558 | type set of integer SoI; |
3559 | |
3560 | testcase TC_NegSem_060203_records_and_sets_of_single_types_008() runs on GeneralComp { |
3561 | |
3562 | var SoI v_set := { 0, 1, 2 }; |
3563 | var integer i := v_set["0"]; // error expected |
3564 | setverdict(pass); |
3565 | } |
3566 | |
3567 | control { |
3568 | execute(TC_NegSem_060203_records_and_sets_of_single_types_008()); |
3569 | } |
3570 | |
3571 | } |
3572 | <END_MODULE> |
3573 | |
3574 | <RESULT COUNT 1> |
3575 | error: A value or expression of type integer was expected |
3576 | <END_RESULT> |
3577 | |
3578 | <END_TC> |
3579 | :exmp |
3580 | |
3581 | *---------------------------------------------------------------------* |
3582 | :h3. NegSem_060203_records_and_sets_of_single_types_009 negative test |
3583 | .*---------------------------------------------------------------------* |
3584 | :xmp tab=0. |
3585 | |
3586 | <TC - wrong index type applied to a record of value on the left hand side of an assignment > |
3587 | |
3588 | <COMPILE> |
3589 | |
3590 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_009 NegSem_060203_records_and_sets_of_single_types_009.ttcn > |
3591 | /*************************************************** |
3592 | ** @version 0.0.1 |
3593 | ** @purpose 1:6.2.3, wrong index type applied to a record of value on the left hand side of an assignment |
3594 | ** @verdict pass reject |
3595 | ***************************************************/ |
3596 | |
3597 | // The following requirement is tested: |
3598 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3599 | // in TTCN-3:2014) |
3600 | module NegSem_060203_records_and_sets_of_single_types_009 { |
3601 | |
3602 | type component GeneralComp { |
3603 | } |
3604 | |
3605 | type record of integer RoI; |
3606 | |
3607 | testcase TC_NegSem_060203_records_and_sets_of_single_types_009() runs on GeneralComp { |
3608 | |
3609 | var RoI v_rec := { 0, 1, 2 }; |
3610 | v_rec["0"] := 10; // error expected |
3611 | setverdict(pass); |
3612 | } |
3613 | |
3614 | control { |
3615 | execute(TC_NegSem_060203_records_and_sets_of_single_types_009()); |
3616 | } |
3617 | |
3618 | } |
3619 | <END_MODULE> |
3620 | |
3621 | <RESULT COUNT 1> |
3622 | error: A value or expression of type integer was expected |
3623 | <END_RESULT> |
3624 | |
3625 | <END_TC> |
3626 | :exmp |
3627 | |
3628 | *---------------------------------------------------------------------* |
3629 | :h3. NegSem_060203_records_and_sets_of_single_types_010 negative test |
3630 | .*---------------------------------------------------------------------* |
3631 | :xmp tab=0. |
3632 | |
3633 | <TC - wrong index type applied to a set of value on the left hand side of an assignment > |
3634 | |
3635 | <COMPILE> |
3636 | |
3637 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_010 NegSem_060203_records_and_sets_of_single_types_010.ttcn > |
3638 | /*************************************************** |
3639 | ** @version 0.0.1 |
3640 | ** @purpose 1:6.2.3.2, wrong index type applied to a set of value on the left hand side of an assignment |
3641 | ** @verdict pass reject |
3642 | ***************************************************/ |
3643 | |
3644 | // The following requirement is tested: |
3645 | // Implicit rule, formal requirement requested in CR 6646 (resolution expected |
3646 | // in TTCN-3:2014) |
3647 | module NegSem_060203_records_and_sets_of_single_types_010 { |
3648 | |
3649 | type component GeneralComp { |
3650 | } |
3651 | |
3652 | type set of integer SoI; |
3653 | |
3654 | testcase TC_NegSem_060203_records_and_sets_of_single_types_010() runs on GeneralComp { |
3655 | |
3656 | var SoI v_set := { 0, 1, 2 }; |
3657 | v_set["0"] := 10; // error expected |
3658 | setverdict(pass); |
3659 | } |
3660 | |
3661 | control { |
3662 | execute(TC_NegSem_060203_records_and_sets_of_single_types_010()); |
3663 | } |
3664 | |
3665 | } |
3666 | <END_MODULE> |
3667 | |
3668 | <RESULT COUNT 1> |
3669 | error: A value or expression of type integer was expected |
3670 | <END_RESULT> |
3671 | |
3672 | <END_TC> |
3673 | :exmp |
3674 | |
3675 | *---------------------------------------------------------------------* |
3676 | :h3. NegSem_060203_records_and_sets_of_single_types_013 negative test |
3677 | .*---------------------------------------------------------------------* |
3678 | :xmp tab=0. |
3679 | |
3680 | <TC - wrong index type applied to a record of value on the right hand side of an assignment > |
3681 | |
3682 | <COMPILE> |
3683 | <EXECUTE_PARALLEL> |
3684 | |
3685 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_013 NegSem_060203_records_and_sets_of_single_types_013.ttcn > |
3686 | /*************************************************** |
3687 | ** @version 0.0.1 |
3688 | ** @purpose 1:6.2.3.2, wrong index type applied to a record of value on the right hand side of an assignment |
3689 | ** @verdict pass reject |
3690 | ***************************************************/ |
3691 | |
3692 | // The following requirement is tested: |
3693 | // If the value of the element indicated by the index at the right-hand of an |
3694 | // assignment is undefined (uninitialized), this shall cause a semantic or |
3695 | // run-time error.) |
3696 | module NegSem_060203_records_and_sets_of_single_types_013 { |
3697 | |
3698 | type component GeneralComp { |
3699 | } |
3700 | |
3701 | type record of integer RoI; |
3702 | |
3703 | testcase TC_NegSem_060203_records_and_sets_of_single_types_013() runs on GeneralComp { |
3704 | |
3705 | var RoI v_rec := { 0, 1, 2 }; |
3706 | var integer i := v_rec[3]; // error expected |
3707 | setverdict(pass); |
3708 | } |
3709 | |
3710 | control { |
3711 | execute(TC_NegSem_060203_records_and_sets_of_single_types_013()); |
3712 | } |
3713 | |
3714 | } |
3715 | <END_MODULE> |
3716 | |
3717 | <RESULT COUNT 1> |
3718 | Dynamic test case error: Index overflow in a value of type @PreGenRecordOf.PREGEN_RECORD_OF_INTEGER: The index is 3, but the value has only 3 elements. |
3719 | <END_RESULT> |
3720 | |
3721 | <END_TC> |
3722 | :exmp |
3723 | |
3724 | *---------------------------------------------------------------------* |
3725 | :h3. NegSem_060203_records_and_sets_of_single_types_014 negative test |
3726 | .*---------------------------------------------------------------------* |
3727 | :xmp tab=0. |
3728 | |
3729 | <TC - wrong index type applied to a record of value on the right hand side of an assignment > |
3730 | |
3731 | <COMPILE> |
3732 | <EXECUTE_PARALLEL> |
3733 | |
3734 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_014 NegSem_060203_records_and_sets_of_single_types_014.ttcn > |
3735 | /*************************************************** |
3736 | ** @version 0.0.1 |
3737 | ** @purpose 1:6.2.3.2, wrong index type applied to a record of value on the right hand side of an assignment |
3738 | ** @verdict pass reject |
3739 | ***************************************************/ |
3740 | |
3741 | // The following requirement is tested: |
3742 | // If the value of the element indicated by the index at the right-hand of an |
3743 | // assignment is undefined (uninitialized), this shall cause a semantic or |
3744 | // run-time error.) |
3745 | module NegSem_060203_records_and_sets_of_single_types_014 { |
3746 | |
3747 | type component GeneralComp { |
3748 | } |
3749 | |
3750 | type set of integer SoI; |
3751 | |
3752 | testcase TC_NegSem_060203_records_and_sets_of_single_types_014() runs on GeneralComp { |
3753 | |
3754 | var SoI v_set := { 0, 1, 2 }; |
3755 | var integer i := v_set[3]; // error expected |
3756 | setverdict(pass); |
3757 | } |
3758 | |
3759 | control { |
3760 | execute(TC_NegSem_060203_records_and_sets_of_single_types_014()); |
3761 | } |
3762 | |
3763 | } |
3764 | <END_MODULE> |
3765 | |
3766 | <RESULT COUNT 1> |
3767 | Dynamic test case error: Index overflow in a value of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER: The index is 3, but the value has only 3 elements. |
3768 | <END_RESULT> |
3769 | |
3770 | <END_TC> |
3771 | :exmp |
3772 | |
3773 | *---------------------------------------------------------------------* |
3774 | :h3. NegSem_060203_records_and_sets_of_single_types_015 negative test |
3775 | .*---------------------------------------------------------------------* |
3776 | :xmp tab=0. |
3777 | |
3778 | <TC - verify than an error is generated when sending a partially initialized record of value > |
3779 | |
3780 | <COMPILE> |
3781 | <EXECUTE_PARALLEL> |
3782 | |
3783 | <MODULE TTCN NegSem_060203_records_and_sets_of_single_types_015 NegSem_060203_records_and_sets_of_single_types_015.ttcn > |
3784 | /*************************************************** |
3785 | ** @version 0.0.1 |
3786 | ** @purpose 1:6.2.3.2, verify than an error is generated when sending a partially initialized record of value |
3787 | ** @verdict pass reject |
3788 | ***************************************************/ |
3789 | |
3790 | // The following requirement is tested: |
3791 | // Undefined elements are permitted only in transient states (while the value |
3792 | // remains invisible). Sending a record of value with undefined elements shall |
3793 | // cause a test case error. |
3794 | |
3795 | module NegSem_060203_records_and_sets_of_single_types_015 { |
3796 | |
3797 | type record of integer RoI; |
3798 | |
3799 | type port P message { |
3800 | inout RoI |
3801 | } with {extension "internal"} |
3802 | |
3803 | type component GeneralComp { |
3804 | port P p |
3805 | } |
3806 | |
3807 | testcase TC_NegSem_060203_records_and_sets_of_single_types_015() runs on GeneralComp { |
3808 | var template RoI mw_sendingTemplate := {0, -, 2}; |
3809 | connect(self:p,self:p); |
3810 | p.send(mw_sendingTemplate); // error expected |
3811 | setverdict(pass); |
3812 | } |
3813 | |
3814 | control{ |
3815 | execute(TC_NegSem_060203_records_and_sets_of_single_types_015()); |
3816 | } |
3817 | } |
3818 | <END_MODULE> |
3819 | |
3820 | <RESULT COUNT 1> |
3821 | Dynamic test case error: Text encoder: Encoding an unbound integer value. |
3822 | <END_RESULT> |
3823 | |
3824 | <END_TC> |
3825 | :exmp |
3826 | |
3827 | *---------------------------------------------------------------------* |
3828 | :h3. NegSyn_060203_records_and_sets_of_single_types_001 negative test |
3829 | .*---------------------------------------------------------------------* |
3830 | :xmp tab=0. |
3831 | |
3832 | <TC - ensure that value list cannot contain an empty assignment > |
3833 | |
3834 | <COMPILE> |
3835 | |
3836 | <MODULE TTCN NegSyn_060203_records_and_sets_of_single_types_001 NegSyn_060203_records_and_sets_of_single_types_001.ttcn > |
3837 | /*************************************************** |
3838 | ** @version 0.0.1 |
3839 | ** @purpose 1:6.2.3.2, ensure that value list cannot contain an empty assignment |
3840 | ** @verdict pass reject |
3841 | ***************************************************/ |
3842 | |
3843 | // The following requirement is tested: |
3844 | // No empty assignment is allowed (e.g. two commas, the second immediately |
3845 | // following the first or only with white space between them). |
3846 | module NegSyn_060203_records_and_sets_of_single_types_001 { |
3847 | |
3848 | type component GeneralComp { |
3849 | } |
3850 | |
3851 | type record of integer RoI; |
3852 | |
3853 | testcase TC_NegSyn_060203_records_and_sets_of_single_types_001() runs on GeneralComp { |
3854 | |
3855 | var RecordOfInt v_rec := { 0, , 2 }; // syntax error expected |
3856 | |
3857 | } |
3858 | |
3859 | control { |
3860 | execute(TC_NegSyn_060203_records_and_sets_of_single_types_001()); |
3861 | } |
3862 | |
3863 | } |
3864 | <END_MODULE> |
3865 | |
3866 | <RESULT COUNT 1> |
3867 | error: at or before token `,': syntax error, unexpected ',' |
3868 | <END_RESULT> |
3869 | |
3870 | <END_TC> |
3871 | :exmp |
3872 | |
3873 | *---------------------------------------------------------------------* |
3874 | :h3. NegSem_060204_enumerated_type_and_values_001 negative test |
3875 | .*---------------------------------------------------------------------* |
3876 | :xmp tab=0. |
3877 | |
3878 | <TC - not unique identifiers in enumerated type declaration > |
3879 | |
3880 | <COMPILE> |
3881 | |
3882 | <MODULE TTCN NegSem_060204_enumerated_type_and_values_001 NegSem_060204_enumerated_type_and_values_001.ttcn > |
3883 | /*************************************************** |
3884 | ** @version 0.0.1 |
3885 | ** @purpose 1:6.2.7, not unique identifiers in enumerated type declaration |
3886 | ** @verdict pass reject |
3887 | ***************************************************/ |
3888 | |
3889 | // The following requirement is tested: |
3890 | // The identifiers of enumerated values shall be unique within the enumerated type |
3891 | // (but do not have to be globally unique) and are consequently visible in the |
3892 | // context of the given type only. |
3893 | |
3894 | module NegSem_060204_enumerated_type_and_values_001 { |
3895 | |
3896 | type enumerated MyFirstEnumType { |
3897 | Monday, Tuesday, Wednesday, Thursday, Friday, Monday |
3898 | }; |
3899 | } |
3900 | <END_MODULE> |
3901 | |
3902 | <RESULT COUNT 1> |
3903 | error: Duplicate enumeration identifier `Monday' |
3904 | <END_RESULT> |
3905 | |
3906 | <END_TC> |
3907 | :exmp |
3908 | |
3909 | *---------------------------------------------------------------------* |
3910 | :h3. NegSem_060204_enumerated_type_and_values_002 negative test |
3911 | .*---------------------------------------------------------------------* |
3912 | :xmp tab=0. |
3913 | |
3914 | <TC - two equal user-assigned enumerated values > |
3915 | |
3916 | <COMPILE> |
3917 | |
3918 | <MODULE TTCN NegSem_060204_enumerated_type_and_values_002 NegSem_060204_enumerated_type_and_values_002.ttcn > |
3919 | /*************************************************** |
3920 | ** @version 0.0.1 |
3921 | ** @purpose 1:6.2.4, two equal user-assigned enumerated values |
3922 | ** @verdict pass reject |
3923 | ***************************************************/ |
3924 | |
3925 | // The following requirement is tested: |
3926 | // Each user-assigned integer number shall be distinct within a single enumerated |
3927 | // type. |
3928 | |
3929 | module NegSem_060204_enumerated_type_and_values_002 { |
3930 | |
3931 | type enumerated MyFirstEnumType { |
3932 | Monday, Tuesday(2), Wednesday(2), Thursday, Friday |
3933 | }; |
3934 | } |
3935 | <END_MODULE> |
3936 | |
3937 | <RESULT COUNT 1> |
3938 | error: Duplicate numeric value 2 for enumeration `Wednesday' |
3939 | <END_RESULT> |
3940 | |
3941 | <END_TC> |
3942 | :exmp |
3943 | |
3944 | *---------------------------------------------------------------------* |
3945 | :h3. NegSem_060204_enumerated_type_and_values_003 negative test |
3946 | .*---------------------------------------------------------------------* |
3947 | :xmp tab=0. |
3948 | |
3949 | <TC - using enumerated value number directly (left hand side of assignments) > |
3950 | |
3951 | <COMPILE> |
3952 | |
3953 | <MODULE TTCN NegSem_060204_enumerated_type_and_values_003 NegSem_060204_enumerated_type_and_values_003.ttcn > |
3954 | /*************************************************** |
3955 | ** @version 0.0.1 |
3956 | ** @purpose 1:6.2.4, using enumerated value number directly (left hand side of assignments) |
3957 | ** @verdict pass reject |
3958 | ***************************************************/ |
3959 | |
3960 | // The following requirement is tested: |
3961 | // For each enumerated value without an assigned integer value, the system |
3962 | // successively associates an integer number in the textual order of the |
3963 | // enumerated values, starting at the left-hand side, beginning with zero, by |
3964 | // step 1 and skipping any number occupied by any of the enumerated values with |
3965 | // a manually assigned value. These values are only used by the system to allow |
3966 | // the use of relational operators. The user shall not directly use associated |
3967 | // integer values but can access them and convert integer values into enumerated |
3968 | // values by using the predefined functions enum2int and int2enum (see clauses |
3969 | // 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4). |
3970 | |
3971 | module NegSem_060204_enumerated_type_and_values_003 { |
3972 | |
3973 | type component GeneralComp { |
3974 | } |
3975 | |
3976 | type enumerated EDays { |
3977 | Monday, Tuesday, Wednesday, Thursday, Friday |
3978 | }; |
3979 | |
3980 | testcase TC_NegSem_060204_enumerated_type_and_values_003() runs on GeneralComp { |
3981 | var EDays v_day0 := 0; // ordinal value shall not be accepted |
3982 | setverdict(pass); |
3983 | } |
3984 | |
3985 | control { |
3986 | execute(TC_NegSem_060204_enumerated_type_and_values_003()); |
3987 | } |
3988 | } |
3989 | <END_MODULE> |
3990 | |
3991 | <RESULT COUNT 1> |
3992 | error: enumerated value was expected |
3993 | <END_RESULT> |
3994 | |
3995 | <END_TC> |
3996 | :exmp |
3997 | |
3998 | *---------------------------------------------------------------------* |
3999 | :h3. NegSem_060204_enumerated_type_and_values_004 negative test |
4000 | .*---------------------------------------------------------------------* |
4001 | :xmp tab=0. |
4002 | |
4003 | <TC - using enumerated value number directly (right hand side of assignments) > |
4004 | |
4005 | <COMPILE> |
4006 | |
4007 | <MODULE TTCN NegSem_060204_enumerated_type_and_values_004 NegSem_060204_enumerated_type_and_values_004.ttcn > |
4008 | /*************************************************** |
4009 | ** @version 0.0.1 |
4010 | ** @purpose 1:6.2.4, using enumerated value number directly (right hand side of assignments) |
4011 | ** @verdict pass reject |
4012 | ***************************************************/ |
4013 | |
4014 | // The following requirement is tested: |
4015 | // For each enumerated value without an assigned integer value, the system |
4016 | // successively associates an integer number in the textual order of the |
4017 | // enumerated values, starting at the left-hand side, beginning with zero, by |
4018 | // step 1 and skipping any number occupied by any of the enumerated values with |
4019 | // a manually assigned value. These values are only used by the system to allow |
4020 | // the use of relational operators. The user shall not directly use associated |
4021 | // integer values but can access them and convert integer values into enumerated |
4022 | // values by using the predefined functions enum2int and int2enum (see clauses |
4023 | // 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4). |
4024 | |
4025 | module NegSem_060204_enumerated_type_and_values_004 { |
4026 | |
4027 | type component GeneralComp { |
4028 | } |
4029 | |
4030 | type enumerated EDays { |
4031 | Monday, Tuesday, Wednesday, Thursday, Friday |
4032 | }; |
4033 | |
4034 | testcase TC_NegSem_060204_enumerated_type_and_values_004() runs on GeneralComp { |
4035 | var EDays v_day0 := Monday; |
4036 | var integer v_int := v_day0; |
4037 | setverdict(pass); |
4038 | } |
4039 | |
4040 | control { |
4041 | execute(TC_NegSem_060204_enumerated_type_and_values_004()); |
4042 | } |
4043 | } |
4044 | <END_MODULE> |
4045 | |
4046 | <RESULT COUNT 1> |
4047 | error: Type mismatch: a value of type `integer' was expected instead of `@NegSem_060204_enumerated_type_and_values_004.EDays' |
4048 | <END_RESULT> |
4049 | |
4050 | <END_TC> |
4051 | :exmp |
4052 | |
4053 | *---------------------------------------------------------------------* |
4054 | :h3. NegSem_060204_enumerated_type_and_values_005 negative test |
4055 | .*---------------------------------------------------------------------* |
4056 | :xmp tab=0. |
4057 | |
4058 | <TC - using enumerated value without implicit or explicit type reference > |
4059 | |
4060 | <COMPILE> |
4061 | |
4062 | <MODULE TTCN NegSem_060204_enumerated_type_and_values_005 NegSem_060204_enumerated_type_and_values_005.ttcn > |
4063 | /*************************************************** |
4064 | ** @version 0.0.1 |
4065 | ** @purpose 1:6.2.4, using enumerated value without implicit or explicit type reference |
4066 | ** @verdict pass reject |
4067 | ***************************************************/ |
4068 | |
4069 | // The following requirement is tested: |
4070 | // For any instantiation or value reference of an enumerated type, the given |
4071 | // type shall be implicitly or explicitly referenced. |
4072 | |
4073 | module NegSem_060204_enumerated_type_and_values_005 { |
4074 | |
4075 | type component GeneralComp { |
4076 | } |
4077 | |
4078 | type enumerated EDays { |
4079 | Monday, Tuesday, Wednesday, Thursday, Friday |
4080 | }; |
4081 | |
4082 | testcase TC_NegSem_060204_enumerated_type_and_values_005() runs on GeneralComp { |
4083 | if (Tuesday != Wednesday) { // no implicit or explicit reference to enumeration |
4084 | setverdict(pass); |
4085 | } else { |
4086 | setverdict(fail); |
4087 | } |
4088 | } |
4089 | |
4090 | control { |
4091 | execute(TC_NegSem_060204_enumerated_type_and_values_005()); |
4092 | } |
4093 | } |
4094 | <END_MODULE> |
4095 | |
4096 | <RESULT COUNT 1> |
4097 | error: Cannot determine the type of the operands in operation `!=' |
4098 | <END_RESULT> |
4099 | |
4100 | <END_TC> |
4101 | :exmp |
4102 | |
4103 | *---------------------------------------------------------------------* |
4104 | :h3. NegSyn_060204_enumerated_type_and_values_001 negative test |
4105 | .*---------------------------------------------------------------------* |
4106 | :xmp tab=0. |
4107 | |
4108 | <TC - constant as user-assigned enumerated values > |
4109 | |
4110 | <COMPILE> |
4111 | |
4112 | <MODULE TTCN NegSyn_060204_enumerated_type_and_values_001 NegSyn_060204_enumerated_type_and_values_001.ttcn > |
4113 | /*************************************************** |
4114 | ** @version 0.0.1 |
4115 | ** @purpose 1:6.2.4, constant as user-assigned enumerated values |
4116 | ** @verdict pass reject |
4117 | ***************************************************/ |
4118 | |
4119 | // The following requirement is tested: |
4120 | // Each enumerated value may optionally have a user-assigned integer value, which |
4121 | // is defined after the name of the enumerated value in parenthesis. |
4122 | |
4123 | module NegSyn_060204_enumerated_type_and_values_001 { |
4124 | |
4125 | const integer c_int := 5; |
4126 | type enumerated MyFirstEnumType { |
4127 | Monday, Tuesday(c_int), Wednesday, Thursday, Friday |
4128 | }; |
4129 | } |
4130 | <END_MODULE> |
4131 | |
4132 | <RESULT COUNT 1> |
4133 | error: at or before token `c_int': syntax error, unexpected Identifier, expecting Number or '-' |
4134 | <END_RESULT> |
4135 | |
4136 | <END_TC> |
4137 | :exmp |
4138 | |
4139 | *---------------------------------------------------------------------* |
4140 | :h3. NegSyn_060204_enumerated_type_and_values_002 negative test |
4141 | .*---------------------------------------------------------------------* |
4142 | :xmp tab=0. |
4143 | |
4144 | <TC - expression as user-assigned enumerated value > |
4145 | |
4146 | <COMPILE> |
4147 | |
4148 | <MODULE TTCN NegSyn_060204_enumerated_type_and_values_002 NegSyn_060204_enumerated_type_and_values_002.ttcn > |
4149 | /*************************************************** |
4150 | ** @version 0.0.1 |
4151 | ** @purpose 1:6.2.4, expression as user-assigned enumerated value |
4152 | ** @verdict pass reject |
4153 | ***************************************************/ |
4154 | |
4155 | // The following requirement is tested: |
4156 | // Each enumerated value may optionally have a user-assigned integer value, which |
4157 | // is defined after the name of the enumerated value in parenthesis. |
4158 | |
4159 | module NegSyn_060204_enumerated_type_and_values_002 { |
4160 | |
4161 | type enumerated MyFirstEnumType { |
4162 | Monday, Tuesday(2+3), Thursday, Friday |
4163 | }; |
4164 | } |
4165 | <END_MODULE> |
4166 | |
4167 | <RESULT COUNT 1> |
4168 | error: at or before token `\+': syntax error, unexpected '\+', expecting '\)' |
4169 | <END_RESULT> |
4170 | |
4171 | <END_TC> |
4172 | :exmp |
4173 | |
4174 | *---------------------------------------------------------------------* |
4175 | :h3. NegSem_060205_top_level_001 negative test |
4176 | .*---------------------------------------------------------------------* |
4177 | :xmp tab=0. |
4178 | |
4179 | <TC - assignment notation for union values with two items > |
4180 | |
4181 | <COMPILE> |
4182 | |
4183 | <MODULE TTCN NegSem_060205_top_level_001 NegSem_060205_top_level_001.ttcn > |
4184 | /*************************************************** |
4185 | ** @version 0.0.1 |
4186 | ** @purpose 1:6.2.5, assignment notation for union values with two items |
4187 | ** @verdict pass reject |
4188 | ***************************************************/ |
4189 | |
4190 | // The following requirement is tested: |
4191 | // The assignment notation shall be used for union-s, and the notation shall assign |
4192 | // a value to one field only. This field becomes the chosen field. |
4193 | |
4194 | module NegSem_060205_top_level_001 { |
4195 | type component GeneralComp { |
4196 | } |
4197 | |
4198 | type union U { |
4199 | integer option1, |
4200 | charstring option2 |
4201 | } |
4202 | |
4203 | testcase TC_NegSem_060205_top_level_001() runs on GeneralComp { |
4204 | var U v_choice := { option1 := 1, option2 := "abc" }; |
4205 | if (ischosen(v_choice.option1) or ischosen(v_choice.option2)) { setverdict(pass); } |
4206 | else { setverdict(fail); } |
4207 | } |
4208 | |
4209 | control{ |
4210 | execute(TC_NegSem_060205_top_level_001()); |
4211 | } |
4212 | } |
4213 | <END_MODULE> |
4214 | |
4215 | <RESULT COUNT 1> |
4216 | error: Only one field was expected in union value instead of 2 |
4217 | <END_RESULT> |
4218 | |
4219 | <END_TC> |
4220 | :exmp |
4221 | |
4222 | *---------------------------------------------------------------------* |
4223 | :h3. NegSem_060205_top_level_002 negative test |
4224 | .*---------------------------------------------------------------------* |
4225 | :xmp tab=0. |
4226 | |
4227 | <TC - assignment notation for union values with unknown alternative > |
4228 | |
4229 | <COMPILE> |
4230 | |
4231 | <MODULE TTCN NegSem_060205_top_level_002 NegSem_060205_top_level_002.ttcn > |
4232 | /*************************************************** |
4233 | ** @version 0.0.1 |
4234 | ** @purpose 1:6.2.5, assignment notation for union values with unknown alternative |
4235 | ** @verdict pass reject |
4236 | ***************************************************/ |
4237 | |
4238 | // The following requirement is tested: |
4239 | // The assignment notation shall be used for union-s, and the notation shall assign |
4240 | // a value to one field only. This field becomes the chosen field. |
4241 | |
4242 | module NegSem_060205_top_level_002 { |
4243 | type component GeneralComp { |
4244 | } |
4245 | |
4246 | type union U { |
4247 | integer option1, |
4248 | charstring option2 |
4249 | } |
4250 | |
4251 | testcase TC_NegSem_060205_top_level_002() runs on GeneralComp { |
4252 | var U v_choice := { option1 := 10 }; |
4253 | v_choice := { option3 := true }; |
4254 | if (ischosen(v_choice.option1)) { setverdict(pass); } |
4255 | else { setverdict(fail); } |
4256 | } |
4257 | |
4258 | control{ |
4259 | execute(TC_NegSem_060205_top_level_002()); |
4260 | } |
4261 | } |
4262 | <END_MODULE> |
4263 | |
4264 | <RESULT COUNT 1> |
4265 | error: Reference to non-existent field `option3' in union value for type `@NegSem_060205_top_level_002.U' |
4266 | <END_RESULT> |
4267 | |
4268 | <END_TC> |
4269 | :exmp |
4270 | |
4271 | *---------------------------------------------------------------------* |
4272 | :h3. NegSem_060205_top_level_003 negative test |
4273 | .*---------------------------------------------------------------------* |
4274 | :xmp tab=0. |
4275 | |
4276 | <TC - "not used" symbol in union value notations > |
4277 | |
4278 | <COMPILE> |
4279 | |
4280 | <MODULE TTCN NegSem_060205_top_level_003 NegSem_060205_top_level_003.ttcn > |
4281 | /*************************************************** |
4282 | ** @version 0.0.1 |
4283 | ** @purpose 1:6.2.5, "not used" symbol in union value notations |
4284 | ** @verdict pass reject |
4285 | ***************************************************/ |
4286 | |
4287 | // The following requirement is tested: |
4288 | // Neither the not used symbol "-" nor omit is allowed in union value notations. |
4289 | |
4290 | module NegSem_060205_top_level_003 { |
4291 | type component GeneralComp { |
4292 | } |
4293 | |
4294 | type union U { |
4295 | integer option1, |
4296 | charstring option2 |
4297 | } |
4298 | |
4299 | testcase TC_NegSem_060205_top_level_003() runs on GeneralComp { |
4300 | var U v_choice := { option1 := - }; |
4301 | if (ischosen(v_choice.option1)) { setverdict(pass); } |
4302 | else { setverdict(fail); } |
4303 | } |
4304 | |
4305 | control{ |
4306 | execute(TC_NegSem_060205_top_level_003()); |
4307 | } |
4308 | } |
4309 | <END_MODULE> |
4310 | |
4311 | <RESULT COUNT 1> |
4312 | error: integer value was expected |
4313 | <END_RESULT> |
4314 | |
4315 | <END_TC> |
4316 | :exmp |
4317 | |
4318 | *---------------------------------------------------------------------* |
4319 | :h3. NegSem_060205_top_level_004 negative test |
4320 | .*---------------------------------------------------------------------* |
4321 | :xmp tab=0. |
4322 | |
4323 | <TC - omit symbol in union value notations > |
4324 | |
4325 | <COMPILE> |
4326 | |
4327 | <MODULE TTCN NegSem_060205_top_level_004 NegSem_060205_top_level_004.ttcn > |
4328 | /*************************************************** |
4329 | ** @version 0.0.1 |
4330 | ** @purpose 1:6.2.5, omit symbol in union value notations |
4331 | ** @verdict pass reject |
4332 | ***************************************************/ |
4333 | |
4334 | // The following requirement is tested: |
4335 | // Neither the not used symbol "-" nor omit is allowed in union value notations. |
4336 | |
4337 | module NegSem_060205_top_level_004 { |
4338 | type component GeneralComp { |
4339 | } |
4340 | |
4341 | type union U { |
4342 | integer option1, |
4343 | charstring option2 |
4344 | } |
4345 | |
4346 | testcase TC_NegSem_060205_top_level_004() runs on GeneralComp { |
4347 | var U v_choice := { option1 := omit }; |
4348 | if (ischosen(v_choice.option1) or ischosen(v_choice.option2)) { setverdict(pass); } |
4349 | else { setverdict(fail); } |
4350 | } |
4351 | |
4352 | control{ |
4353 | execute(TC_NegSem_060205_top_level_004()); |
4354 | } |
4355 | } |
4356 | <END_MODULE> |
4357 | |
4358 | <RESULT COUNT 1> |
4359 | error: `omit' value is not allowed in this context |
4360 | <END_RESULT> |
4361 | |
4362 | <END_TC> |
4363 | :exmp |
4364 | |
4365 | *---------------------------------------------------------------------* |
4366 | :h3. NegSem_060205_top_level_005 negative test |
4367 | .*---------------------------------------------------------------------* |
4368 | :xmp tab=0. |
4369 | |
4370 | <TC - value list notation used for union value definition > |
4371 | |
4372 | <COMPILE> |
4373 | |
4374 | <MODULE TTCN NegSem_060205_top_level_005 NegSem_060205_top_level_005.ttcn > |
4375 | /*************************************************** |
4376 | ** @version 0.0.1 |
4377 | ** @purpose 1:6.2.5, value list notation used for union value definition |
4378 | ** @verdict pass reject |
4379 | ***************************************************/ |
4380 | |
4381 | // The following requirement is tested: |
4382 | // The value list notation shall not be used for setting values of union types. |
4383 | |
4384 | module NegSem_060205_top_level_005 { |
4385 | type component GeneralComp { |
4386 | } |
4387 | |
4388 | type union U { |
4389 | integer option1 |
4390 | } |
4391 | |
4392 | testcase TC_NegSem_060205_top_level_005() runs on GeneralComp { |
4393 | var U v_choice := { 1 }; |
4394 | if (ischosen(v_choice.option1)) { setverdict(pass); } |
4395 | else { setverdict(fail); } |
4396 | } |
4397 | |
4398 | control{ |
4399 | execute(TC_NegSem_060205_top_level_005()); |
4400 | } |
4401 | } |
4402 | <END_MODULE> |
4403 | |
4404 | <RESULT COUNT 1> |
4405 | error: union value was expected for type `@NegSem_060205_top_level_005.U' |
4406 | <END_RESULT> |
4407 | |
4408 | <END_TC> |
4409 | :exmp |
4410 | |
4411 | *---------------------------------------------------------------------* |
4412 | :h3. NegSem_060205_top_level_005 negative test |
4413 | .*---------------------------------------------------------------------* |
4414 | :xmp tab=0. |
4415 | |
4416 | <TC - union type declaration with two equal identifiers > |
4417 | |
4418 | <COMPILE> |
4419 | |
4420 | <MODULE TTCN NegSyn_060205_top_level_001 NegSyn_060205_top_level_001.ttcn > |
4421 | /*************************************************** |
4422 | ** @version 0.0.1 |
4423 | ** @purpose 1:6.2.5, union type declaration with two equal identifiers |
4424 | ** @verdict pass reject |
4425 | ***************************************************/ |
4426 | |
4427 | // The following requirement is tested: |
4428 | // TTCN-3 supports the union type. The union type is a collection of alternatives, |
4429 | // each one identified by an identifier. Only one of the specified alternatives |
4430 | // will ever be present in an actual union value. Union types are useful to model |
4431 | // data which can take one of a finite number of known types. |
4432 | |
4433 | module NegSyn_060205_top_level_001 { |
4434 | type union U { |
4435 | integer option1, |
4436 | charstring option2, |
4437 | boolean option1 // error expected |
4438 | } |
4439 | } |
4440 | <END_MODULE> |
4441 | |
4442 | <RESULT COUNT 1> |
4443 | error: Duplicate union field name `option1' |
4444 | <END_RESULT> |
4445 | |
4446 | <END_TC> |
4447 | :exmp |
4448 | |
4449 | *---------------------------------------------------------------------* |
4450 | :h3. NegSem_06020501_referencing_fields_of_union_type_001 negative test |
4451 | .*---------------------------------------------------------------------* |
4452 | :xmp tab=0. |
4453 | |
4454 | <TC - unknown union alternative in value dot notation > |
4455 | |
4456 | <COMPILE> |
4457 | |
4458 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_001 NegSem_06020501_referencing_fields_of_union_type_001.ttcn > |
4459 | /*************************************************** |
4460 | ** @version 0.0.1 |
4461 | ** @purpose 1:6.2.5.1, unknown union alternative in value dot notation |
4462 | ** @verdict pass reject |
4463 | ***************************************************/ |
4464 | |
4465 | // The following requirement is tested: |
4466 | // Alternatives of a union type shall be referenced by the dot notation |
4467 | // TypeIdOrExpression.AlternativeId, where TypeIdOrExpression resolves to the name |
4468 | // of a union type or an expression of a union type such as variable, formal |
4469 | // parameter, module parameter, constant, template, or function invocation. |
4470 | // AlternativeId shall resolve to the name of an alternative in the union type. |
4471 | |
4472 | module NegSem_06020501_referencing_fields_of_union_type_001 { |
4473 | type component GeneralComp { |
4474 | } |
4475 | |
4476 | type union U { |
4477 | integer option1, |
4478 | charstring option2 |
4479 | } |
4480 | |
4481 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_001() runs on GeneralComp { |
4482 | var U v_union; |
4483 | v_union.option3 := 1; |
4484 | if (ischosen(v_union.option1) or ischosen(v_union.option2)) { setverdict(pass); } |
4485 | else { setverdict(fail); } |
4486 | } |
4487 | |
4488 | control{ |
4489 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_001()); |
4490 | } |
4491 | } |
4492 | <END_MODULE> |
4493 | |
4494 | <RESULT COUNT 1> |
4495 | error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_001.U' |
4496 | <END_RESULT> |
4497 | |
4498 | <END_TC> |
4499 | :exmp |
4500 | |
4501 | *---------------------------------------------------------------------* |
4502 | :h3. NegSem_06020501_referencing_fields_of_union_type_002 negative test |
4503 | .*---------------------------------------------------------------------* |
4504 | :xmp tab=0. |
4505 | |
4506 | <TC - unknown union alternative in extended type reference > |
4507 | |
4508 | <COMPILE> |
4509 | |
4510 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_002 NegSem_06020501_referencing_fields_of_union_type_002.ttcn > |
4511 | /*************************************************** |
4512 | ** @version 0.0.1 |
4513 | ** @purpose 1:6.2.5.1, unknown union alternative in extended type reference |
4514 | ** @verdict pass reject |
4515 | ***************************************************/ |
4516 | |
4517 | // The following requirement is tested: |
4518 | // Alternatives of a union type shall be referenced by the dot notation |
4519 | // TypeIdOrExpression.AlternativeId, where TypeIdOrExpression resolves to the name |
4520 | // of a union type or an expression of a union type such as variable, formal |
4521 | // parameter, module parameter, constant, template, or function invocation. |
4522 | // AlternativeId shall resolve to the name of an alternative in the union type. |
4523 | |
4524 | module NegSem_06020501_referencing_fields_of_union_type_002 { |
4525 | type component GeneralComp { |
4526 | } |
4527 | |
4528 | type union U { |
4529 | integer option1, |
4530 | charstring option2 |
4531 | } |
4532 | |
4533 | type U.option3 UnionItem; |
4534 | |
4535 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_002() runs on GeneralComp { |
4536 | var UnionItem v_val := 1; |
4537 | if (v_val == 1) { setverdict(pass); } |
4538 | else { setverdict(fail); } |
4539 | } |
4540 | |
4541 | control{ |
4542 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_002()); |
4543 | } |
4544 | } |
4545 | <END_MODULE> |
4546 | |
4547 | <RESULT COUNT 1> |
4548 | error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_002.U' |
4549 | <END_RESULT> |
4550 | |
4551 | <END_TC> |
4552 | :exmp |
4553 | |
4554 | *---------------------------------------------------------------------* |
4555 | :h3. NegSem_06020501_referencing_fields_of_union_type_003 negative test |
4556 | .*---------------------------------------------------------------------* |
4557 | :xmp tab=0. |
4558 | |
4559 | <TC - union alternative referencing itself > |
4560 | |
4561 | <COMPILE> |
4562 | |
4563 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_003 NegSem_06020501_referencing_fields_of_union_type_003.ttcn > |
4564 | /*************************************************** |
4565 | ** @version 0.0.1 |
4566 | ** @purpose 1:6.2.5.1, union alternative referencing itself |
4567 | ** @verdict pass reject |
4568 | ***************************************************/ |
4569 | |
4570 | // The following requirement is tested: |
4571 | // Alternatives of union type definitions shall not reference themselves. |
4572 | |
4573 | module NegSem_06020501_referencing_fields_of_union_type_003 { |
4574 | type component GeneralComp { |
4575 | } |
4576 | |
4577 | type union U { |
4578 | integer option1, |
4579 | U.option2 option2 |
4580 | } |
4581 | |
4582 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_003() runs on GeneralComp { |
4583 | var U v_union := { option1 := 1 }; |
4584 | if (v_union == { option1 := 1}) { setverdict(pass); } |
4585 | else { setverdict(fail); } |
4586 | } |
4587 | |
4588 | control{ |
4589 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_003()); |
4590 | } |
4591 | } |
4592 | <END_MODULE> |
4593 | |
4594 | <RESULT COUNT 1> |
4595 | error: While checking referenced type: Circular reference: `@NegSem_06020501_referencing_fields_of_union_type_003.U.option2' -> `@NegSem_06020501_referencing_fields_of_union_type_003.U.option2' |
4596 | <END_RESULT> |
4597 | |
4598 | <END_TC> |
4599 | :exmp |
4600 | |
4601 | *---------------------------------------------------------------------* |
4602 | :h3. NegSem_06020501_referencing_fields_of_union_type_004 negative test |
4603 | .*---------------------------------------------------------------------* |
4604 | :xmp tab=0. |
4605 | |
4606 | <TC - union alternative referencing indirectly itself > |
4607 | |
4608 | <COMPILE> |
4609 | |
4610 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_004 NegSem_06020501_referencing_fields_of_union_type_004.ttcn > |
4611 | /*************************************************** |
4612 | ** @version 0.0.1 |
4613 | ** @purpose 1:6.2.5.1, union alternative referencing indirectly itself |
4614 | ** @verdict pass reject |
4615 | ***************************************************/ |
4616 | |
4617 | // The following requirement is tested: |
4618 | // Alternatives of union type definitions shall not reference themselves. |
4619 | |
4620 | module NegSem_06020501_referencing_fields_of_union_type_004 { |
4621 | type component GeneralComp { |
4622 | } |
4623 | |
4624 | type union U { |
4625 | integer option1, |
4626 | U.option3 option2, |
4627 | U.option2 option3 |
4628 | } |
4629 | |
4630 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_004() runs on GeneralComp { |
4631 | var U v_union := { option1 := 1 }; |
4632 | if (v_union == { option1 := 1}) { setverdict(pass); } |
4633 | else { setverdict(fail); } |
4634 | } |
4635 | |
4636 | control{ |
4637 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_004()); |
4638 | } |
4639 | } |
4640 | <END_MODULE> |
4641 | |
4642 | <RESULT COUNT 1> |
4643 | error: While checking referenced type: Circular reference: `@NegSem_06020501_referencing_fields_of_union_type_004.U.option2' -> `@NegSem_06020501_referencing_fields_of_union_type_004.U.option3' -> `@NegSem_06020501_referencing_fields_of_union_type_004.U.option2' |
4644 | <END_RESULT> |
4645 | |
4646 | <END_TC> |
4647 | :exmp |
4648 | |
4649 | *---------------------------------------------------------------------* |
4650 | :h3. NegSem_06020501_referencing_fields_of_union_type_005 negative test |
4651 | .*---------------------------------------------------------------------* |
4652 | :xmp tab=0. |
4653 | |
4654 | <TC - union alternative costraint passed through extended type reference > |
4655 | |
4656 | <COMPILE> |
4657 | |
4658 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_005 NegSem_06020501_referencing_fields_of_union_type_005.ttcn > |
4659 | /*************************************************** |
4660 | ** @version 0.0.1 |
4661 | ** @purpose 1:6.2.5.1, union alternative costraint passed through extended type reference |
4662 | ** @verdict pass reject |
4663 | ***************************************************/ |
4664 | |
4665 | // The following requirement is tested: |
4666 | // If an alternative in a union type or a subtype of a union type is referenced by |
4667 | // the dot notation, the resulting type is the set of values allowed for that |
4668 | // alternative imposed by the constraints of the alternative declaration itself |
4669 | // (i.e. any constraints applied to the union type itself are ignored). |
4670 | |
4671 | module NegSem_06020501_referencing_fields_of_union_type_005 { |
4672 | type component GeneralComp { |
4673 | } |
4674 | |
4675 | type union U { |
4676 | integer option1 (1..10), |
4677 | charstring option2 |
4678 | } |
4679 | |
4680 | type U.option1 UnionItem; |
4681 | |
4682 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_005() runs on GeneralComp { |
4683 | var UnionItem v_val := 100; |
4684 | if (v_val == 100) { setverdict(pass); } |
4685 | else { setverdict(fail); } |
4686 | } |
4687 | |
4688 | control{ |
4689 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_005()); |
4690 | } |
4691 | } |
4692 | <END_MODULE> |
4693 | |
4694 | <RESULT COUNT 1> |
4695 | error: 100 is not a valid value for type `integer' which has subtype \(1..10\) |
4696 | <END_RESULT> |
4697 | |
4698 | <END_TC> |
4699 | :exmp |
4700 | |
4701 | *---------------------------------------------------------------------* |
4702 | :h3. NegSem_06020501_referencing_fields_of_union_type_006 negative test |
4703 | .*---------------------------------------------------------------------* |
4704 | :xmp tab=0. |
4705 | |
4706 | <TC - referencing not chosen alternative on right hand side of assignment > |
4707 | |
4708 | <COMPILE> |
4709 | <EXECUTE_PARALLEL> |
4710 | |
4711 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_006 NegSem_06020501_referencing_fields_of_union_type_006.ttcn > |
4712 | /*************************************************** |
4713 | ** @version 0.0.1 |
4714 | ** @purpose 1:6.2.5.1, referencing not chosen alternative on right hand side of assignment |
4715 | ** @verdict pass reject |
4716 | ***************************************************/ |
4717 | |
4718 | // The following requirement is tested: |
4719 | // When an alternative of a union type is referenced on the right hand side of |
4720 | // an assignment an error shall occur if the referenced alternative is not the |
4721 | // currently chosen alternative or if the referenced union field or value is omitted |
4722 | // or uninitialized. |
4723 | |
4724 | module NegSem_06020501_referencing_fields_of_union_type_006 { |
4725 | type component GeneralComp { |
4726 | } |
4727 | |
4728 | type union U { |
4729 | integer option1, |
4730 | charstring option2 |
4731 | } |
4732 | |
4733 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_006() runs on GeneralComp { |
4734 | var U v_union := { option1 := 1 }; |
4735 | if (v_union.option2 != "test") { setverdict(pass); } |
4736 | else { setverdict(fail); } |
4737 | } |
4738 | |
4739 | control{ |
4740 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_006()); |
4741 | } |
4742 | } |
4743 | <END_MODULE> |
4744 | |
4745 | <RESULT COUNT 1> |
4746 | Dynamic test case error: Using non-selected field option2 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_006.U. |
4747 | <END_RESULT> |
4748 | |
4749 | <END_TC> |
4750 | :exmp |
4751 | |
4752 | *---------------------------------------------------------------------* |
4753 | :h3. NegSem_06020501_referencing_fields_of_union_type_007 negative test |
4754 | .*---------------------------------------------------------------------* |
4755 | :xmp tab=0. |
4756 | |
4757 | <TC - referencing not chosen alternative on right hand side of assignment > |
4758 | |
4759 | <COMPILE> |
4760 | <EXECUTE_PARALLEL> |
4761 | |
4762 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_007 NegSem_06020501_referencing_fields_of_union_type_007.ttcn > |
4763 | /*************************************************** |
4764 | ** @version 0.0.1 |
4765 | ** @purpose 1:6.2.5.1, referencing alternative of uninitialized union on right hand side of assignment |
4766 | ** @verdict pass reject |
4767 | ***************************************************/ |
4768 | |
4769 | // The following requirement is tested: |
4770 | // When an alternative of a union type is referenced on the right hand side of |
4771 | // an assignment an error shall occur if the referenced alternative is not the |
4772 | // currently chosen alternative or if the referenced union field or value is omitted |
4773 | // or uninitialized. |
4774 | |
4775 | module NegSem_06020501_referencing_fields_of_union_type_007 { |
4776 | type component GeneralComp { |
4777 | } |
4778 | |
4779 | type union U { |
4780 | integer option1, |
4781 | charstring option2 |
4782 | } |
4783 | |
4784 | type record R { |
4785 | integer field1, |
4786 | U field2 |
4787 | } |
4788 | |
4789 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_007() runs on GeneralComp { |
4790 | var R v_rec; |
4791 | v_rec.field1 := 5; |
4792 | if (v_rec.field2.option1 != 100) { setverdict(pass); } |
4793 | else { setverdict(fail); } |
4794 | } |
4795 | |
4796 | control{ |
4797 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_007()); |
4798 | } |
4799 | } |
4800 | <END_MODULE> |
4801 | |
4802 | <RESULT COUNT 1> |
4803 | Dynamic test case error: Using non-selected field option1 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_007.U. |
4804 | <END_RESULT> |
4805 | |
4806 | <END_TC> |
4807 | :exmp |
4808 | |
4809 | *---------------------------------------------------------------------* |
4810 | :h3. NegSem_06020501_referencing_fields_of_union_type_008 negative test |
4811 | .*---------------------------------------------------------------------* |
4812 | :xmp tab=0. |
4813 | |
4814 | <TC - referencing alternative of omitted union on right hand side of assignment > |
4815 | |
4816 | <COMPILE> |
4817 | <EXECUTE_PARALLEL> |
4818 | |
4819 | <MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_008 NegSem_06020501_referencing_fields_of_union_type_008.ttcn > |
4820 | /*************************************************** |
4821 | ** @version 0.0.1 |
4822 | ** @purpose 1:6.2.5.1, referencing alternative of omitted union on right hand side of assignment |
4823 | ** @verdict pass reject |
4824 | ***************************************************/ |
4825 | |
4826 | // The following requirement is tested: |
4827 | // When an alternative of a union type is referenced on the right hand side of |
4828 | // an assignment an error shall occur if the referenced alternative is not the |
4829 | // currently chosen alternative or if the referenced union field or value is omitted |
4830 | // or uninitialized. |
4831 | |
4832 | module NegSem_06020501_referencing_fields_of_union_type_008 { |
4833 | type component GeneralComp { |
4834 | } |
4835 | |
4836 | type union U { |
4837 | integer option1, |
4838 | charstring option2 |
4839 | } |
4840 | |
4841 | type record R { |
4842 | integer field1, |
4843 | U field2 optional |
4844 | } |
4845 | |
4846 | testcase TC_NegSem_06020501_referencing_fields_of_union_type_008() runs on GeneralComp { |
4847 | var R v_rec; |
4848 | v_rec.field1 := 5; |
4849 | v_rec.field2 := omit; |
4850 | if (v_rec.field2.option1 != 100) { setverdict(pass); } |
4851 | else { setverdict(fail); } |
4852 | } |
4853 | |
4854 | control{ |
4855 | execute(TC_NegSem_06020501_referencing_fields_of_union_type_008()); |
4856 | } |
4857 | } |
4858 | <END_MODULE> |
4859 | |
4860 | <RESULT COUNT 1> |
4861 | Dynamic test case error: Using the value of an optional field containing omit. |
4862 | <END_RESULT> |
4863 | |
4864 | <END_TC> |
4865 | :exmp |
4866 | |
4867 | *---------------------------------------------------------------------* |
4868 | :h3. NegSyn_06020502_option_and_union_001 negative test |
4869 | .*---------------------------------------------------------------------* |
4870 | :xmp tab=0. |
4871 | |
4872 | <TC - referencing alternative of omitted union on right hand side of assignment > |
4873 | |
4874 | <COMPILE> |
4875 | |
4876 | <MODULE TTCN NegSyn_06020502_option_and_union_001 NegSyn_06020502_option_and_union_001.ttcn > |
4877 | /*************************************************** |
4878 | ** @version 0.0.1 |
4879 | ** @purpose 1:6.2.5.2, referencing alternative on left hand side of assignment |
4880 | ** @verdict pass reject |
4881 | ***************************************************/ |
4882 | |
4883 | // The following requirement is tested: |
4884 | // Optional fields are not allowed for the union type, which means that the optional |
4885 | // keyword shall not be used with union types. |
4886 | |
4887 | module NegSyn_06020502_option_and_union_001 { |
4888 | type union U { |
4889 | integer option1, |
4890 | charstring option2 optional |
4891 | } |
4892 | } |
4893 | <END_MODULE> |
4894 | |
4895 | <RESULT COUNT 1> |
4896 | error: at or before token `optional': syntax error, unexpected OptionalKeyword, expecting '\}' or ',' |
4897 | <END_RESULT> |
4898 | |
4899 | <END_TC> |
4900 | :exmp |
4901 | |
4902 | *---------------------------------------------------------------------* |
4903 | :h3. NegSem_060206_anytype_001 negative test |
4904 | .*---------------------------------------------------------------------* |
4905 | :xmp tab=0. |
4906 | |
4907 | <TC - ensure that after redeclaration of an anytype value the old type and value are lost > |
4908 | |
4909 | <COMPILE> |
4910 | <EXECUTE_PARALLEL> |
4911 | |
4912 | <MODULE TTCN NegSem_060206_anytype_001 NegSem_060206_anytype_001.ttcn > |
4913 | /**************************************************** |
4914 | ** @version 0.0.1 |
4915 | ** @purpose 1:6.2.0.6, ensure that after redeclaration of an anytype value the old type and value are lost |
4916 | ** @verdict pass reject |
4917 | ***************************************************/ |
4918 | module NegSem_060206_anytype_001 { |
4919 | |
4920 | type component GeneralComp { |
4921 | var anytype Var1, Var2; |
4922 | } |
4923 | |
4924 | testcase TC_NegSem_060206_anytype_001() runs on GeneralComp { |
4925 | |
4926 | Var1.integer := 10; |
4927 | Var2.float := 3.0E0; |
4928 | |
4929 | Var1.float := 5.5E0; |
4930 | Var2.charstring := "abc"; // the new type of Var2 is charstring instead of float |
4931 | |
4932 | if ( match(Var1.integer, 10) and match(Var2.float, 3.0E0)) { |
4933 | setverdict(pass); |
4934 | } |
4935 | else { |
4936 | setverdict(fail); |
4937 | } |
4938 | |
4939 | } |
4940 | |
4941 | control { |
4942 | execute(TC_NegSem_060206_anytype_001()); |
4943 | } |
4944 | |
4945 | } |
4946 | with { |
4947 | extension "anytype integer, float, charstring" |
4948 | } |
4949 | <END_MODULE> |
4950 | |
4951 | <RESULT COUNT 1> |
4952 | Dynamic test case error: Using non-selected field integer in a value of union type @NegSem_060206_anytype_001.anytype |
4953 | <END_RESULT> |
4954 | |
4955 | <END_TC> |
4956 | :exmp |
4957 | |
4958 | *---------------------------------------------------------------------* |
4959 | :h3. NegSem_060206_anytype_002 negative test |
4960 | .*---------------------------------------------------------------------* |
4961 | :xmp tab=0. |
4962 | |
4963 | <TC - Ensure that anytype can not be address type if not explicitly declareted in the module > |
4964 | |
4965 | <COMPILE> |
4966 | |
4967 | <MODULE TTCN NegSem_060206_anytype_002 NegSem_060206_anytype_002.ttcn > |
4968 | /**************************************************** |
4969 | ** @version 0.0.1 |
4970 | ** @purpose 1:6.2.0.6, Ensure that anytype can not be address type if not explicitly declareted in the module |
4971 | ** @verdict pass reject |
4972 | ***************************************************/ |
4973 | module NegSem_060206_anytype_002 { |
4974 | |
4975 | type component GeneralComp { |
4976 | |
4977 | var anytype x; |
4978 | } |
4979 | |
4980 | testcase TC_NegSem_060206_anytype_002() runs on GeneralComp { |
4981 | |
4982 | x.address:=10; // error: address type is not declarated in the module explicitly |
4983 | |
4984 | |
4985 | if (x.address==10) { |
4986 | setverdict(pass); |
4987 | } |
4988 | else { |
4989 | setverdict(fail); |
4990 | } |
4991 | |
4992 | } |
4993 | |
4994 | control { |
4995 | execute(TC_NegSem_060206_anytype_002()); |
4996 | } |
4997 | |
4998 | } |
4999 | with { |
5000 | extension "anytype address" |
5001 | } |
5002 | <END_MODULE> |
5003 | |
5004 | <RESULT COUNT 1> |
5005 | error: Type `address' is not defined in this module |
5006 | <END_RESULT> |
5007 | |
5008 | <END_TC> |
5009 | :exmp |
5010 | |
5011 | *---------------------------------------------------------------------* |
5012 | :h3. NegSem_060206_anytype_002 negative test |
5013 | .*---------------------------------------------------------------------* |
5014 | :xmp tab=0. |
5015 | |
5016 | <TC - ensure that anytype cannot be port type > |
5017 | |
5018 | <COMPILE> |
5019 | |
5020 | <MODULE TTCN NegSem_060206_anytype_002 NegSem_060206_anytype_002.ttcn > |
5021 | /**************************************************** |
5022 | ** @version 0.0.1 |
5023 | ** @purpose 1:6.2.0.6, ensure that anytype cannot be port type |
5024 | ** @verdict pass reject |
5025 | ***************************************************/ |
5026 | |
5027 | module NegSyn_060206_anytype_002 { |
5028 | |
5029 | type port MyPort message{ |
5030 | //address integer; |
5031 | inout integer; |
5032 | } with {extension "internal"} |
5033 | |
5034 | type component GeneralComp { |
5035 | var anytype x; |
5036 | port MyPort PCO1; |
5037 | } |
5038 | |
5039 | testcase TC_NegSyn_060206_anytype_002() runs on GeneralComp { |
5040 | |
5041 | x.MyPort:= PCO1; // port type is not allowed with anytype |
5042 | |
5043 | } |
5044 | |
5045 | control { |
5046 | execute(TC_NegSyn_060206_anytype_002()); |
5047 | } |
5048 | |
5049 | } |
5050 | with { |
5051 | extension "anytype MyPort" |
5052 | } |
5053 | <END_MODULE> |
5054 | |
5055 | <RESULT COUNT 1> |
5056 | error: Port type `@NegSyn_060206_anytype_002.MyPort' cannot be embedded into another type |
5057 | <END_RESULT> |
5058 | <RESULT COUNT 1> |
5059 | error: Reference to a value was expected instead of port `@NegSyn_060206_anytype_002.GeneralComp.PCO1' |
5060 | <END_RESULT> |
5061 | |
5062 | <END_TC> |
5063 | :exmp |
5064 | |
5065 | *---------------------------------------------------------------------* |
5066 | :h3. NegSem_060207_arrays_001 negative test |
5067 | .*---------------------------------------------------------------------* |
5068 | :xmp tab=0. |
5069 | |
5070 | <TC - ensure that the value limitation is correctly handled within array > |
5071 | |
5072 | <COMPILE> |
5073 | |
5074 | <MODULE TTCN NegSem_060207_arrays_001 NegSem_060207_arrays_001.ttcn > |
5075 | /*************************************************** |
5076 | ** @version 0.0.1 |
5077 | ** @purpose 1:6.2.7, ensure that the value limitation is correctly handled within array |
5078 | ** @verdict pass reject |
5079 | ***************************************************/ |
5080 | module NegSem_060207_arrays_001 { |
5081 | |
5082 | type component GeneralComp { |
5083 | } |
5084 | |
5085 | type integer MyArrayType1[5] (1 .. 10); |
5086 | |
5087 | testcase TC_NegSem_060207_arrays_001() runs on GeneralComp { |
5088 | |
5089 | var MyArrayType1 v_array1 := { 8, 11, 2, 3, 4}; |
5090 | // syntax error expected, value shall be between 1..10 |
5091 | |
5092 | } |
5093 | |
5094 | control { |
5095 | execute(TC_NegSem_060207_arrays_001()); |
5096 | } |
5097 | |
5098 | } |
5099 | <END_MODULE> |
5100 | |
5101 | <RESULT COUNT 1> |
5102 | error: 11 is not a valid value for type `integer' which has subtype \(1..10\) |
5103 | <END_RESULT> |
5104 | |
5105 | <END_TC> |
5106 | :exmp |
5107 | |
5108 | *---------------------------------------------------------------------* |
5109 | :h3. NegSem_060207_arrays_002 negative test |
5110 | .*---------------------------------------------------------------------* |
5111 | :xmp tab=0. |
5112 | |
5113 | <TC - ensure that the inner type referencing is correctly handled > |
5114 | |
5115 | <COMPILE> |
5116 | |
5117 | <MODULE TTCN NegSem_060207_arrays_002 NegSem_060207_arrays_002.ttcn > |
5118 | /*************************************************** |
5119 | ** @version 0.0.1 |
5120 | ** @purpose 1:6.2.7, ensure that the inner type referencing is correctly handled |
5121 | ** @verdict pass reject |
5122 | ***************************************************/ |
5123 | module NegSem_060207_arrays_002 { |
5124 | |
5125 | type component GeneralComp { |
5126 | } |
5127 | |
5128 | type integer MyArrayType1[5] (1 .. 10); |
5129 | |
5130 | testcase TC_NegSem_060207_arrays_002() runs on GeneralComp { |
5131 | |
5132 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4, 5, 6}; |
5133 | // array is longer than the restricted length |
5134 | |
5135 | } |
5136 | |
5137 | control { |
5138 | execute(TC_NegSem_060207_arrays_002()); |
5139 | } |
5140 | |
5141 | } |
5142 | <END_MODULE> |
5143 | |
5144 | <RESULT COUNT 1> |
5145 | error: Too many elements in the array value: 5 was expected instead of 7 |
5146 | <END_RESULT> |
5147 | |
5148 | <END_TC> |
5149 | :exmp |
5150 | |
5151 | *---------------------------------------------------------------------* |
5152 | :h3. NegSem_060207_arrays_003 negative test |
5153 | .*---------------------------------------------------------------------* |
5154 | :xmp tab=0. |
5155 | |
5156 | <TC - negative index applied to an array on the right hand side of an assignment > |
5157 | |
5158 | <COMPILE> |
5159 | |
5160 | <MODULE TTCN NegSem_060207_arrays_003 NegSem_060207_arrays_003.ttcn > |
5161 | /*************************************************** |
5162 | ** @version 0.0.1 |
5163 | ** @purpose 1:6.2.7, negative index applied to an array on the right hand side of an assignment |
5164 | ** @verdict pass reject |
5165 | ***************************************************/ |
5166 | |
5167 | // The following requirement is tested: |
5168 | // Indexed value notation can be used on both the right-hand side and left-hand |
5169 | // side of assignments. The index of the first element shall be zero or the lower |
5170 | // bound if an index range has been given. |
5171 | |
5172 | module NegSem_060207_arrays_003 { |
5173 | |
5174 | type component GeneralComp { |
5175 | } |
5176 | |
5177 | type integer MyArrayType1[5] (1 .. 10); |
5178 | |
5179 | testcase TC_NegSem_060207_arrays_003() runs on GeneralComp { |
5180 | |
5181 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5182 | var integer i := v_array1[-1]; // error expected |
5183 | setverdict(pass); |
5184 | } |
5185 | |
5186 | control { |
5187 | execute(TC_NegSem_060207_arrays_003()); |
5188 | } |
5189 | |
5190 | } |
5191 | <END_MODULE> |
5192 | |
5193 | <RESULT COUNT 1> |
5194 | error: Array index underflow: the index value must be at least `0' instead of `-1' |
5195 | <END_RESULT> |
5196 | |
5197 | <END_TC> |
5198 | :exmp |
5199 | |
5200 | *---------------------------------------------------------------------* |
5201 | :h3. NegSem_060207_arrays_004 negative test |
5202 | .*---------------------------------------------------------------------* |
5203 | :xmp tab=0. |
5204 | |
5205 | <TC - negative index applied to an array on the left hand side of an assignment > |
5206 | |
5207 | <COMPILE> |
5208 | |
5209 | <MODULE TTCN NegSem_060207_arrays_004 NegSem_060207_arrays_004.ttcn > |
5210 | /*************************************************** |
5211 | ** @version 0.0.1 |
5212 | ** @purpose 1:6.2.7, negative index applied to an array on the left hand side of an assignment |
5213 | ** @verdict pass reject |
5214 | ***************************************************/ |
5215 | |
5216 | // The following requirement is tested: |
5217 | // Indexed value notation can be used on both the right-hand side and left-hand |
5218 | // side of assignments. The index of the first element shall be zero or the lower |
5219 | // bound if an index range has been given. |
5220 | |
5221 | module NegSem_060207_arrays_004 { |
5222 | |
5223 | type component GeneralComp { |
5224 | } |
5225 | |
5226 | type integer MyArrayType1[5] (1 .. 10); |
5227 | |
5228 | testcase TC_NegSem_060207_arrays_004() runs on GeneralComp { |
5229 | |
5230 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5231 | v_array1[-1] := 10; // error expected |
5232 | setverdict(pass); |
5233 | } |
5234 | |
5235 | control { |
5236 | execute(TC_NegSem_060207_arrays_004()); |
5237 | } |
5238 | |
5239 | } |
5240 | <END_MODULE> |
5241 | |
5242 | <RESULT COUNT 1> |
5243 | error: Array index underflow: the index value must be at least `0' instead of `-1' |
5244 | <END_RESULT> |
5245 | |
5246 | <END_TC> |
5247 | :exmp |
5248 | |
5249 | *---------------------------------------------------------------------* |
5250 | :h3. NegSem_060207_arrays_005 negative test |
5251 | .*---------------------------------------------------------------------* |
5252 | :xmp tab=0. |
5253 | |
5254 | <TC - wrong index type applied to an array on the right hand side of an assignment > |
5255 | |
5256 | <COMPILE> |
5257 | |
5258 | <MODULE TTCN NegSem_060207_arrays_005 NegSem_060207_arrays_005.ttcn > |
5259 | /*************************************************** |
5260 | ** @version 0.0.1 |
5261 | ** @purpose 1:6.2.7, wrong index type applied to an array on the right hand side of an assignment |
5262 | ** @verdict pass reject |
5263 | ***************************************************/ |
5264 | |
5265 | // The following requirement is tested: |
5266 | // Indexed value notation can be used on both the right-hand side and left-hand |
5267 | // side of assignments. The index of the first element shall be zero or the lower |
5268 | // bound if an index range has been given. |
5269 | // [from 3.1] index notation: notation to access individual elements of record of, |
5270 | // set of, array and string values or templates, where the element to be accessed |
5271 | // is identified explicitly by an index value enclosed in square brackets ("[" and |
5272 | // "]") which specifies the position of that element within the referenced value |
5273 | // or template and the index value is either an integer value, array of integers |
5274 | // or record of integers. |
5275 | |
5276 | module NegSem_060207_arrays_005 { |
5277 | |
5278 | type component GeneralComp { |
5279 | } |
5280 | |
5281 | type integer MyArrayType1[5] (1 .. 10); |
5282 | |
5283 | testcase TC_NegSem_060207_arrays_005() runs on GeneralComp { |
5284 | |
5285 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5286 | var integer i := v_array1["0"]; // error expected |
5287 | setverdict(pass); |
5288 | } |
5289 | |
5290 | control { |
5291 | execute(TC_NegSem_060207_arrays_005()); |
5292 | } |
5293 | |
5294 | } |
5295 | <END_MODULE> |
5296 | |
5297 | <RESULT COUNT 1> |
5298 | error: A value or expression of type integer was expected |
5299 | <END_RESULT> |
5300 | |
5301 | <END_TC> |
5302 | :exmp |
5303 | |
5304 | *---------------------------------------------------------------------* |
5305 | :h3. NegSem_060207_arrays_006 negative test |
5306 | .*---------------------------------------------------------------------* |
5307 | :xmp tab=0. |
5308 | |
5309 | <TC - wrong index type applied to an array on the left hand side of an assignment > |
5310 | |
5311 | <COMPILE> |
5312 | |
5313 | <MODULE TTCN NegSem_060207_arrays_006 NegSem_060207_arrays_006.ttcn > |
5314 | /*************************************************** |
5315 | ** @version 0.0.1 |
5316 | ** @purpose 1:6.2.7, wrong index type applied to an array on the left hand side of an assignment |
5317 | ** @verdict pass reject |
5318 | ***************************************************/ |
5319 | |
5320 | // The following requirement is tested: |
5321 | // Indexed value notation can be used on both the right-hand side and left-hand |
5322 | // side of assignments. The index of the first element shall be zero or the lower |
5323 | // bound if an index range has been given. |
5324 | // [from 3.1] index notation: notation to access individual elements of record of, |
5325 | // set of, array and string values or templates, where the element to be accessed |
5326 | // is identified explicitly by an index value enclosed in square brackets ("[" and |
5327 | // "]") which specifies the position of that element within the referenced value |
5328 | // or template and the index value is either an integer value, array of integers |
5329 | // or record of integers. |
5330 | |
5331 | module NegSem_060207_arrays_006 { |
5332 | |
5333 | type component GeneralComp { |
5334 | } |
5335 | |
5336 | type integer MyArrayType1[5] (1 .. 10); |
5337 | |
5338 | testcase TC_NegSem_060207_arrays_006() runs on GeneralComp { |
5339 | |
5340 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5341 | v_array1["0"] := 10; // error expected |
5342 | setverdict(pass); |
5343 | } |
5344 | |
5345 | control { |
5346 | execute(TC_NegSem_060207_arrays_006()); |
5347 | } |
5348 | |
5349 | } |
5350 | <END_MODULE> |
5351 | |
5352 | <RESULT COUNT 1> |
5353 | error: A value or expression of type integer was expected |
5354 | <END_RESULT> |
5355 | |
5356 | <END_TC> |
5357 | :exmp |
5358 | |
5359 | *---------------------------------------------------------------------* |
5360 | :h3. NegSem_060207_arrays_007 negative test |
5361 | .*---------------------------------------------------------------------* |
5362 | :xmp tab=0. |
5363 | |
5364 | <TC - array index greater than the upper bound (left-hand side) > |
5365 | |
5366 | <COMPILE> |
5367 | |
5368 | <MODULE TTCN NegSem_060207_arrays_007 NegSem_060207_arrays_007.ttcn > |
5369 | /*************************************************** |
5370 | ** @version 0.0.1 |
5371 | ** @purpose 1:6.2.7, array index greater than the upper bound (left-hand side) |
5372 | ** @verdict pass reject |
5373 | ***************************************************/ |
5374 | |
5375 | // The following requirement is tested: |
5376 | // The index shall not exceed the limitations given by either the length or the |
5377 | // upper bound of the index. |
5378 | |
5379 | module NegSem_060207_arrays_007 { |
5380 | |
5381 | type component GeneralComp { |
5382 | } |
5383 | |
5384 | type integer MyArrayType1[5] (1 .. 10); |
5385 | |
5386 | testcase TC_NegSem_060207_arrays_007() runs on GeneralComp { |
5387 | |
5388 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5389 | v_array1[5] := 3; // error expected |
5390 | setverdict(pass); |
5391 | } |
5392 | |
5393 | control { |
5394 | execute(TC_NegSem_060207_arrays_007()); |
5395 | } |
5396 | |
5397 | } |
5398 | <END_MODULE> |
5399 | |
5400 | <RESULT COUNT 1> |
5401 | error: Array index overflow: the index value must be at most `4' instead of `5' |
5402 | <END_RESULT> |
5403 | |
5404 | <END_TC> |
5405 | :exmp |
5406 | |
5407 | *---------------------------------------------------------------------* |
5408 | :h3. NegSem_060207_arrays_008 negative test |
5409 | .*---------------------------------------------------------------------* |
5410 | :xmp tab=0. |
5411 | |
5412 | <TC - wrong index type applied to an array on the right hand side of an assignment > |
5413 | |
5414 | <COMPILE> |
5415 | |
5416 | <MODULE TTCN NegSem_060207_arrays_008 NegSem_060207_arrays_008.ttcn > |
5417 | /*************************************************** |
5418 | ** @version 0.0.1 |
5419 | ** @purpose 1:6.2.7, wrong index type applied to an array on the right hand side of an assignment |
5420 | ** @verdict pass reject |
5421 | ***************************************************/ |
5422 | |
5423 | // The following requirement is tested: |
5424 | // The index shall not exceed the limitations given by either the length or the |
5425 | // upper bound of the index. |
5426 | |
5427 | module NegSem_060207_arrays_008 { |
5428 | |
5429 | type component GeneralComp { |
5430 | } |
5431 | |
5432 | type integer MyArrayType1[5] (1 .. 10); |
5433 | |
5434 | testcase TC_NegSem_060207_arrays_008() runs on GeneralComp { |
5435 | |
5436 | var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; |
5437 | var integer i := v_array1[5]; // error expected |
5438 | setverdict(pass); |
5439 | } |
5440 | |
5441 | control { |
5442 | execute(TC_NegSem_060207_arrays_008()); |
5443 | } |
5444 | |
5445 | } |
5446 | <END_MODULE> |
5447 | |
5448 | <RESULT COUNT 1> |
5449 | error: Array index overflow: the index value must be at most `4' instead of `5' |
5450 | <END_RESULT> |
5451 | |
5452 | <END_TC> |
5453 | :exmp |
5454 | |
5455 | *---------------------------------------------------------------------* |
5456 | :h3. NegSem_060207_arrays_009 negative test |
5457 | .*---------------------------------------------------------------------* |
5458 | :xmp tab=0. |
5459 | |
5460 | <TC - verify than an error is generated when sending a partially initialized array > |
5461 | |
5462 | <COMPILE> |
5463 | <EXECUTE_PARALLEL> |
5464 | |
5465 | <MODULE TTCN NegSem_060207_arrays_009 NegSem_060207_arrays_009.ttcn > |
5466 | /*************************************************** |
5467 | ** @version 0.0.1 |
5468 | ** @purpose 1:6.2.7, verify than an error is generated when sending a partially initialized array |
5469 | ** @verdict pass reject |
5470 | ***************************************************/ |
5471 | |
5472 | // The following requirement is tested: |
5473 | // Sending an array value with undefined elements shall cause an error. |
5474 | |
5475 | module NegSem_060207_arrays_009 { |
5476 | |
5477 | type integer MyArrayType1[5] (1 .. 10); |
5478 | |
5479 | type port P message { |
5480 | inout MyArrayType1 |
5481 | } with {extension "internal"} |
5482 | |
5483 | type component GeneralComp { |
5484 | port P p |
5485 | } |
5486 | |
5487 | testcase TC_NegSem_060207_arrays_009() runs on GeneralComp { |
5488 | var template MyArrayType1 m_array1 := { 8, 9, -, 3, 4}; |
5489 | p.send(m_array1); // error expected |
5490 | setverdict(pass); |
5491 | } |
5492 | |
5493 | control{ |
5494 | execute(TC_NegSem_060207_arrays_009()); |
5495 | } |
5496 | } |
5497 | <END_MODULE> |
5498 | |
5499 | <RESULT COUNT 1> |
5500 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. |
5501 | <END_RESULT> |
5502 | |
5503 | <END_TC> |
5504 | :exmp |
5505 | |
5506 | *---------------------------------------------------------------------* |
5507 | :h3. NegSem_060207_arrays_010 negative test |
5508 | .*---------------------------------------------------------------------* |
5509 | :xmp tab=0. |
5510 | |
5511 | <TC - ensure that the value limitation is correctly handled within array > |
5512 | |
5513 | <COMPILE> |
5514 | |
5515 | <MODULE TTCN NegSem_060207_arrays_010 NegSem_060207_arrays_010.ttcn > |
5516 | /*************************************************** |
5517 | ** @version 0.0.1 |
5518 | ** @purpose 1:6.2.7, ensure that the value limitation is correctly handled within array |
5519 | ** @verdict pass reject |
5520 | ***************************************************/ |
5521 | |
5522 | // The following requirement is tested: |
5523 | // The values of array elements shall be compatible with the corresponding |
5524 | // variable or type declaration. |
5525 | |
5526 | module NegSem_060207_arrays_010 { |
5527 | |
5528 | type component GeneralComp { |
5529 | } |
5530 | |
5531 | type integer MyArrayType1[5] (1 .. 10); |
5532 | |
5533 | testcase TC_NegSem_060207_arrays_010() runs on GeneralComp { |
5534 | |
5535 | var MyArrayType1 v_array1 := { |
5536 | [0] := 8, |
5537 | [1] := 0,// error expected, value shall be between 1..10 |
5538 | [2] := 2, |
5539 | [3] := 3, |
5540 | [4] := 4 |
5541 | }; |
5542 | |
5543 | } |
5544 | |
5545 | control { |
5546 | execute(TC_NegSem_060207_arrays_010()); |
5547 | } |
5548 | |
5549 | } |
5550 | <END_MODULE> |
5551 | |
5552 | <RESULT COUNT 1> |
5553 | error: 0 is not a valid value for type `integer' which has subtype \(1..10\) |
5554 | <END_RESULT> |
5555 | |
5556 | <END_TC> |
5557 | :exmp |
5558 | |
5559 | *---------------------------------------------------------------------* |
5560 | :h3. NegSem_060207_arrays_011 negative test |
5561 | .*---------------------------------------------------------------------* |
5562 | :xmp tab=0. |
5563 | |
5564 | <TC - runtime resolved constant in array type declaration > |
5565 | |
5566 | <COMPILE> |
5567 | |
5568 | <MODULE TTCN NegSem_060207_arrays_011 NegSem_060207_arrays_011.ttcn > |
5569 | /*************************************************** |
5570 | ** @version 0.0.1 |
5571 | ** @purpose 1:6.2.7, runtime resolved constant in array type declaration |
5572 | ** @verdict pass reject |
5573 | ***************************************************/ |
5574 | |
5575 | // The following requirement is tested: |
5576 | // Array dimensions shall be specified using constant expressions, which shall |
5577 | // evaluate to a positive integer values. Constants used in the constant |
5578 | // expressions shall meet with the restrictions in clause 10. |
5579 | |
5580 | module NegSem_060207_arrays_011 { |
5581 | |
5582 | type component GeneralComp { |
5583 | } |
5584 | |
5585 | function f() return integer { |
5586 | if (rnd() < 0.5) { return 5; } |
5587 | else { return 10; } |
5588 | } |
5589 | |
5590 | const integer c_dimension := f(); |
5591 | type integer Arr[c_dimension]; |
5592 | |
5593 | testcase TC_NegSem_060207_arrays_011() runs on GeneralComp { |
5594 | var Arr v_arr; |
5595 | v_arr[0] := 1; |
5596 | setverdict(pass); |
5597 | } |
5598 | |
5599 | control { |
5600 | execute(TC_NegSem_060207_arrays_011()); |
5601 | } |
5602 | |
5603 | } |
5604 | <END_MODULE> |
5605 | |
5606 | <RESULT COUNT 1> |
5607 | error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_011.f' |
5608 | <END_RESULT> |
5609 | |
5610 | <END_TC> |
5611 | :exmp |
5612 | |
5613 | *---------------------------------------------------------------------* |
5614 | :h3. NegSem_060207_arrays_012 negative test |
5615 | .*---------------------------------------------------------------------* |
5616 | :xmp tab=0. |
5617 | |
5618 | <TC - runtime resolved constant in array variable declaration > |
5619 | |
5620 | <COMPILE> |
5621 | |
5622 | <MODULE TTCN NegSem_060207_arrays_012 NegSem_060207_arrays_012.ttcn > |
5623 | /*************************************************** |
5624 | ** @version 0.0.1 |
5625 | ** @purpose 1:6.2.7, runtime resolved constant in array variable declaration |
5626 | ** @verdict pass reject |
5627 | ***************************************************/ |
5628 | |
5629 | // The following requirement is tested: |
5630 | // Array dimensions shall be specified using constant expressions, which shall |
5631 | // evaluate to a positive integer values. Constants used in the constant |
5632 | // expressions shall meet with the restrictions in clause 10. |
5633 | |
5634 | module NegSem_060207_arrays_012 { |
5635 | |
5636 | type component GeneralComp { |
5637 | } |
5638 | |
5639 | function f() return integer { |
5640 | if (rnd() < 0.5) { return 5; } |
5641 | else { return 10; } |
5642 | } |
5643 | |
5644 | const integer c_dimension := f(); |
5645 | |
5646 | testcase TC_NegSem_060207_arrays_012() runs on GeneralComp { |
5647 | var integer v_arr[c_dimension]; |
5648 | v_arr[0] := 1; |
5649 | setverdict(pass); |
5650 | } |
5651 | |
5652 | control { |
5653 | execute(TC_NegSem_060207_arrays_012()); |
5654 | } |
5655 | |
5656 | } |
5657 | <END_MODULE> |
5658 | |
5659 | <RESULT COUNT 1> |
5660 | error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_012.f' |
5661 | <END_RESULT> |
5662 | |
5663 | <END_TC> |
5664 | :exmp |
5665 | |
5666 | *---------------------------------------------------------------------* |
5667 | :h3. NegSem_060207_arrays_013 negative test |
5668 | .*---------------------------------------------------------------------* |
5669 | :xmp tab=0. |
5670 | |
5671 | <TC - variable in array variable declaration > |
5672 | |
5673 | <COMPILE> |
5674 | |
5675 | <MODULE TTCN NegSem_060207_arrays_013 NegSem_060207_arrays_013.ttcn > |
5676 | /*************************************************** |
5677 | ** @version 0.0.1 |
5678 | ** @purpose 1:6.2.7, variable in array variable declaration |
5679 | ** @verdict pass reject |
5680 | ***************************************************/ |
5681 | |
5682 | // The following requirement is tested: |
5683 | // Array dimensions shall be specified using constant expressions, which shall |
5684 | // evaluate to a positive integer values. Constants used in the constant |
5685 | // expressions shall meet with the restrictions in clause 10. |
5686 | |
5687 | module NegSem_060207_arrays_013 { |
5688 | |
5689 | type component GeneralComp { |
5690 | } |
5691 | |
5692 | function f() return integer { |
5693 | if (rnd() < 0.5) { return 5; } |
5694 | else { return 10; } |
5695 | } |
5696 | |
5697 | testcase TC_NegSem_060207_arrays_013() runs on GeneralComp { |
5698 | var integer v_dimension := f(); |
5699 | var integer v_arr[v_dimension]; |
5700 | v_arr[0] := 1; |
5701 | setverdict(pass); |
5702 | } |
5703 | |
5704 | control { |
5705 | execute(TC_NegSem_060207_arrays_013()); |
5706 | } |
5707 | |
5708 | } |
5709 | <END_MODULE> |
5710 | |
5711 | <RESULT COUNT 1> |
5712 | error: Reference to a constant value was expected instead of variable `v_dimension' |
5713 | <END_RESULT> |
5714 | |
5715 | <END_TC> |
5716 | :exmp |
5717 | |
5718 | *---------------------------------------------------------------------* |
5719 | :h3. NegSem_060207_arrays_014 negative test |
5720 | .*---------------------------------------------------------------------* |
5721 | :xmp tab=0. |
5722 | |
5723 | <TC - modulepar in array variable declaration > |
5724 | |
5725 | <COMPILE> |
5726 | |
5727 | <MODULE TTCN NegSem_060207_arrays_014 NegSem_060207_arrays_014.ttcn > |
5728 | /*************************************************** |
5729 | ** @version 0.0.1 |
5730 | ** @purpose 1:6.2.7, modulepar in array variable declaration |
5731 | ** @verdict pass reject |
5732 | ***************************************************/ |
5733 | |
5734 | // The following requirement is tested: |
5735 | // Array dimensions shall be specified using constant expressions, which shall |
5736 | // evaluate to a positive integer values. Constants used in the constant |
5737 | // expressions shall meet with the restrictions in clause 10. |
5738 | |
5739 | module NegSem_060207_arrays_014 { |
5740 | |
5741 | type component GeneralComp { |
5742 | } |
5743 | |
5744 | function f() return integer { |
5745 | if (rnd() < 0.5) { return 5; } |
5746 | else { return 10; } |
5747 | } |
5748 | |
5749 | modulepar integer PX_DIMENSION := 5; |
5750 | |
5751 | testcase TC_NegSem_060207_arrays_014() runs on GeneralComp { |
5752 | var integer v_arr[PX_DIMENSION]; |
5753 | v_arr[0] := 1; |
5754 | setverdict(pass); |
5755 | } |
5756 | |
5757 | control { |
5758 | execute(TC_NegSem_060207_arrays_014()); |
5759 | } |
5760 | |
5761 | } |
5762 | <END_MODULE> |
5763 | |
5764 | <RESULT COUNT 1> |
02f1ec01 |
5765 | error: Reference to an \(evaluable\) constant value was expected instead of module parameter `@NegSem_060207_arrays_014.PX_DIMENSION' |
8930eefa |
5766 | <END_RESULT> |
5767 | |
5768 | <END_TC> |
5769 | :exmp |
5770 | |
5771 | *---------------------------------------------------------------------* |
5772 | :h3. NegSem_060207_arrays_015 negative test |
5773 | .*---------------------------------------------------------------------* |
5774 | :xmp tab=0. |
5775 | |
5776 | <TC - zero dimension array > |
5777 | |
5778 | <COMPILE> |
5779 | |
5780 | <MODULE TTCN NegSem_060207_arrays_015 NegSem_060207_arrays_015.ttcn > |
5781 | /*************************************************** |
5782 | ** @version 0.0.1 |
5783 | ** @purpose 1:6.2.7, zero dimension array |
5784 | ** @verdict pass reject |
5785 | ***************************************************/ |
5786 | |
5787 | // The following requirement is tested: |
5788 | // Array dimensions shall be specified using constant expressions, which shall |
5789 | // evaluate to a positive integer values. Constants used in the constant |
5790 | // expressions shall meet with the restrictions in clause 10. |
5791 | |
5792 | module NegSem_060207_arrays_015 { |
5793 | |
5794 | type component GeneralComp { |
5795 | } |
5796 | |
5797 | testcase TC_NegSem_060207_arrays_015() runs on GeneralComp { |
5798 | var integer v_arr[0] := {}; |
5799 | setverdict(pass); |
5800 | } |
5801 | |
5802 | control { |
5803 | execute(TC_NegSem_060207_arrays_015()); |
5804 | } |
5805 | |
5806 | } |
5807 | <END_MODULE> |
5808 | |
5809 | <RESULT COUNT 1> |
5810 | error: A positive integer value was expected as array size instead of `0' |
5811 | <END_RESULT> |
5812 | |
5813 | <END_TC> |
5814 | :exmp |
5815 | |
5816 | *---------------------------------------------------------------------* |
5817 | :h3. NegSem_060207_arrays_016 negative test |
5818 | .*---------------------------------------------------------------------* |
5819 | :xmp tab=0. |
5820 | |
5821 | <TC - array with negative dimension > |
5822 | |
5823 | <COMPILE> |
5824 | |
5825 | <MODULE TTCN NegSem_060207_arrays_016 NegSem_060207_arrays_016.ttcn > |
5826 | /*************************************************** |
5827 | ** @version 0.0.1 |
5828 | ** @purpose 1:6.2.7, array with negative dimension |
5829 | ** @verdict pass reject |
5830 | ***************************************************/ |
5831 | |
5832 | // The following requirement is tested: |
5833 | // Array dimensions shall be specified using constant expressions, which shall |
5834 | // evaluate to a positive integer values. Constants used in the constant |
5835 | // expressions shall meet with the restrictions in clause 10. |
5836 | |
5837 | module NegSem_060207_arrays_016 { |
5838 | |
5839 | type component GeneralComp { |
5840 | } |
5841 | |
5842 | testcase TC_NegSem_060207_arrays_016() runs on GeneralComp { |
5843 | var integer v_arr[3][-1]; |
5844 | setverdict(pass); |
5845 | } |
5846 | |
5847 | control { |
5848 | execute(TC_NegSem_060207_arrays_016()); |
5849 | } |
5850 | |
5851 | } |
5852 | <END_MODULE> |
5853 | |
5854 | <RESULT COUNT 1> |
5855 | error: A positive integer value was expected as array size instead of `-1' |
5856 | <END_RESULT> |
5857 | |
5858 | <END_TC> |
5859 | :exmp |
5860 | |
5861 | *---------------------------------------------------------------------* |
5862 | :h3. NegSem_060207_arrays_019 negative test |
5863 | .*---------------------------------------------------------------------* |
5864 | :xmp tab=0. |
5865 | |
5866 | <TC - float instead of integer in array dimension > |
5867 | |
5868 | <COMPILE> |
5869 | |
5870 | <MODULE TTCN NegSem_060207_arrays_019 NegSem_060207_arrays_019.ttcn > |
5871 | /*************************************************** |
5872 | ** @version 0.0.1 |
5873 | ** @purpose 1:6.2.7, float instead of integer in array dimension |
5874 | ** @verdict pass reject |
5875 | ***************************************************/ |
5876 | |
5877 | // The following requirement is tested: |
5878 | // Array dimensions shall be specified using constant expressions, which shall |
5879 | // evaluate to a positive integer values. Constants used in the constant |
5880 | // expressions shall meet with the restrictions in clause 10. |
5881 | |
5882 | module NegSem_060207_arrays_019 { |
5883 | |
5884 | type component GeneralComp { |
5885 | } |
5886 | |
5887 | testcase TC_NegSem_060207_arrays_019() runs on GeneralComp { |
5888 | var integer v_arr[2.0]; |
5889 | setverdict(pass); |
5890 | } |
5891 | |
5892 | control { |
5893 | execute(TC_NegSem_060207_arrays_019()); |
5894 | } |
5895 | |
5896 | } |
5897 | <END_MODULE> |
5898 | |
5899 | <RESULT COUNT 1> |
5900 | error: A value or expression of type integer was expected |
5901 | <END_RESULT> |
5902 | |
5903 | <END_TC> |
5904 | :exmp |
5905 | |
5906 | *---------------------------------------------------------------------* |
5907 | :h3. NegSem_060207_arrays_022 negative test |
5908 | .*---------------------------------------------------------------------* |
5909 | :xmp tab=0. |
5910 | |
5911 | <TC - using lower than allowed custom array index on the right hand side of assignments > |
5912 | |
5913 | <COMPILE> |
5914 | |
5915 | <MODULE TTCN NegSem_060207_arrays_022 NegSem_060207_arrays_022.ttcn > |
5916 | /*************************************************** |
5917 | ** @version 0.0.1 |
5918 | ** @purpose 1:6.2.7, using lower than allowed custom array index on the right hand side of assignments |
5919 | ** @verdict pass reject |
5920 | ***************************************************/ |
5921 | |
5922 | // The following requirement is tested: |
5923 | // Indexed value notation can be used on both the right-hand side and left-hand |
5924 | // side of assignments. The index of the first element shall be zero or the lower |
5925 | // bound if an index range has been given. |
5926 | |
5927 | module NegSem_060207_arrays_022 { |
5928 | |
5929 | type component GeneralComp { |
5930 | } |
5931 | |
5932 | testcase TC_NegSem_060207_arrays_022() runs on GeneralComp { |
5933 | var integer v_arr[2..5] := { 2, 3, 4, 5 }; |
5934 | var boolean v_bool := v_arr[0] == 0; |
5935 | setverdict(pass); |
5936 | } |
5937 | |
5938 | control { |
5939 | execute(TC_NegSem_060207_arrays_022()); |
5940 | } |
5941 | |
5942 | } |
5943 | <END_MODULE> |
5944 | |
5945 | <RESULT COUNT 1> |
5946 | error: Array index underflow: the index value must be at least `2' instead of `0' |
5947 | <END_RESULT> |
5948 | |
5949 | <END_TC> |
5950 | :exmp |
5951 | |
5952 | *---------------------------------------------------------------------* |
5953 | :h3. NegSem_060207_arrays_023 negative test |
5954 | .*---------------------------------------------------------------------* |
5955 | :xmp tab=0. |
5956 | |
5957 | <TC - using lower than allowed custom array index on the left hand side of assignments > |
5958 | |
5959 | <COMPILE> |
5960 | |
5961 | <MODULE TTCN NegSem_060207_arrays_023 NegSem_060207_arrays_023.ttcn > |
5962 | /*************************************************** |
5963 | ** @version 0.0.1 |
5964 | ** @purpose 1:6.2.7, using lower than allowed custom array index on the left hand side of assignments |
5965 | ** @verdict pass reject |
5966 | ***************************************************/ |
5967 | |
5968 | // The following requirement is tested: |
5969 | // Indexed value notation can be used on both the right-hand side and left-hand |
5970 | // side of assignments. The index of the first element shall be zero or the lower |
5971 | // bound if an index range has been given. |
5972 | |
5973 | module NegSem_060207_arrays_023 { |
5974 | |
5975 | type component GeneralComp { |
5976 | } |
5977 | |
5978 | testcase TC_NegSem_060207_arrays_023() runs on GeneralComp { |
5979 | var integer v_arr[2..5] := { 2, 3, 4, 5 }; |
5980 | v_arr[0] := 0; |
5981 | setverdict(pass); |
5982 | } |
5983 | |
5984 | control { |
5985 | execute(TC_NegSem_060207_arrays_023()); |
5986 | } |
5987 | |
5988 | } |
5989 | <END_MODULE> |
5990 | |
5991 | <RESULT COUNT 1> |
5992 | error: Array index underflow: the index value must be at least `2' instead of `0' |
5993 | <END_RESULT> |
5994 | |
5995 | <END_TC> |
5996 | :exmp |
5997 | |
5998 | *---------------------------------------------------------------------* |
5999 | :h3. NegSem_060207_arrays_024 negative test |
6000 | .*---------------------------------------------------------------------* |
6001 | :xmp tab=0. |
6002 | |
6003 | <TC - using greater than allowed custom array index on the right hand side of assignments > |
6004 | |
6005 | <COMPILE> |
6006 | |
6007 | <MODULE TTCN NegSem_060207_arrays_024 NegSem_060207_arrays_024.ttcn > |
6008 | /*************************************************** |
6009 | ** @version 0.0.1 |
6010 | ** @purpose 1:6.2.7, using greater than allowed custom array index on the right hand side of assignments |
6011 | ** @verdict pass reject |
6012 | ***************************************************/ |
6013 | |
6014 | // The following requirement is tested: |
6015 | // The index shall not exceed the limitations given by either the length or the |
6016 | // upper bound of the index. |
6017 | |
6018 | module NegSem_060207_arrays_024 { |
6019 | |
6020 | type component GeneralComp { |
6021 | } |
6022 | |
6023 | testcase TC_NegSem_060207_arrays_024() runs on GeneralComp { |
6024 | var integer v_arr[2..5] := { 2, 3, 4, 5 }; |
6025 | var boolean v_bool := v_arr[6] == 6; |
6026 | setverdict(pass); |
6027 | } |
6028 | |
6029 | control { |
6030 | execute(TC_NegSem_060207_arrays_024()); |
6031 | } |
6032 | |
6033 | } |
6034 | <END_MODULE> |
6035 | |
6036 | <RESULT COUNT 1> |
6037 | error: Array index overflow: the index value must be at most `5' instead of `6' |
6038 | <END_RESULT> |
6039 | |
6040 | <END_TC> |
6041 | :exmp |
6042 | |
6043 | *---------------------------------------------------------------------* |
6044 | :h3. NegSem_060207_arrays_025 negative test |
6045 | .*---------------------------------------------------------------------* |
6046 | :xmp tab=0. |
6047 | |
6048 | <TC - using greater than allowed custom array index on the left hand side of assignments > |
6049 | |
6050 | <COMPILE> |
6051 | |
6052 | <MODULE TTCN NegSem_060207_arrays_025 NegSem_060207_arrays_025.ttcn > |
6053 | /*************************************************** |
6054 | ** @version 0.0.1 |
6055 | ** @purpose 1:6.2.7, using greater than allowed custom array index on the left hand side of assignments |
6056 | ** @verdict pass reject |
6057 | ***************************************************/ |
6058 | |
6059 | // The following requirement is tested: |
6060 | // The index shall not exceed the limitations given by either the length or the |
6061 | // upper bound of the index. |
6062 | |
6063 | module NegSem_060207_arrays_025 { |
6064 | |
6065 | type component GeneralComp { |
6066 | } |
6067 | |
6068 | testcase TC_NegSem_060207_arrays_025() runs on GeneralComp { |
6069 | var integer v_arr[2..5] := { 2, 3, 4, 5 }; |
6070 | v_arr[6] := 6; |
6071 | setverdict(pass); |
6072 | } |
6073 | |
6074 | control { |
6075 | execute(TC_NegSem_060207_arrays_025()); |
6076 | } |
6077 | |
6078 | } |
6079 | <END_MODULE> |
6080 | |
6081 | <RESULT COUNT 1> |
6082 | error: Array index overflow: the index value must be at most `5' instead of `6' |
6083 | <END_RESULT> |
6084 | |
6085 | <END_TC> |
6086 | :exmp |
6087 | |
6088 | *---------------------------------------------------------------------* |
6089 | :h3. NegSem_060207_arrays_026 negative test |
6090 | .*---------------------------------------------------------------------* |
6091 | :xmp tab=0. |
6092 | |
6093 | <TC - using greater than allowed custom array index on the left hand side of assignments > |
6094 | |
6095 | <COMPILE> |
6096 | <EXECUTE_PARALLEL> |
6097 | |
6098 | <MODULE TTCN NegSem_060207_arrays_026 NegSem_060207_arrays_026.ttcn > |
6099 | /*************************************************** |
6100 | ** @version 0.0.1 |
6101 | ** @purpose 1:6.2.7, referencing uninitialized array element on the right hand side of assignments |
6102 | ** @verdict pass reject |
6103 | ***************************************************/ |
6104 | |
6105 | // The following requirement is tested: |
6106 | // : If the value of the element indicated by the index at the right hand of |
6107 | // an assignment is undefined or if the index notation is applied to an uninitialized |
6108 | // or omitted array value on the right hand side of an assignment, error shall be |
6109 | // caused. |
6110 | |
6111 | module NegSem_060207_arrays_026 { |
6112 | |
6113 | type component GeneralComp { |
6114 | } |
6115 | |
6116 | type record R { |
6117 | integer field1[3], |
6118 | boolean field2 |
6119 | } |
6120 | |
6121 | testcase TC_NegSem_060207_arrays_026() runs on GeneralComp { |
6122 | var integer v_arr[3], v_int; |
6123 | v_arr[2] := 1; |
6124 | v_int := v_arr[0]; |
6125 | setverdict(pass); |
6126 | } |
6127 | |
6128 | control { |
6129 | execute(TC_NegSem_060207_arrays_026()); |
6130 | } |
6131 | |
6132 | } |
6133 | <END_MODULE> |
6134 | |
6135 | <RESULT COUNT 1> |
6136 | Dynamic test case error: Assignment of an unbound integer value. |
6137 | <END_RESULT> |
6138 | |
6139 | <END_TC> |
6140 | :exmp |
6141 | |
6142 | *---------------------------------------------------------------------* |
6143 | :h3. NegSem_060207_arrays_027 negative test |
6144 | .*---------------------------------------------------------------------* |
6145 | :xmp tab=0. |
6146 | |
6147 | <TC - using greater than allowed custom array index on the left hand side of assignments > |
6148 | |
6149 | <COMPILE> |
6150 | <EXECUTE_PARALLEL> |
6151 | |
6152 | <MODULE TTCN NegSem_060207_arrays_027 NegSem_060207_arrays_027.ttcn > |
6153 | /*************************************************** |
6154 | ** @version 0.0.1 |
6155 | ** @purpose 1:6.2.7, referencing element of uninitialized arrays on the right hand side of assignments |
6156 | ** @verdict pass reject |
6157 | ***************************************************/ |
6158 | |
6159 | // The following requirement is tested: |
6160 | // : If the value of the element indicated by the index at the right hand of |
6161 | // an assignment is undefined or if the index notation is applied to an uninitialized |
6162 | // or omitted array value on the right hand side of an assignment, error shall be |
6163 | // caused. |
6164 | |
6165 | module NegSem_060207_arrays_027 { |
6166 | |
6167 | type component GeneralComp { |
6168 | } |
6169 | |
6170 | type record R { |
6171 | integer field1[3], |
6172 | boolean field2 |
6173 | } |
6174 | |
6175 | testcase TC_NegSem_060207_arrays_027() runs on GeneralComp { |
6176 | var R v_rec := { -, true } |
6177 | var integer v_int := v_rec.field1[0]; |
6178 | setverdict(pass); |
6179 | } |
6180 | |
6181 | control { |
6182 | execute(TC_NegSem_060207_arrays_027()); |
6183 | } |
6184 | |
6185 | } |
6186 | <END_MODULE> |
6187 | |
6188 | <RESULT COUNT 1> |
6189 | Dynamic test case error: Copying an unbound integer value. |
6190 | <END_RESULT> |
6191 | |
6192 | <END_TC> |
6193 | :exmp |
6194 | |
6195 | *---------------------------------------------------------------------* |
6196 | :h3. NegSem_060207_arrays_028 negative test |
6197 | .*---------------------------------------------------------------------* |
6198 | :xmp tab=0. |
6199 | |
6200 | <TC - using greater than allowed custom array index on the left hand side of assignments > |
6201 | |
6202 | <COMPILE> |
6203 | <EXECUTE_PARALLEL> |
6204 | |
6205 | <MODULE TTCN NegSem_060207_arrays_028 NegSem_060207_arrays_028.ttcn > |
6206 | /*************************************************** |
6207 | ** @version 0.0.1 |
6208 | ** @purpose 1:6.2.7, referencing element of omitted arrays on the right hand side of assignments |
6209 | ** @verdict pass reject |
6210 | ***************************************************/ |
6211 | |
6212 | // The following requirement is tested: |
6213 | // : If the value of the element indicated by the index at the right hand of |
6214 | // an assignment is undefined or if the index notation is applied to an uninitialized |
6215 | // or omitted array value on the right hand side of an assignment, error shall be |
6216 | // caused. |
6217 | |
6218 | module NegSem_060207_arrays_028 { |
6219 | |
6220 | type component GeneralComp { |
6221 | } |
6222 | |
6223 | type record R { |
6224 | integer field1[3] optional, |
6225 | boolean field2 |
6226 | } |
6227 | |
6228 | testcase TC_NegSem_060207_arrays_028() runs on GeneralComp { |
6229 | var R v_rec := { omit, true } |
6230 | var integer v_int := v_rec.field1[0]; |
6231 | setverdict(pass); |
6232 | } |
6233 | |
6234 | control { |
6235 | execute(TC_NegSem_060207_arrays_028()); |
6236 | } |
6237 | |
6238 | } |
6239 | <END_MODULE> |
6240 | |
6241 | <RESULT COUNT 1> |
6242 | Dynamic test case error: Using the value of an optional field containing omit |
6243 | <END_RESULT> |
6244 | |
6245 | <END_TC> |
6246 | :exmp |
6247 | |
6248 | *---------------------------------------------------------------------* |
6249 | :h3. NegSyn_060207_arrays_001 negative test |
6250 | .*---------------------------------------------------------------------* |
6251 | :xmp tab=0. |
6252 | |
6253 | <TC - ensure that array cannot contain an empty assignment > |
6254 | |
6255 | <COMPILE> |
6256 | |
6257 | <MODULE TTCN NegSyn_060207_arrays_001 NegSyn_060207_arrays_001.ttcn > |
6258 | /*************************************************** |
6259 | ** @version 0.0.1 |
6260 | ** @purpose 1:6.2.7, ensure that array cannot contain an empty assignment |
6261 | ** @verdict pass reject |
6262 | ***************************************************/ |
6263 | |
6264 | module NegSyn_060207_arrays_001 { |
6265 | |
6266 | type component GeneralComp { |
6267 | } |
6268 | |
6269 | type integer MyArrayType1[5] (1 .. 10); |
6270 | |
6271 | testcase TC_NegSyn_060207_arrays_001() runs on GeneralComp { |
6272 | |
6273 | var MyArrayType1 v_array1 := { 8, , 2, 3, 4}; // syntax error expected |
6274 | |
6275 | } |
6276 | |
6277 | control { |
6278 | execute(TC_NegSyn_060207_arrays_001()); |
6279 | } |
6280 | |
6281 | } |
6282 | <END_MODULE> |
6283 | |
6284 | <RESULT COUNT 1> |
6285 | error: at or before token `,': syntax error, unexpected ',' |
6286 | <END_RESULT> |
6287 | |
6288 | <END_TC> |
6289 | :exmp |
6290 | |
6291 | *---------------------------------------------------------------------* |
6292 | :h3. NegSyn_060207_arrays_002 negative test |
6293 | .*---------------------------------------------------------------------* |
6294 | :xmp tab=0. |
6295 | |
6296 | <TC - ensure that array field cannot contain an empty index > |
6297 | |
6298 | <COMPILE> |
6299 | |
6300 | <MODULE TTCN NegSyn_060207_arrays_002 NegSyn_060207_arrays_002.ttcn > |
6301 | /*************************************************** |
6302 | ** @version 0.0.1 |
6303 | ** @purpose 1:6.2.7, ensure that array field cannot contain an empty index |
6304 | ** @verdict pass reject |
6305 | ***************************************************/ |
6306 | module NegSyn_060207_arrays_002 { |
6307 | |
6308 | type component GeneralComp { |
6309 | } |
6310 | |
6311 | |
6312 | type integer MyArrayType1[5] (1 .. 10); |
6313 | |
6314 | testcase TC_NegSyn_060207_arrays_002() runs on GeneralComp { |
6315 | |
6316 | var MyArrayType1 v_array1 := { 8, 10, 2, 3, 4}; |
6317 | v_array1[] := 10; // error expected - missing index |
6318 | } |
6319 | |
6320 | control { |
6321 | execute(TC_NegSyn_060207_arrays_002()); |
6322 | } |
6323 | |
6324 | } |
6325 | <END_MODULE> |
6326 | |
6327 | <RESULT COUNT 1> |
6328 | error: at or before token `\]': syntax error, unexpected '\]' |
6329 | <END_RESULT> |
6330 | |
6331 | <END_TC> |
6332 | :exmp |
6333 | |
6334 | *---------------------------------------------------------------------* |
6335 | :h3. NegSyn_060207_arrays_003 negative test |
6336 | .*---------------------------------------------------------------------* |
6337 | :xmp tab=0. |
6338 | |
6339 | <TC - ensure that array field cannot contain an empty index > |
6340 | |
6341 | <COMPILE> |
6342 | |
6343 | <MODULE TTCN NegSyn_060207_arrays_003 NegSyn_060207_arrays_003.ttcn > |
6344 | /*************************************************** |
6345 | ** @version 0.0.1 |
6346 | ** @purpose 1:6.2.7, ensure that array field cannot contain an empty index |
6347 | ** @verdict pass reject |
6348 | ***************************************************/ |
6349 | module NegSyn_060207_arrays_003 { |
6350 | |
6351 | type component GeneralComp { |
6352 | } |
6353 | |
6354 | |
6355 | type integer MyArrayType1[5] (1 .. 10); |
6356 | |
6357 | |
6358 | testcase TC_NegSyn_060207_arrays_003() runs on GeneralComp { |
6359 | |
6360 | var MyArrayType1 v_array1 := { 8, 10, 2, 3, 4}; |
6361 | var integer i :=v_array1[];// error expected - missing index |
6362 | } |
6363 | |
6364 | control { |
6365 | execute(TC_NegSyn_060207_arrays_003()); |
6366 | } |
6367 | |
6368 | } |
6369 | <END_MODULE> |
6370 | |
6371 | <RESULT COUNT 1> |
6372 | error: at or before token `\]': syntax error, unexpected '\]' |
6373 | <END_RESULT> |
6374 | |
6375 | <END_TC> |
6376 | :exmp |
6377 | |
6378 | *---------------------------------------------------------------------* |
6379 | :h3. NegSyn_060207_arrays_004 negative test |
6380 | .*---------------------------------------------------------------------* |
6381 | :xmp tab=0. |
6382 | |
6383 | <TC - infinity in array variable dimension > |
6384 | |
6385 | <COMPILE> |
6386 | |
6387 | <MODULE TTCN NegSyn_060207_arrays_004 NegSyn_060207_arrays_004.ttcn > |
6388 | /*************************************************** |
6389 | ** @version 0.0.1 |
6390 | ** @purpose 1:6.2.7, infinity in array variable dimension |
6391 | ** @verdict pass reject |
6392 | ***************************************************/ |
6393 | |
6394 | // The following requirement is tested: |
6395 | // Array dimensions may also be specified using ranges (with inclusive |
6396 | // boundaries only). In such cases, the lower and upper values of the range |
6397 | // define the lower and upper index values. Such an array is corresponding to |
6398 | // a record of with a fixed length restriction computed as the difference |
6399 | // between upper and lower index bound plus 1 and indexing starting from the |
6400 | // lower bound of the array definition. |
6401 | |
6402 | module NegSyn_060207_arrays_004 { |
6403 | |
6404 | control { |
6405 | var integer v_arr[1..infinity]; |
6406 | } |
6407 | } |
6408 | <END_MODULE> |
6409 | |
6410 | <RESULT COUNT 1> |
6411 | error: A value or expression of type integer was expected |
6412 | <END_RESULT> |
6413 | |
6414 | <END_TC> |
6415 | :exmp |
6416 | |
6417 | *---------------------------------------------------------------------* |
6418 | :h3. NegSem_060209_CommunicationPortTypes_004 negative test |
6419 | .*---------------------------------------------------------------------* |
6420 | :xmp tab=0. |
6421 | |
6422 | <TC - Verify that an error is generated when a message port type definition contains no message typess > |
6423 | |
6424 | <COMPILE> |
6425 | |
6426 | <MODULE TTCN NegSem_060209_CommunicationPortTypes_004 NegSem_060209_CommunicationPortTypes_004.ttcn > |
6427 | /***************************************************************** |
6428 | ** @version 0.0.1 |
6429 | ** @purpose 1:6.2.9, Verify that an error is generated when a message port type definition contains no message types |
6430 | ** @verdict pass reject |
6431 | *****************************************************************/ |
6432 | |
6433 | // The following requirements are tested: |
6434 | // Each port type definition shall have one or more lists indicating the allowed collection of |
6435 | // (message) types ... with the allowed communication direction. |
6436 | |
6437 | module NegSem_060209_CommunicationPortTypes_004 { |
6438 | |
6439 | type record MyType1 { |
6440 | integer f1, |
6441 | charstring f2 |
6442 | } |
6443 | |
6444 | type record MyType2 { |
6445 | integer g1, |
6446 | charstring g2 |
6447 | } |
6448 | |
6449 | type record MyType3 { |
6450 | boolean h1, |
6451 | MyType3 h2 optional |
6452 | } |
6453 | |
6454 | type port MyMessagePortTypeOne message { |
6455 | // address MyType1; |
6456 | // map param (in integer p1, inout MyType2 p2); |
6457 | // unmap param (in MyType3 p1, out integer p2); |
6458 | } with {extension "internal"} |
6459 | |
6460 | } |
6461 | <END_MODULE> |
6462 | |
6463 | <RESULT COUNT 1> |
6464 | error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword |
6465 | <END_RESULT> |
6466 | |
6467 | <END_TC> |
6468 | :exmp |
6469 | |
6470 | *---------------------------------------------------------------------* |
6471 | :h3. NegSem_060209_CommunicationPortTypes_005 negative test |
6472 | .*---------------------------------------------------------------------* |
6473 | :xmp tab=0. |
6474 | |
6475 | <TC - Verify that an error is generated when a procedure port type definition contains no signatures > |
6476 | |
6477 | <COMPILE> |
6478 | |
6479 | <MODULE TTCN NegSem_060209_CommunicationPortTypes_005 NegSem_060209_CommunicationPortTypes_005.ttcn > |
6480 | /***************************************************************** |
6481 | ** @version 0.0.1 |
6482 | ** @purpose 1:6.2.9, Verify that an error is generated when a procedure port type definition contains no signatures |
6483 | ** @verdict pass reject |
6484 | *****************************************************************/ |
6485 | |
6486 | // The following requirements are tested: |
6487 | // Each port type definition shall have one or more lists indicating the allowed collection of |
6488 | // ... procedure signatures with the allowed communication direction. |
6489 | |
6490 | module NegSem_060209_CommunicationPortTypes_005 { |
6491 | |
6492 | type record MyType1 { |
6493 | integer f1, |
6494 | charstring f2 |
6495 | } |
6496 | |
6497 | type record MyType2 { |
6498 | integer g1, |
6499 | charstring g2 |
6500 | } |
6501 | |
6502 | type record MyType3 { |
6503 | boolean h1, |
6504 | MyType3 h2 optional |
6505 | } |
6506 | |
6507 | type port MyMessagePortTypeOne procedure { |
6508 | // address MyType1; |
6509 | // map param (in integer p1, inout MyType2 p2); |
6510 | // unmap param (in MyType3 p1, out integer p2); |
6511 | } with {extension "internal"} |
6512 | |
6513 | } |
6514 | <END_MODULE> |
6515 | |
6516 | <RESULT COUNT 1> |
6517 | error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword |
6518 | <END_RESULT> |
6519 | |
6520 | <END_TC> |
6521 | :exmp |
6522 | |
6523 | *---------------------------------------------------------------------* |
6524 | :h3. NegSyn_060210_ReuseofComponentTypes_001 negative test |
6525 | .*---------------------------------------------------------------------* |
6526 | :xmp tab=0. |
6527 | |
6528 | <TC - Ensure that cyclic extension is not allowed > |
6529 | |
6530 | <COMPILE> |
6531 | |
6532 | <MODULE TTCN NegSyn_060210_ReuseofComponentTypes_001 NegSyn_060210_ReuseofComponentTypes_001.ttcn > |
6533 | /***************************************************************** |
6534 | ** @version 0.0.1 |
6535 | ** @purpose 1:6.2.10, Ensure that cyclic extension is not allowed |
6536 | ** @verdict pass reject, noexecution |
6537 | *****************************************************************/ |
6538 | |
6539 | /* The following requirements are tested: |
6540 | * Restriction c.: It is allowed to extend component types that are defined by means of extension, |
6541 | * as long as no cyclic chain of definition is created. |
6542 | */ |
6543 | |
6544 | module NegSyn_060210_ReuseofComponentTypes_001 { |
6545 | |
6546 | type port loopbackPort message { |
6547 | inout integer; |
6548 | inout float; |
6549 | } with {extension "internal"} |
6550 | |
6551 | type component MyCompA extends GeneralComp { |
6552 | port loopbackPort pt_myPortA; |
6553 | } |
6554 | |
6555 | |
6556 | type component MyCompB extends MyCompA { |
6557 | var integer MyInt; |
6558 | } |
6559 | |
6560 | |
6561 | type component GeneralComp extends MyCompB { //error: cyclic extension |
6562 | port loopbackPort pt_myPortB; |
6563 | } |
6564 | |
6565 | testcase TC_NegSyn_060210_ReuseofComponentTypes_001() runs on GeneralComp { |
6566 | |
6567 | pt_myPortB.send(2); |
6568 | } |
6569 | |
6570 | control{ |
6571 | execute(TC_NegSyn_060210_ReuseofComponentTypes_001()); |
6572 | } |
6573 | } |
6574 | <END_MODULE> |
6575 | |
6576 | <RESULT COUNT 1> |
6577 | error: While checking component type extensions: Circular reference: `@NegSyn_060210_ReuseofComponentTypes_001.MyCompA' -> `@NegSyn_060210_ReuseofComponentTypes_001.GeneralComp' -> `@NegSyn_060210_ReuseofComponentTypes_001.MyCompB' -> `@NegSyn_060210_ReuseofComponentTypes_001.MyCompA' |
6578 | <END_RESULT> |
6579 | |
6580 | <END_TC> |
6581 | :exmp |
6582 | |
6583 | *---------------------------------------------------------------------* |
6584 | :h3. NegSyn_060210_ReuseofComponentTypes_002 negative test |
6585 | .*---------------------------------------------------------------------* |
6586 | :xmp tab=0. |
6587 | |
6588 | <TC - Ensure that cyclic extension is not allowed > |
6589 | |
6590 | <COMPILE> |
6591 | |
6592 | <MODULE TTCN NegSyn_060210_ReuseofComponentTypes_002 NegSyn_060210_ReuseofComponentTypes_002.ttcn > |
6593 | /***************************************************************** |
6594 | ** @version 0.0.1 |
6595 | ** @purpose 1:6.2.10, Ensure that extending a component that occurs name clash is not allowed |
6596 | ** @verdict pass reject, noexecution |
6597 | *****************************************************************/ |
6598 | |
6599 | /* The following requirements are tested: |
6600 | * Restriction b.: When defining component types by extending more than one parent type, |
6601 | * there shall be no name clash between the definitions of the different parent types |
6602 | */ |
6603 | |
6604 | module NegSyn_060210_ReuseofComponentTypes_002 { |
6605 | |
6606 | type port loopbackPort message { |
6607 | inout integer; |
6608 | inout float; |
6609 | } with {extension "internal"} |
6610 | |
6611 | type component MyCompA { |
6612 | port loopbackPort pt_myPortA; |
6613 | } |
6614 | |
6615 | |
6616 | type component MyCompB { |
6617 | var integer MyInt; |
6618 | } |
6619 | |
6620 | type component GeneralComp extends MyCompA, MyCompB { |
6621 | port loopbackPort pt_myPortB; |
6622 | var integer MyInt; //error: name clash |
6623 | } |
6624 | |
6625 | testcase TC_NegSyn_060210_ReuseofComponentTypes_002() runs on GeneralComp { |
6626 | |
6627 | pt_myPortA.send(2); |
6628 | pt_myPortB.send(2.0); |
6629 | } |
6630 | |
6631 | control{ |
6632 | execute(TC_NegSyn_060210_ReuseofComponentTypes_002()); |
6633 | } |
6634 | } |
6635 | <END_MODULE> |
6636 | |
6637 | <RESULT COUNT 1> |
6638 | error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_002.MyCompB |
6639 | <END_RESULT> |
6640 | |
6641 | <END_TC> |
6642 | :exmp |
6643 | |
6644 | *---------------------------------------------------------------------* |
6645 | :h3. NegSyn_060210_ReuseofComponentTypes_003 negative test |
6646 | .*---------------------------------------------------------------------* |
6647 | :xmp tab=0. |
6648 | |
6649 | <TC - Ensure that cyclic extension is not allowed > |
6650 | |
6651 | <COMPILE> |
6652 | |
6653 | <MODULE TTCN NegSyn_060210_ReuseofComponentTypes_003 NegSyn_060210_ReuseofComponentTypes_003.ttcn > |
6654 | /***************************************************************** |
6655 | ** @version 0.0.1 |
6656 | ** @purpose 1:6.2.10, Ensure that extending a component that occurs name clash is not allowed |
6657 | ** @verdict pass reject, noexecution |
6658 | *****************************************************************/ |
6659 | |
6660 | /* The following requirements are tested: |
6661 | * When defining component types by extension, there shall be |
6662 | * no name clash between the definitions being taken from the parent type |
6663 | * and the definitions being added in the extended type |
6664 | */ |
6665 | |
6666 | module NegSyn_060210_ReuseofComponentTypes_003 { |
6667 | |
6668 | type port loopbackPort message { |
6669 | inout integer; |
6670 | inout float; |
6671 | } with {extension "internal"} |
6672 | |
6673 | type component MyCompA { |
6674 | port loopbackPort pt_myPortA; |
6675 | var integer MyInt; |
6676 | } |
6677 | |
6678 | |
6679 | type component GeneralComp extends MyCompA { |
6680 | port loopbackPort pt_myPortB; |
6681 | var integer MyInt; //error: name clash from parent type |
6682 | } |
6683 | |
6684 | testcase TC_NegSyn_060210_ReuseofComponentTypes_003() runs on GeneralComp { |
6685 | |
6686 | pt_myPortA.send(2); |
6687 | pt_myPortB.send(2.0); |
6688 | } |
6689 | |
6690 | control{ |
6691 | execute(TC_NegSyn_060210_ReuseofComponentTypes_003()); |
6692 | } |
6693 | } |
6694 | <END_MODULE> |
6695 | |
6696 | <RESULT COUNT 1> |
6697 | error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_003.MyCompA |
6698 | <END_RESULT> |
6699 | |
6700 | <END_TC> |
6701 | :exmp |
6702 | |
6703 | *---------------------------------------------------------------------* |
6704 | :h3. NegSem_06021301_LengthSubtyping_001 negative test |
6705 | .*---------------------------------------------------------------------* |
6706 | :xmp tab=0. |
6707 | |
6708 | <TC - The length subtyping check for 'record of' or 'set of' types > |
6709 | |
6710 | <COMPILE> |
6711 | |
6712 | <MODULE TTCN NegSem_06021301_LengthSubtyping_001 NegSem_06021301_LengthSubtyping_001.ttcn > |
6713 | /*************************************************** |
6714 | ** @version 0.0.1 |
6715 | ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types |
6716 | ** @verdict pass reject |
6717 | ***************************************************/ |
6718 | module NegSem_06021301_LengthSubtyping_001 { |
6719 | type record length(0..10) of integer RecordOfLengthLessThan10; |
6720 | |
6721 | type RecordOfLengthLessThan10 RecordOfLength4To5 length(4..5); |
6722 | type RecordOfLength4To5 RecordOfLength6 length(6); //length out of parent type range |
6723 | |
6724 | } |
6725 | <END_MODULE> |
6726 | |
6727 | <RESULT COUNT 1> |
6728 | error: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(6\) is not subset of subtype length\(4..5\) |
6729 | <END_RESULT> |
6730 | |
6731 | <END_TC> |
6732 | :exmp |
6733 | |
6734 | *---------------------------------------------------------------------* |
6735 | :h3. NegSem_06021301_LengthSubtyping_002 negative test |
6736 | .*---------------------------------------------------------------------* |
6737 | :xmp tab=0. |
6738 | |
6739 | <TC - The length subtyping check for 'record of' or 'set of' types > |
6740 | |
6741 | <COMPILE> |
6742 | |
6743 | <MODULE TTCN NegSem_06021301_LengthSubtyping_002 NegSem_06021301_LengthSubtyping_002.ttcn > |
6744 | /*************************************************** |
6745 | ** @version 0.0.1 |
6746 | ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types |
6747 | ** @verdict pass reject |
6748 | ***************************************************/ |
6749 | module NegSem_06021301_LengthSubtyping_002 { |
6750 | type set length(0..10) of integer SetOfLengthLessThan10; |
6751 | |
6752 | type SetOfLengthLessThan10 SetOfLength4To5 length(4..5); |
6753 | type SetOfLength4To5 SetOfLength6 length(6); //length out of parent type range |
6754 | |
6755 | } |
6756 | <END_MODULE> |
6757 | |
6758 | <RESULT COUNT 1> |
6759 | error: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(6\) is not subset of subtype length\(4..5\) |
6760 | <END_RESULT> |
6761 | |
6762 | <END_TC> |
6763 | :exmp |
6764 | |
6765 | *---------------------------------------------------------------------* |
6766 | :h3. NegSem_06021301_LengthSubtyping_003 negative test |
6767 | .*---------------------------------------------------------------------* |
6768 | :xmp tab=0. |
6769 | |
6770 | <TC - The length subtyping check for 'record of' or 'set of' types > |
6771 | |
6772 | <COMPILE> |
6773 | |
6774 | <MODULE TTCN NegSem_06021301_LengthSubtyping_003 NegSem_06021301_LengthSubtyping_003.ttcn > |
6775 | /*************************************************** |
6776 | ** @version 0.0.1 |
6777 | ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types |
6778 | ** @verdict pass reject |
6779 | ***************************************************/ |
6780 | module NegSem_06021301_LengthSubtyping_003 { |
6781 | type record length(0..!10) of integer RecordOfLengthLessThan10; //only inclusive boundary is allowed |
6782 | |
6783 | type RecordOfLengthLessThan10 RecordOfLength4To5 length(4..5); |
6784 | |
6785 | } |
6786 | <END_MODULE> |
6787 | |
6788 | <RESULT COUNT 1> |
6789 | error: at or before token `!': syntax error, unexpected '!' |
6790 | <END_RESULT> |
6791 | |
6792 | <END_TC> |
6793 | :exmp |
6794 | |
6795 | *---------------------------------------------------------------------* |
6796 | :h3. NegSem_06021301_LengthSubtyping_004 negative test |
6797 | .*---------------------------------------------------------------------* |
6798 | :xmp tab=0. |
6799 | |
6800 | <TC - The length subtyping check for 'record of' or 'set of' types > |
6801 | |
6802 | <COMPILE> |
6803 | |
6804 | <MODULE TTCN NegSem_06021301_LengthSubtyping_004 NegSem_06021301_LengthSubtyping_004.ttcn > |
6805 | /*************************************************** |
6806 | ** @version 0.0.1 |
6807 | ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types |
6808 | ** @verdict pass reject |
6809 | ***************************************************/ |
6810 | module NegSem_06021301_LengthSubtyping_004 { |
6811 | type set length(0..10) of integer SetOfLengthLessThan10; |
6812 | |
6813 | type SetOfLengthLessThan10 SetOfLength5 length(!4..5); //only inclusive boundary is allowed |
6814 | |
6815 | } |
6816 | <END_MODULE> |
6817 | |
6818 | <RESULT COUNT 1> |
6819 | error: at or before token `!': syntax error, unexpected '!' |
6820 | <END_RESULT> |
6821 | |
6822 | <END_TC> |
6823 | :exmp |
6824 | |
6825 | *---------------------------------------------------------------------* |
6826 | :h3. NegSem_06021302_ListSubtyping_001 negative test |
6827 | .*---------------------------------------------------------------------* |
6828 | :xmp tab=0. |
6829 | |
6830 | <TC - ensure that list subtyping check for record types is properly handled > |
6831 | |
6832 | <COMPILE> |
6833 | |
6834 | <MODULE TTCN NegSem_06021302_ListSubtyping_001 NegSem_06021302_ListSubtyping_001.ttcn > |
6835 | /*************************************************** |
6836 | ** @version 0.0.1 |
6837 | ** @purpose 1:6.2.13.2, ensure that list subtyping check for record types is properly handled |
6838 | ** @verdict pass reject |
6839 | ***************************************************/ |
6840 | module NegSem_06021302_ListSubtyping_001 { |
6841 | type record MyRecord { |
6842 | integer f1 optional, |
6843 | charstring f2, |
6844 | charstring f3 |
6845 | } |
6846 | |
6847 | type MyRecord MyRecordSub1 ( |
6848 | { f1 := omit, f2 := "user", f3 := "password" }, |
6849 | { f1 := 1, f2 := "User", f3 := "Password" } |
6850 | ); // a valid subtype of MyRecord containing 2 values |
6851 | |
6852 | type MyRecordSub1 MyRecordSub2 ( |
6853 | { f1 := 1, f2 := "user", f3 := "password" }, |
6854 | { f1 := 1, f2 := "User", f3 := "Password" } |
6855 | ); //invalid subtype, the omitted element cannot be overwritten |
6856 | |
6857 | } |
6858 | <END_MODULE> |
6859 | |
6860 | <RESULT COUNT 1> |
6861 | error: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ f1 := 1, f2 := "user", f3 := "password" \},\{ f1 := 1, f2 := "User", f3 := "Password" \}\) is not subset of subtype \(\{ f1 := omit, f2 := "user", f3 := "password" \},\{ f1 := 1, f2 := "User", f3 := "Password" \}\) |
6862 | <END_RESULT> |
6863 | |
6864 | <END_TC> |
6865 | :exmp |
6866 | |
6867 | *---------------------------------------------------------------------* |
6868 | :h3. NegSem_06021302_ListSubtyping_002 negative test |
6869 | .*---------------------------------------------------------------------* |
6870 | :xmp tab=0. |
6871 | |
6872 | <TC - ensure that list subtyping check for record types is properly handled > |
6873 | |
6874 | <COMPILE> |
6875 | |
6876 | <MODULE TTCN NegSem_06021302_ListSubtyping_002 NegSem_06021302_ListSubtyping_002.ttcn > |
6877 | /*************************************************** |
6878 | ** @version 0.0.1 |
6879 | ** @purpose 1:6.2.13.2, ensure that list subtyping check for record types is properly handled |
6880 | ** @verdict pass reject |
6881 | ***************************************************/ |
6882 | module NegSem_06021302_ListSubtyping_002 { |
6883 | type record MyRecord { |
6884 | integer f1 optional, |
6885 | charstring f2, |
6886 | charstring f3 |
6887 | } |
6888 | |
6889 | type MyRecord MyRecordSub1 ( |
6890 | { f1 := -, f2 := "user", f3 := "password" }, |
6891 | { f1 := -, f2 := "User", f3 := "Password" } |
6892 | ); // a valid subtype of MyRecord containing 2 values |
6893 | |
6894 | type MyRecordSub1 MyRecordSub2 ( |
6895 | { f1 := 1, f2 := "user", f3 := "password" }, |
6896 | { f1 := 2, f2 := "user", f3 := "Password" } |
6897 | ); //invalid subtype, contains wrong combination of f2 and f3 |
6898 | |
6899 | } |
6900 | <END_MODULE> |
6901 | |
6902 | <RESULT COUNT 1> |
6903 | error: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ f1 := 1, f2 := "user", f3 := "password" \},\{ f1 := 2, f2 := "user", f3 := "Password" \}\) is not subset of subtype \(\{ f1 := -, f2 := "user", f3 := "password" \},\{ f1 := -, f2 := "User", f3 := "Password" \}\) |
6904 | <END_RESULT> |
6905 | |
6906 | <END_TC> |
6907 | :exmp |
6908 | |
6909 | .*---------------------------------------------------------------------* |
6910 | :h2. 0603_type_compatibility folder |
6911 | .*---------------------------------------------------------------------* |
6912 | |
6913 | *---------------------------------------------------------------------* |
6914 | :h3. NegSem_060301_non_structured_types_007 negative test |
6915 | .*---------------------------------------------------------------------* |
6916 | :xmp tab=0. |
6917 | |
6918 | <TC - Ensure that the IUT correctly handles assignments from compatible size restrictions > |
6919 | |
6920 | <COMPILE> |
6921 | |
6922 | <MODULE TTCN NegSem_060301_non_structured_types_007 NegSem_060301_non_structured_types_007.ttcn > |
6923 | /*************************************************** |
6924 | ** @version 0.0.1 |
6925 | ** @purpose 1:6.3.1, Ensure that the IUT correctly handles assignments from compatible size restrictions |
6926 | ** @verdict pass reject |
6927 | ***************************************************/ |
6928 | |
6929 | module NegSem_060301_non_structured_types_007 { |
6930 | type integer ConstrainedInt[1]; |
6931 | |
6932 | type component GeneralComp { |
6933 | } |
6934 | |
6935 | testcase TC_NegSem_060301_non_structured_types_007() runs on GeneralComp { |
6936 | |
6937 | var integer v_int[2]:={5,4}; |
6938 | var ConstrainedInt v_constrainedInt; |
6939 | |
6940 | |
6941 | v_constrainedInt:=v_int; // length 2 array assigned to length 1 array type |
6942 | } |
6943 | |
6944 | control{ |
6945 | execute(TC_NegSem_060301_non_structured_types_007()); |
6946 | } |
6947 | |
6948 | } |
6949 | <END_MODULE> |
6950 | |
6951 | <RESULT COUNT 1> |
6952 | error: Type mismatch: a value of type `integer\[1\]' was expected instead of `integer\[2\]' |
6953 | <END_RESULT> |
6954 | |
6955 | <END_TC> |
6956 | :exmp |
6957 | |
6958 | *---------------------------------------------------------------------* |
6959 | :h3. NegSem_060301_non_structured_types_008 negative test |
6960 | .*---------------------------------------------------------------------* |
6961 | :xmp tab=0. |
6962 | |
6963 | <TC - Ensure that the IUT correctly handles assignments from compatible size restrictions > |
6964 | |
6965 | <COMPILE> |
6966 | |
6967 | <MODULE TTCN NegSem_060301_non_structured_types_008 NegSem_060301_non_structured_types_008.ttcn > |
6968 | /*************************************************** |
6969 | ** @version 0.0.1 |
6970 | ** @purpose 1:6.3.1, Ensure that the IUT correctly handles assignments from compatible size restrictions |
6971 | ** @verdict pass reject |
6972 | ***************************************************/ |
6973 | |
6974 | module NegSem_060301_non_structured_types_008 { |
6975 | type float ConstrainedFloat[1]; |
6976 | |
6977 | type component GeneralComp { |
6978 | } |
6979 | |
6980 | testcase TC_NegSem_060301_non_structured_types_008() runs on GeneralComp { |
6981 | |
6982 | var float v_float[2]:={5.0,4.0}; |
6983 | var ConstrainedFloat v_constrainedFloat; |
6984 | |
6985 | |
6986 | v_constrainedFloat:=v_float; // length 2 array assigned to length 1 array type |
6987 | } |
6988 | |
6989 | control{ |
6990 | execute(TC_NegSem_060301_non_structured_types_008()); |
6991 | } |
6992 | |
6993 | } |
6994 | <END_MODULE> |
6995 | |
6996 | <RESULT COUNT 1> |
6997 | error: Type mismatch: a value of type `float\[1\]' was expected instead of `float\[2\]' |
6998 | <END_RESULT> |
6999 | |
7000 | <END_TC> |
7001 | :exmp |
7002 | |
7003 | *---------------------------------------------------------------------* |
7004 | :h3. NegSem_060302_structured_types_001 negative test |
7005 | .*---------------------------------------------------------------------* |
7006 | :xmp tab=0. |
7007 | |
7008 | <TC - Reject assignment of other enumerated types since they are only compatible to synonym types > |
7009 | |
7010 | <COMPILE> |
7011 | |
7012 | <MODULE TTCN NegSem_060302_structured_types_001 NegSem_060302_structured_types_001.ttcn > |
7013 | /*************************************************** |
7014 | ** @version 0.0.1 |
7015 | ** @purpose 1:6.3.2.1, Reject assignment of other enumerated types since they are only compatible to synonym types |
7016 | ** @verdict pass reject |
7017 | ***************************************************/ |
7018 | |
7019 | module NegSem_060302_structured_types_001 { |
7020 | |
7021 | type enumerated EnumeratedType {e_black, e_white}; |
7022 | type enumerated EnumeratedRedefinition {e_black, e_white}; |
7023 | |
7024 | type component GeneralComp { |
7025 | } |
7026 | |
7027 | testcase TC_NegSem_060302_structured_types_001() runs on GeneralComp { |
7028 | |
7029 | var EnumeratedType v_enum1:=e_black; |
7030 | var EnumeratedRedefinition v_enum2; |
7031 | |
7032 | v_enum2:=v_enum1; // not a synonym type |
7033 | setverdict(pass); |
7034 | } |
7035 | |
7036 | control{ |
7037 | execute(TC_NegSem_060302_structured_types_001()); |
7038 | } |
7039 | |
7040 | } |
7041 | <END_MODULE> |
7042 | |
7043 | <RESULT COUNT 1> |
7044 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_001.EnumeratedRedefinition' was expected instead of `@NegSem_060302_structured_types_001.EnumeratedType' |
7045 | <END_RESULT> |
7046 | |
7047 | <END_TC> |
7048 | :exmp |
7049 | |
7050 | *---------------------------------------------------------------------* |
7051 | :h3. NegSem_060302_structured_types_002 negative test |
7052 | .*---------------------------------------------------------------------* |
7053 | :xmp tab=0. |
7054 | |
7055 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7056 | |
7057 | <COMPILE> |
7058 | |
7059 | <MODULE TTCN NegSem_060302_structured_types_002 NegSem_060302_structured_types_002.ttcn > |
7060 | /*************************************************** |
7061 | ** @version 0.0.1 |
7062 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7063 | ** @verdict pass reject |
7064 | ***************************************************/ |
7065 | |
7066 | module NegSem_060302_structured_types_002 { |
7067 | |
7068 | type record RecordType1 { |
7069 | integer a(0..10) optional, |
7070 | integer b(0..5) optional, |
7071 | boolean c |
7072 | } |
7073 | type record RecordType2 { |
7074 | integer e optional, |
7075 | integer f(0..10) , |
7076 | boolean g |
7077 | } |
7078 | |
7079 | type component GeneralComp { |
7080 | } |
7081 | |
7082 | testcase TC_NegSem_060302_structured_types_002() runs on GeneralComp { |
7083 | |
7084 | var RecordType1 v_rec1:={a:=4,b:=omit,c:=false}; |
7085 | var RecordType2 v_rec2; |
7086 | |
7087 | v_rec2:=v_rec1; // optionality mismatch (e.g. b is optional where f is mandatory) |
7088 | setverdict(pass); |
7089 | } |
7090 | |
7091 | control{ |
7092 | execute(TC_NegSem_060302_structured_types_002()); |
7093 | } |
7094 | |
7095 | } |
7096 | <END_MODULE> |
7097 | |
7098 | <RESULT COUNT 1> |
7099 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_002.RecordType2' was expected instead of `@NegSem_060302_structured_types_002.RecordType1' |
7100 | <END_RESULT> |
7101 | |
7102 | <END_TC> |
7103 | :exmp |
7104 | |
7105 | *---------------------------------------------------------------------* |
7106 | :h3. NegSem_060302_structured_types_003 negative test |
7107 | .*---------------------------------------------------------------------* |
7108 | :xmp tab=0. |
7109 | |
7110 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7111 | |
7112 | <COMPILE> |
7113 | |
7114 | <MODULE TTCN NegSem_060302_structured_types_003 NegSem_060302_structured_types_003.ttcn > |
7115 | /*************************************************** |
7116 | ** @version 0.0.1 |
7117 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7118 | ** @verdict pass reject |
7119 | ***************************************************/ |
7120 | |
7121 | module NegSem_060302_structured_types_003 { |
7122 | |
7123 | type record RecordType { |
7124 | integer a(0..10) optional, |
7125 | integer b(0..10) optional, |
7126 | boolean c |
7127 | } |
7128 | type record ModifiedRecord { |
7129 | integer e optional, |
7130 | integer f(0..5) optional, |
7131 | boolean g |
7132 | } |
7133 | |
7134 | |
7135 | type component GeneralComp { |
7136 | } |
7137 | |
7138 | testcase TC_NegSem_060302_structured_types_003() runs on GeneralComp { |
7139 | |
7140 | var ModifiedRecord v_rec1:={e:=15,f:=4,g:=false}; |
7141 | var RecordType v_rec2; |
7142 | |
7143 | v_rec2:=v_rec1; //subtyping range mismatch |
7144 | setverdict(pass); |
7145 | |
7146 | } |
7147 | |
7148 | control{ |
7149 | execute(TC_NegSem_060302_structured_types_003()); |
7150 | } |
7151 | |
7152 | } |
7153 | <END_MODULE> |
7154 | |
7155 | <RESULT COUNT 1> |
7156 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_003.RecordType' was expected instead of `@NegSem_060302_structured_types_003.ModifiedRecord' |
7157 | <END_RESULT> |
7158 | |
7159 | <END_TC> |
7160 | :exmp |
7161 | |
7162 | *---------------------------------------------------------------------* |
7163 | :h3. NegSem_060302_structured_types_004 negative test |
7164 | .*---------------------------------------------------------------------* |
7165 | :xmp tab=0. |
7166 | |
7167 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7168 | |
7169 | <COMPILE> |
7170 | |
7171 | <MODULE TTCN NegSem_060302_structured_types_004 NegSem_060302_structured_types_004.ttcn > |
7172 | /*************************************************** |
7173 | ** @version 0.0.1 |
7174 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7175 | ** @verdict pass reject |
7176 | ***************************************************/ |
7177 | |
7178 | module NegSem_060302_structured_types_004 { |
7179 | |
7180 | type set SetType { |
7181 | integer a(0..10) optional, |
7182 | integer b(0..10) optional, |
7183 | boolean c |
7184 | } |
7185 | type set ModifiedSet { |
7186 | integer e optional, |
7187 | integer f(0..5) , |
7188 | boolean g |
7189 | } |
7190 | |
7191 | type component GeneralComp { |
7192 | } |
7193 | |
7194 | testcase TC_NegSem_060302_structured_types_004() runs on GeneralComp { |
7195 | |
7196 | var ModifiedSet v_set1:={f:=4,e:=8,g:=false}; |
7197 | var SetType v_set2; |
7198 | |
7199 | v_set2:=v_set1; //optionality mismatch |
7200 | setverdict(pass); |
7201 | |
7202 | } |
7203 | |
7204 | control{ |
7205 | execute(TC_NegSem_060302_structured_types_004()); |
7206 | } |
7207 | |
7208 | } |
7209 | <END_MODULE> |
7210 | |
7211 | <RESULT COUNT 1> |
7212 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_004.SetType' was expected instead of `@NegSem_060302_structured_types_004.ModifiedSet' |
7213 | <END_RESULT> |
7214 | |
7215 | <END_TC> |
7216 | :exmp |
7217 | |
7218 | *---------------------------------------------------------------------* |
7219 | :h3. NegSem_060302_structured_types_005 negative test |
7220 | .*---------------------------------------------------------------------* |
7221 | :xmp tab=0. |
7222 | |
7223 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7224 | |
7225 | <COMPILE> |
7226 | |
7227 | <MODULE TTCN NegSem_060302_structured_types_005 NegSem_060302_structured_types_005.ttcn > |
7228 | /*************************************************** |
7229 | ** @version 0.0.1 |
7230 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7231 | ** @verdict pass reject |
7232 | ***************************************************/ |
7233 | |
7234 | module NegSem_060302_structured_types_005 { |
7235 | |
7236 | type set SetType { |
7237 | integer a(0..10) optional, |
7238 | integer b(0..10) optional, |
7239 | boolean c |
7240 | } |
7241 | type set ModifiedSet { |
7242 | integer e optional, |
7243 | integer f(0..5) optional, |
7244 | boolean g |
7245 | } |
7246 | |
7247 | type component GeneralComp { |
7248 | } |
7249 | |
7250 | testcase TC_NegSem_060302_structured_types_005() runs on GeneralComp { |
7251 | |
7252 | var ModifiedSet v_set1:={f:=4,e:=15,g:=false}; |
7253 | var SetType v_set2; |
7254 | |
7255 | v_set2:=v_set1; //subtyping range mismatch |
7256 | setverdict(pass); |
7257 | |
7258 | } |
7259 | |
7260 | control{ |
7261 | execute(TC_NegSem_060302_structured_types_005()); |
7262 | } |
7263 | |
7264 | } |
7265 | <END_MODULE> |
7266 | |
7267 | <RESULT COUNT 1> |
7268 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_005.SetType' was expected instead of `@NegSem_060302_structured_types_005.ModifiedSet' |
7269 | <END_RESULT> |
7270 | |
7271 | <END_TC> |
7272 | :exmp |
7273 | |
7274 | *---------------------------------------------------------------------* |
7275 | :h3. NegSem_060302_structured_types_008 negative test |
7276 | .*---------------------------------------------------------------------* |
7277 | :xmp tab=0. |
7278 | |
7279 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7280 | |
7281 | <COMPILE> |
7282 | |
7283 | <MODULE TTCN NegSem_060302_structured_types_008 NegSem_060302_structured_types_008.ttcn > |
7284 | /*************************************************** |
7285 | ** @version 0.0.1 |
7286 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7287 | ** @verdict pass reject |
7288 | ***************************************************/ |
7289 | |
7290 | module NegSem_060302_structured_types_008 { |
7291 | |
7292 | type enumerated EnumeratedType {e_black, e_white}; |
7293 | type EnumeratedType EnumeratedSynonym; |
7294 | |
7295 | type union UnionType { |
7296 | integer a(0..10), |
7297 | EnumeratedType b, |
7298 | boolean c |
7299 | } |
7300 | |
7301 | type union ModifiedUnion { |
7302 | integer a, |
7303 | boolean c, |
7304 | EnumeratedSynonym b |
7305 | } |
7306 | |
7307 | type component GeneralComp { |
7308 | } |
7309 | |
7310 | testcase TC_NegSem_060302_structured_types_008() runs on GeneralComp { |
7311 | |
7312 | var ModifiedUnion v_union1:={a:=12}; |
7313 | var UnionType v_union2; |
7314 | |
7315 | v_union2:=v_union1; //subtyping range mismatch |
7316 | setverdict(pass); |
7317 | |
7318 | } |
7319 | |
7320 | control{ |
7321 | execute(TC_NegSem_060302_structured_types_008()); |
7322 | } |
7323 | |
7324 | } |
7325 | <END_MODULE> |
7326 | |
7327 | <RESULT COUNT 1> |
7328 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_008.UnionType' was expected instead of `@NegSem_060302_structured_types_008.ModifiedUnion' |
7329 | <END_RESULT> |
7330 | |
7331 | <END_TC> |
7332 | :exmp |
7333 | |
7334 | *---------------------------------------------------------------------* |
7335 | :h3. NegSem_060302_structured_types_009 negative test |
7336 | .*---------------------------------------------------------------------* |
7337 | :xmp tab=0. |
7338 | |
7339 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7340 | |
7341 | <COMPILE> |
7342 | |
7343 | <MODULE TTCN NegSem_060302_structured_types_009 NegSem_060302_structured_types_009.ttcn > |
7344 | /*************************************************** |
7345 | ** @version 0.0.1 |
7346 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7347 | ** @verdict pass reject |
7348 | ***************************************************/ |
7349 | |
7350 | module NegSem_060302_structured_types_009 { |
7351 | |
7352 | type enumerated EnumeratedType {e_black, e_white}; |
7353 | type enumerated EnumeratedRedefinition {e_black, e_white}; |
7354 | |
7355 | type union UnionType { |
7356 | integer a(0..10), |
7357 | EnumeratedType b, |
7358 | boolean c |
7359 | } |
7360 | type union ModifiedUnion { |
7361 | integer a, |
7362 | boolean c, |
7363 | EnumeratedRedefinition b |
7364 | } |
7365 | |
7366 | type component GeneralComp { |
7367 | } |
7368 | |
7369 | testcase TC_NegSem_060302_structured_types_009() runs on GeneralComp { |
7370 | |
7371 | var ModifiedUnion v_union1:={b:=e_black}; |
7372 | var UnionType v_union2; |
7373 | |
7374 | v_union2:=v_union1; //enumerated type mismatch |
7375 | setverdict(pass); |
7376 | } |
7377 | |
7378 | control{ |
7379 | execute(TC_NegSem_060302_structured_types_009()); |
7380 | } |
7381 | |
7382 | } |
7383 | <END_MODULE> |
7384 | |
7385 | <RESULT COUNT 1> |
7386 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_009.UnionType' was expected instead of `@NegSem_060302_structured_types_009.ModifiedUnion' |
7387 | <END_RESULT> |
7388 | |
7389 | <END_TC> |
7390 | :exmp |
7391 | |
7392 | *---------------------------------------------------------------------* |
7393 | :h3. NegSem_060302_structured_types_010 negative test |
7394 | .*---------------------------------------------------------------------* |
7395 | :xmp tab=0. |
7396 | |
7397 | <TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > |
7398 | |
7399 | <COMPILE> |
7400 | |
7401 | <MODULE TTCN NegSem_060302_structured_types_010 NegSem_060302_structured_types_010.ttcn > |
7402 | /*************************************************** |
7403 | ** @version 0.0.1 |
7404 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges |
7405 | ** @verdict pass reject |
7406 | ***************************************************/ |
7407 | |
7408 | module NegSem_060302_structured_types_010 { |
7409 | |
7410 | type enumerated EnumeratedType {e_black, e_white}; |
7411 | type EnumeratedType EnumeratedSynonym; |
7412 | |
7413 | type union UnionType { |
7414 | integer a, |
7415 | EnumeratedType b, |
7416 | boolean c |
7417 | } |
7418 | type union ModifiedUnion { |
7419 | integer aa, |
7420 | boolean cc, |
7421 | EnumeratedSynonym bb |
7422 | } |
7423 | |
7424 | |
7425 | type component GeneralComp { |
7426 | } |
7427 | |
7428 | testcase TC_NegSem_060302_structured_types_010() runs on GeneralComp { |
7429 | |
7430 | var ModifiedUnion v_union1:={aa:=1}; |
7431 | var UnionType v_union2; |
7432 | |
7433 | v_union2:=v_union1; //element naming mismatch |
7434 | setverdict(pass); |
7435 | |
7436 | } |
7437 | |
7438 | control{ |
7439 | execute(TC_NegSem_060302_structured_types_010()); |
7440 | } |
7441 | |
7442 | } |
7443 | <END_MODULE> |
7444 | |
7445 | <RESULT COUNT 1> |
7446 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_010.UnionType' was expected instead of `@NegSem_060302_structured_types_010.ModifiedUnion' |
7447 | <END_RESULT> |
7448 | |
7449 | <END_TC> |
7450 | :exmp |
7451 | |
7452 | *---------------------------------------------------------------------* |
7453 | :h3. NegSem_060302_structured_types_011 negative test |
7454 | .*---------------------------------------------------------------------* |
7455 | :xmp tab=0. |
7456 | |
7457 | <TC - Ensure that the IUT rejects assignments from structures having incompatible anytypes > |
7458 | |
7459 | <COMPILE> |
7460 | |
7461 | <MODULE TTCN NegSem_060302_structured_types_011 NegSem_060302_structured_types_011.ttcn > |
7462 | /*************************************************** |
7463 | ** @version 0.0.1 |
7464 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from structures having incompatible anytypes |
7465 | ** @verdict pass reject |
7466 | ***************************************************/ |
7467 | module NegSem_060302_structured_types_011 { |
7468 | |
7469 | import from NegSem_060302_structured_types_011_importA all; |
7470 | import from NegSem_060302_structured_types_011_importB all; |
7471 | |
7472 | type component GeneralComp { |
7473 | } |
7474 | |
7475 | testcase TC_NegSem_060302_structured_types_011() runs on GeneralComp { |
7476 | |
7477 | var NegSem_060302_structured_types_011_importA.Atype v_a; |
7478 | var NegSem_060302_structured_types_011_importB.Atype v_b := { F := 1 } |
7479 | |
7480 | v_a:=v_b; //v_a's type does not contain the selected alternative |
7481 | |
7482 | if ( v_a==1 ) { |
7483 | setverdict(pass); |
7484 | } |
7485 | else { |
7486 | setverdict(fail); |
7487 | } |
7488 | } |
7489 | |
7490 | control{ |
7491 | execute(TC_NegSem_060302_structured_types_011()); |
7492 | } |
7493 | |
7494 | } |
7495 | <END_MODULE> |
7496 | |
7497 | <MODULE TTCN NegSem_060302_structured_types_011_importA NegSem_060302_structured_types_011_importA.ttcn > |
7498 | module NegSem_060302_structured_types_011_importA { |
7499 | type integer I (0..2); |
7500 | type anytype Atype; |
7501 | } |
7502 | <END_MODULE> |
7503 | |
7504 | <MODULE TTCN NegSem_060302_structured_types_011_importB NegSem_060302_structured_types_011_importB.ttcn > |
7505 | module NegSem_060302_structured_types_011_importB { |
7506 | type integer I (0..2); |
7507 | type integer F; |
7508 | type anytype Atype; |
7509 | } |
7510 | <END_MODULE> |
7511 | |
7512 | <RESULT COUNT 1> |
7513 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_011_importA.anytype' was expected instead of `@NegSem_060302_structured_types_011_importB.anytype' |
7514 | <END_RESULT> |
7515 | <RESULT COUNT 1> |
7516 | error: The operands of operation `==' should be of compatible types |
7517 | <END_RESULT> |
7518 | |
7519 | <END_TC> |
7520 | :exmp |
7521 | |
7522 | *---------------------------------------------------------------------* |
7523 | :h3. NegSem_060302_structured_types_012 negative test |
7524 | .*---------------------------------------------------------------------* |
7525 | :xmp tab=0. |
7526 | |
7527 | <TC - Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements > |
7528 | |
7529 | <COMPILE> |
7530 | |
7531 | <MODULE TTCN NegSem_060302_structured_types_012 NegSem_060302_structured_types_012.ttcn > |
7532 | /*************************************************** |
7533 | ** @version 0.0.1 |
7534 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements |
7535 | ** @verdict pass reject |
7536 | ***************************************************/ |
7537 | |
7538 | module NegSem_060302_structured_types_012 { |
7539 | |
7540 | type record RecordType { |
7541 | integer a, |
7542 | integer b optional |
7543 | } |
7544 | |
7545 | type set SetType { |
7546 | integer a, |
7547 | integer b optional |
7548 | } |
7549 | |
7550 | type record length (1..2) of integer ShortIntegerList; |
7551 | type record of integer IntegerList; |
7552 | |
7553 | type set length (1..2) of integer ShortUnorderedIntegerList; |
7554 | type set of integer UnorderedIntegerList; |
7555 | |
7556 | |
7557 | type component GeneralComp { |
7558 | } |
7559 | |
7560 | testcase TC_NegSem_060302_structured_types_012() runs on GeneralComp { |
7561 | |
7562 | |
7563 | var IntegerList v_list1:={1,-}; |
7564 | var ShortIntegerList v_list2; |
7565 | var RecordType v_rec1; |
7566 | var UnorderedIntegerList v_ulist1:={1,-}; |
7567 | var ShortUnorderedIntegerList v_ulist2; |
7568 | var SetType v_set1; |
7569 | |
7570 | var integer v_matcher[2] := {1,-}; |
7571 | |
7572 | var boolean v_check1; |
7573 | |
7574 | v_list2:=v_list1; |
7575 | v_rec1:=v_list2; |
7576 | v_ulist2:=v_ulist1; |
7577 | v_set1:=v_ulist2; |
7578 | |
7579 | v_check1 := match(v_rec1, v_matcher); //mismatch between undefined and omitted elements |
7580 | |
7581 | } |
7582 | |
7583 | control{ |
7584 | execute(TC_NegSem_060302_structured_types_012()); |
7585 | } |
7586 | |
7587 | } |
7588 | <END_MODULE> |
7589 | |
7590 | <RESULT COUNT 1> |
7591 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.RecordType' was expected instead of `@NegSem_060302_structured_types_012.ShortIntegerList' |
7592 | <END_RESULT> |
7593 | <RESULT COUNT 1> |
7594 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.SetType' was expected instead of `@NegSem_060302_structured_types_012.ShortUnorderedIntegerList' |
7595 | <END_RESULT> |
7596 | <RESULT COUNT 1> |
7597 | error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_012.RecordType' |
7598 | <END_RESULT> |
7599 | |
7600 | <END_TC> |
7601 | :exmp |
7602 | |
7603 | *---------------------------------------------------------------------* |
7604 | :h3. NegSem_060302_structured_types_013 negative test |
7605 | .*---------------------------------------------------------------------* |
7606 | :xmp tab=0. |
7607 | |
7608 | <TC - Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements > |
7609 | |
7610 | <COMPILE> |
7611 | |
7612 | <MODULE TTCN NegSem_060302_structured_types_013 NegSem_060302_structured_types_013.ttcn > |
7613 | /*************************************************** |
7614 | ** @version 0.0.1 |
7615 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements |
7616 | ** @verdict pass reject |
7617 | ***************************************************/ |
7618 | |
7619 | module NegSem_060302_structured_types_013 { |
7620 | |
7621 | type record RecordType { |
7622 | integer a, |
7623 | integer b optional |
7624 | } |
7625 | |
7626 | type set SetType { |
7627 | integer a, |
7628 | integer b optional |
7629 | } |
7630 | |
7631 | type record length (1..2) of integer ShortIntegerList; |
7632 | type record of integer IntegerList; |
7633 | |
7634 | type set length (1..2) of integer ShortUnorderedIntegerList; |
7635 | type set of integer UnorderedIntegerList; |
7636 | |
7637 | |
7638 | type component GeneralComp { |
7639 | } |
7640 | |
7641 | testcase TC_NegSem_060302_structured_types_013() runs on GeneralComp { |
7642 | |
7643 | var IntegerList v_list1:={1,-}; |
7644 | var ShortIntegerList v_list2; |
7645 | var RecordType v_rec1; |
7646 | var UnorderedIntegerList v_ulist1:={1,-}; |
7647 | var ShortUnorderedIntegerList v_ulist2; |
7648 | var SetType v_set1; |
7649 | |
7650 | var integer v_matcher[2] := {1,-}; |
7651 | |
7652 | var boolean v_check1; |
7653 | |
7654 | v_list2:=v_list1; |
7655 | v_rec1:=v_list2; |
7656 | v_ulist2:=v_ulist1; |
7657 | v_set1:=v_ulist2; |
7658 | |
7659 | v_check1 := match(v_set1,{ a:= 1, b:= -}); //mismatch between undefined and omitted elements |
7660 | |
7661 | } |
7662 | |
7663 | control{ |
7664 | execute(TC_NegSem_060302_structured_types_013()); |
7665 | } |
7666 | |
7667 | } |
7668 | <END_MODULE> |
7669 | |
7670 | <RESULT COUNT 1> |
7671 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.RecordType' was expected instead of `@NegSem_060302_structured_types_013.ShortIntegerList' |
7672 | <END_RESULT> |
7673 | <RESULT COUNT 1> |
7674 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.SetType' was expected instead of `@NegSem_060302_structured_types_013.ShortUnorderedIntegerList' |
7675 | <END_RESULT> |
7676 | |
7677 | <END_TC> |
7678 | :exmp |
7679 | |
7680 | *---------------------------------------------------------------------* |
7681 | :h3. NegSem_060302_structured_types_014 negative test |
7682 | .*---------------------------------------------------------------------* |
7683 | :xmp tab=0. |
7684 | |
7685 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7686 | |
7687 | <COMPILE> |
7688 | |
7689 | <MODULE TTCN NegSem_060302_structured_types_014 NegSem_060302_structured_types_014.ttcn > |
7690 | /*************************************************** |
7691 | ** @version 0.0.1 |
7692 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures |
7693 | ** @verdict pass reject |
7694 | ***************************************************/ |
7695 | |
7696 | module NegSem_060302_structured_types_014 { |
7697 | |
7698 | type record RecordType { |
7699 | integer a, |
7700 | integer b optional, |
7701 | integer c |
7702 | } |
7703 | |
7704 | type record of integer IntegerList; |
7705 | |
7706 | |
7707 | type component GeneralComp { |
7708 | } |
7709 | |
7710 | testcase TC_NegSem_060302_structured_types_014() runs on GeneralComp { |
7711 | |
7712 | var RecordType v_record := { 1, omit, 2}; |
7713 | var IntegerList v_IntList; |
7714 | var integer v_array[2]; |
7715 | |
7716 | v_array:=v_record; //assignment between incompatible types |
7717 | |
7718 | } |
7719 | |
7720 | control{ |
7721 | execute(TC_NegSem_060302_structured_types_014()); |
7722 | } |
7723 | |
7724 | } |
7725 | <END_MODULE> |
7726 | |
7727 | <RESULT COUNT 1> |
7728 | error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_014.RecordType' |
7729 | <END_RESULT> |
7730 | |
7731 | <END_TC> |
7732 | :exmp |
7733 | |
7734 | *---------------------------------------------------------------------* |
7735 | :h3. NegSem_060302_structured_types_015 negative test |
7736 | .*---------------------------------------------------------------------* |
7737 | :xmp tab=0. |
7738 | |
7739 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7740 | |
7741 | <COMPILE> |
7742 | |
7743 | <MODULE TTCN NegSem_060302_structured_types_015 NegSem_060302_structured_types_015.ttcn > |
7744 | /*************************************************** |
7745 | ** @version 0.0.1 |
7746 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures |
7747 | ** @verdict pass reject |
7748 | ***************************************************/ |
7749 | |
7750 | module NegSem_060302_structured_types_015 { |
7751 | |
7752 | type record RecordType { |
7753 | integer a, |
7754 | integer b optional, |
7755 | integer c |
7756 | } |
7757 | |
7758 | type record of integer IntegerList; |
7759 | |
7760 | |
7761 | type component GeneralComp { |
7762 | } |
7763 | |
7764 | testcase TC_NegSem_060302_structured_types_015() runs on GeneralComp { |
7765 | |
7766 | var RecordType v_record := { 1, omit, 2}; |
7767 | var IntegerList v_IntList; |
7768 | var integer v_array[2]; |
7769 | |
7770 | v_IntList:=v_record; //assignment between incompatible types |
7771 | |
7772 | } |
7773 | |
7774 | control{ |
7775 | execute(TC_NegSem_060302_structured_types_015()); |
7776 | } |
7777 | |
7778 | } |
7779 | <END_MODULE> |
7780 | |
7781 | <RESULT COUNT 1> |
7782 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_015.IntegerList' was expected instead of `@NegSem_060302_structured_types_015.RecordType' |
7783 | <END_RESULT> |
7784 | |
7785 | <END_TC> |
7786 | :exmp |
7787 | |
7788 | *---------------------------------------------------------------------* |
7789 | :h3. NegSem_060302_structured_types_016 negative test |
7790 | .*---------------------------------------------------------------------* |
7791 | :xmp tab=0. |
7792 | |
7793 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7794 | |
7795 | <COMPILE> |
7796 | |
7797 | <MODULE TTCN NegSem_060302_structured_types_016 NegSem_060302_structured_types_016.ttcn > |
7798 | /*************************************************** |
7799 | ** @version 0.0.1 |
7800 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures |
7801 | ** @verdict pass reject |
7802 | ***************************************************/ |
7803 | |
7804 | module NegSem_060302_structured_types_016 { |
7805 | |
7806 | type set SetType { |
7807 | integer a, |
7808 | integer b optional, |
7809 | integer c |
7810 | } |
7811 | |
7812 | type set of integer IntegerList; |
7813 | |
7814 | |
7815 | type component GeneralComp { |
7816 | } |
7817 | |
7818 | testcase TC_NegSem_060302_structured_types_016() runs on GeneralComp { |
7819 | |
7820 | var SetType v_set := { a:= 1, b:= omit, c:= 2}; // value list not work with sets |
7821 | var IntegerList v_IntList; |
7822 | var integer v_array[2]; |
7823 | |
7824 | v_array:=v_set; //assignment between incompatible types |
7825 | |
7826 | } |
7827 | |
7828 | control{ |
7829 | execute(TC_NegSem_060302_structured_types_016()); |
7830 | } |
7831 | |
7832 | } |
7833 | <END_MODULE> |
7834 | |
7835 | <RESULT COUNT 1> |
7836 | error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_016.SetType' |
7837 | <END_RESULT> |
7838 | |
7839 | <END_TC> |
7840 | :exmp |
7841 | |
7842 | *---------------------------------------------------------------------* |
7843 | :h3. NegSem_060302_structured_types_017 negative test |
7844 | .*---------------------------------------------------------------------* |
7845 | :xmp tab=0. |
7846 | |
7847 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7848 | |
7849 | <COMPILE> |
7850 | |
7851 | <MODULE TTCN NegSem_060302_structured_types_017 NegSem_060302_structured_types_017.ttcn > |
7852 | /*************************************************** |
7853 | ** @version 0.0.1 |
7854 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures |
7855 | ** @verdict pass reject |
7856 | ***************************************************/ |
7857 | |
7858 | module NegSem_060302_structured_types_017 { |
7859 | |
7860 | type set SetType { |
7861 | integer a, |
7862 | integer b optional, |
7863 | integer c |
7864 | } |
7865 | |
7866 | type set of integer IntegerList; |
7867 | |
7868 | |
7869 | type component GeneralComp { |
7870 | } |
7871 | |
7872 | testcase TC_NegSem_060302_structured_types_017() runs on GeneralComp { |
7873 | |
7874 | var SetType v_set := { a:= 1, b:= omit, c:= 2}; // value list not work with sets |
7875 | var IntegerList v_IntList; |
7876 | var integer v_array[2]; |
7877 | |
7878 | v_IntList:=v_set; //assignment between incompatible types |
7879 | |
7880 | } |
7881 | |
7882 | control{ |
7883 | execute(TC_NegSem_060302_structured_types_017()); |
7884 | } |
7885 | |
7886 | } |
7887 | <END_MODULE> |
7888 | |
7889 | <RESULT COUNT 1> |
7890 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_017.IntegerList' was expected instead of `@NegSem_060302_structured_types_017.SetType' |
7891 | <END_RESULT> |
7892 | |
7893 | <END_TC> |
7894 | :exmp |
7895 | |
7896 | *---------------------------------------------------------------------* |
7897 | :h3. NegSem_060302_structured_types_018 negative test |
7898 | .*---------------------------------------------------------------------* |
7899 | :xmp tab=0. |
7900 | |
7901 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7902 | |
7903 | <COMPILE> |
7904 | |
7905 | <MODULE TTCN NegSem_060302_structured_types_018 NegSem_060302_structured_types_018.ttcn > |
7906 | /*************************************************** |
7907 | ** @version 0.0.1 |
7908 | ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures |
7909 | ** @verdict pass reject |
7910 | ***************************************************/ |
7911 | |
7912 | module NegSem_060302_structured_types_018 { |
7913 | |
7914 | type set SetType { |
7915 | integer a, |
7916 | integer b, |
7917 | integer c |
7918 | } |
7919 | |
7920 | type component GeneralComp { |
7921 | } |
7922 | |
7923 | testcase TC_NegSem_060302_structured_types_018() runs on GeneralComp { |
7924 | |
7925 | var SetType v_set := { a:= 1, b:= 2, c:= 3}; |
7926 | var integer v_array[3]; |
7927 | |
7928 | v_array:=v_set; //assignment between incompatible types, see clause G.9 compatibility rules |
7929 | |
7930 | } |
7931 | |
7932 | control{ |
7933 | execute(TC_NegSem_060302_structured_types_018()); |
7934 | } |
7935 | |
7936 | } |
7937 | <END_MODULE> |
7938 | |
7939 | <RESULT COUNT 1> |
7940 | error: Type mismatch: a value of type `integer\[3\]' was expected instead of `@NegSem_060302_structured_types_018.SetType' |
7941 | <END_RESULT> |
7942 | |
7943 | <END_TC> |
7944 | :exmp |
7945 | |
7946 | *---------------------------------------------------------------------* |
7947 | :h3. NegSem_060302_structured_types_019 negative test |
7948 | .*---------------------------------------------------------------------* |
7949 | :xmp tab=0. |
7950 | |
7951 | <TC - Ensure that the IUT rejects assignments between incompatible structures > |
7952 | |
7953 | <COMPILE> |
7954 | |
7955 | <MODULE TTCN NegSem_060302_structured_types_019 NegSem_060302_structured_types_019.ttcn > |
7956 | /*************************************************** |
7957 | ** @version 0.0.1 |
7958 | ** @purpose 1:6.3.2, Ensure that the IUT correctly handles assignments from structures having compatible types and lengths |
7959 | ** @verdict pass reject |
7960 | ***************************************************/ |
7961 | |
7962 | module NegSem_060302_structured_types_019 { |
7963 | |
7964 | type record RecordType { |
7965 | integer a, |
7966 | integer b optional |
7967 | } |
7968 | |
7969 | type set SetType { |
7970 | integer a, |
7971 | integer b optional |
7972 | } |
7973 | |
7974 | type record length (1..2) of integer ShortIntegerList; |
7975 | type record of integer IntegerList; |
7976 | |
7977 | type set length (1..2) of integer ShortUnorderedIntegerList; |
7978 | type set of integer UnorderedIntegerList; |
7979 | |
7980 | |
7981 | type component GeneralComp { |
7982 | } |
7983 | |
7984 | testcase TC_NegSem_060302_structured_types_019() runs on GeneralComp { |
7985 | |
7986 | var IntegerList v_list1:={1,-}; |
7987 | var ShortIntegerList v_list2; |
7988 | var RecordType v_rec1; |
7989 | var UnorderedIntegerList v_ulist1:={1,-}; |
7990 | var ShortUnorderedIntegerList v_ulist2; |
7991 | var SetType v_set1; |
7992 | |
7993 | var integer v_matcher[2] := {1,-}; |
7994 | |
7995 | var boolean v_check1; |
7996 | |
7997 | v_list2:=v_list1; |
7998 | v_rec1:=v_list2; //incompatible assignment according to TTCN-3:2012 |
7999 | v_ulist2:=v_ulist1; |
8000 | v_set1:=v_ulist2; //incompatible assignment according to TTCN-3:2012 |
8001 | |
8002 | v_check1 := (v_list2[0]==1); |
8003 | |
8004 | |
8005 | if ( v_check1 ) |
8006 | { |
8007 | setverdict(pass); |
8008 | } |
8009 | else { |
8010 | setverdict(fail); |
8011 | } |
8012 | } |
8013 | |
8014 | control{ |
8015 | execute(TC_NegSem_060302_structured_types_019()); |
8016 | } |
8017 | |
8018 | } |
8019 | <END_MODULE> |
8020 | |
8021 | <RESULT COUNT 1> |
8022 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.RecordType' was expected instead of `@NegSem_060302_structured_types_019.ShortIntegerList' |
8023 | <END_RESULT> |
8024 | <RESULT COUNT 1> |
8025 | error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.SetType' was expected instead of `@NegSem_060302_structured_types_019.ShortUnorderedIntegerList' |
8026 | <END_RESULT> |
8027 | |
8028 | <END_TC> |
8029 | :exmp |
8030 | |
8031 | *---------------------------------------------------------------------* |
8032 | :h3. NegSem_060303_component_types_001 negative test |
8033 | .*---------------------------------------------------------------------* |
8034 | :xmp tab=0. |
8035 | |
8036 | <TC - Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions > |
8037 | |
8038 | <COMPILE> |
8039 | |
8040 | <MODULE TTCN NegSem_060303_component_types_001 NegSem_060303_component_types_001.ttcn > |
8041 | /*************************************************** |
8042 | ** @version 0.0.1 |
8043 | ** @purpose 1:6.3.3, Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions |
8044 | ** @verdict pass reject |
8045 | ***************************************************/ |
8046 | |
8047 | module NegSem_060303_component_types_001 { |
8048 | |
8049 | type integer ConstrainedInteger(0..10); |
8050 | |
8051 | type component TestCaseComp { |
8052 | const integer c_integer:=2; |
8053 | } |
8054 | |
8055 | type component FunctionComp { |
8056 | const integer c_integer:=2; |
8057 | const ConstrainedInteger c_constrained:=2; |
8058 | } |
8059 | |
8060 | function f_testFunction(integer p_arg) runs on FunctionComp return integer { |
8061 | |
8062 | var integer v_result; |
8063 | v_result:=p_arg*c_integer; |
8064 | return v_result; |
8065 | } |
8066 | |
8067 | testcase TC_NegSem_060303_component_types_001() runs on TestCaseComp { |
8068 | |
8069 | var integer v_int:=1; |
8070 | |
8071 | v_int := f_testFunction(v_int); |
8072 | // runs on mtc with type TestCaseComp |
8073 | // f_testFunction needs to run on FunctionComp |
8074 | // which has 2 variables not 1 as TestCaseComp |
8075 | setverdict (fail, "ERROR expected: function runs on mtc with type TestCaseComp f_testFunction needs to run on FunctionComp which has 2 variables not 1 as TestCaseComp"); |
8076 | } |
8077 | |
8078 | control { |
8079 | execute(TC_NegSem_060303_component_types_001()); |
8080 | } |
8081 | |
8082 | } |
8083 | <END_MODULE> |
8084 | |
8085 | <RESULT COUNT 1> |
8086 | error: Runs on clause mismatch: A definition that runs on component type `@NegSem_060303_component_types_001.TestCaseComp' cannot call function `@NegSem_060303_component_types_001.f_testFunction', which runs on `@NegSem_060303_component_types_001.FunctionComp' |
8087 | <END_RESULT> |
8088 | |
8089 | <END_TC> |
8090 | :exmp |
8091 | |
8092 | *---------------------------------------------------------------------* |
8093 | :h3. NegSem_060303_component_types_002 negative test |
8094 | .*---------------------------------------------------------------------* |
8095 | :xmp tab=0. |
8096 | |
8097 | <TC - Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions > |
8098 | |
8099 | <COMPILE> |
8100 | |
8101 | <MODULE TTCN NegSem_060303_component_types_002 NegSem_060303_component_types_002.ttcn > |
8102 | /*************************************************** |
8103 | ** @version 0.0.1 |
8104 | ** @purpose 1:6.3.3, Ensure that the IUT correctly handles component incompatibility due to differing constant types having same name |
8105 | ** @verdict pass reject |
8106 | ***************************************************/ |
8107 | |
8108 | module NegSem_060303_component_types_002 { |
8109 | |
8110 | type integer ConstrainedInteger(0..10); |
8111 | |
8112 | type component TestCaseComp { |
8113 | const integer c_integer:=2; |
8114 | const integer c_constrained:=2; |
8115 | } |
8116 | |
8117 | type component FunctionComp { |
8118 | const integer c_integer:=2; |
8119 | const ConstrainedInteger c_constrained:=2; |
8120 | } |
8121 | |
8122 | function f_testFunction(integer p_arg) runs on FunctionComp return integer { |
8123 | |
8124 | var integer v_result; |
8125 | v_result:=p_arg*c_integer; |
8126 | return v_result; |
8127 | } |
8128 | |
8129 | testcase TC_NegSem_060303_component_types_002() runs on TestCaseComp { |
8130 | |
8131 | var integer v_int:=1; |
8132 | |
8133 | f_testFunction(v_int); |
8134 | |
8135 | setverdict(fail, "Error expected: as component types are not compatible since their definitions are not identical."); |
8136 | } |
8137 | |
8138 | control { |
8139 | execute(TC_NegSem_060303_component_types_002()); |
8140 | } |
8141 | |
8142 | } |
8143 | <END_MODULE> |
8144 | |
8145 | <RESULT COUNT 1> |
8146 | error: Runs on clause mismatch: A definition that runs on component type `@NegSem_060303_component_types_002.TestCaseComp' cannot call function `@NegSem_060303_component_types_002.f_testFunction', which runs on `@NegSem_060303_component_types_002.FunctionComp' |
8147 | <END_RESULT> |
8148 | |
8149 | <END_TC> |
8150 | :exmp |
8151 | |
8152 | .*---------------------------------------------------------------------* |
8153 | :h1.References |
8154 | .*---------------------------------------------------------------------* |
8155 | :list. |
8156 | :li D='[1]'.1/174 02-CRL 113 200/5 Uen |
8157 | :nl.Statement of Compliance for TITAN project |
8158 | :li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): |
8159 | :nl.Testing and Test Control Notation version 3., |
8160 | :nl.Part 1: TTCN-3 Core Language |
8161 | :elist. |