Commit | Line | Data |
---|---|---|
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 15_templates 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. 1503_global_and_local_templates folder | |
54 | .*---------------------------------------------------------------------* | |
55 | *---------------------------------------------------------------------* | |
56 | :h3. NegSem_1503_GlobalAndLocalTemplates_001 negative test | |
57 | .*---------------------------------------------------------------------* | |
58 | :xmp tab=0. | |
59 | ||
60 | <TC - Ensure that there's an error for re-assignment of a global non-parameterized template > | |
61 | ||
62 | <COMPILE> | |
63 | ||
64 | <MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_001 NegSem_1503_GlobalAndLocalTemplates_001.ttcn > | |
65 | /***************************************************************** | |
66 | ** @version 0.0.1 | |
67 | ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global non-parameterized template | |
68 | ** @verdict pass reject | |
69 | *****************************************************************/ | |
70 | ||
71 | // The following requirement is tested: | |
72 | // Both global and local templates are initialized at the place of their | |
73 | // declaration. This means, all template fields which are not affected by | |
74 | // parameterization shall receive a value or matching mechanism. Template | |
75 | // fields affected by parameterization are initialized at the time of | |
76 | // template use. | |
77 | module NegSem_1503_GlobalAndLocalTemplates_001 | |
78 | { | |
79 | template integer t := ?; | |
80 | type component GeneralComp { | |
81 | } | |
82 | ||
83 | testcase TC_NegSem_1503_GlobalAndLocalTemplates_001() runs on GeneralComp { | |
84 | t := 2; // error expected | |
85 | } | |
86 | } | |
87 | <END_MODULE> | |
88 | ||
89 | <RESULT COUNT 1> | |
90 | error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_001.t' | |
91 | <END_RESULT> | |
92 | ||
93 | <END_TC> | |
94 | :exmp | |
95 | ||
96 | *---------------------------------------------------------------------* | |
97 | :h3. NegSem_1503_GlobalAndLocalTemplates_002 negative test | |
98 | .*---------------------------------------------------------------------* | |
99 | :xmp tab=0. | |
100 | ||
101 | <TC - Ensure that there's an error for re-assignment of a global non-parameterized template > | |
102 | ||
103 | <COMPILE> | |
104 | ||
105 | <MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_002 NegSem_1503_GlobalAndLocalTemplates_002.ttcn > | |
106 | /***************************************************************** | |
107 | ** @version 0.0.1 | |
108 | ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global non-parameterized template | |
109 | ** @verdict pass reject | |
110 | *****************************************************************/ | |
111 | ||
112 | // The following requirement is tested: | |
113 | // Both global and local templates are initialized at the place of their | |
114 | // declaration. This means, all template fields which are not affected by | |
115 | // parameterization shall receive a value or matching mechanism. Template | |
116 | // fields affected by parameterization are initialized at the time of | |
117 | // template use. | |
118 | module NegSem_1503_GlobalAndLocalTemplates_002 | |
119 | { | |
120 | type component GeneralComp { | |
121 | } | |
122 | ||
123 | testcase TC_NegSem_1503_GlobalAndLocalTemplates_002() runs on GeneralComp { | |
124 | template integer t := ?; | |
125 | t := 2; // error expected | |
126 | } | |
127 | } | |
128 | <END_MODULE> | |
129 | ||
130 | <RESULT COUNT 1> | |
131 | error: Reference to a variable or template variable was expected instead of template `t' | |
132 | <END_RESULT> | |
133 | ||
134 | <END_TC> | |
135 | :exmp | |
136 | ||
137 | *---------------------------------------------------------------------* | |
138 | :h3. NegSem_1503_GlobalAndLocalTemplates_003 negative test | |
139 | .*---------------------------------------------------------------------* | |
140 | :xmp tab=0. | |
141 | ||
142 | <TC - Ensure that there's an error for re-assignment of a global parameterized template > | |
143 | ||
144 | <COMPILE> | |
145 | ||
146 | <MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_003 NegSem_1503_GlobalAndLocalTemplates_003.ttcn > | |
147 | /***************************************************************** | |
148 | ** @version 0.0.1 | |
149 | ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global parameterized template | |
150 | ** @verdict pass reject | |
151 | *****************************************************************/ | |
152 | ||
153 | // The following requirement is tested: | |
154 | // Both global and local templates are initialized at the place of their | |
155 | // declaration. This means, all template fields which are not affected by | |
156 | // parameterization shall receive a value or matching mechanism. Template | |
157 | // fields affected by parameterization are initialized at the time of | |
158 | // template use. | |
159 | module NegSem_1503_GlobalAndLocalTemplates_003 | |
160 | { | |
161 | template integer t(in integer p) := (0..p); | |
162 | type component GeneralComp { | |
163 | } | |
164 | testcase TC_NegSem_1503_GlobalAndLocalTemplates_003() runs on GeneralComp { | |
165 | t := 2; // error expected | |
166 | } | |
167 | } | |
168 | <END_MODULE> | |
169 | ||
170 | <RESULT COUNT 1> | |
171 | error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_003.t' | |
172 | <END_RESULT> | |
173 | <RESULT COUNT 1> | |
174 | error: Reference to parameterized definition `t' without actual parameter list | |
175 | <END_RESULT> | |
176 | ||
177 | <END_TC> | |
178 | :exmp | |
179 | ||
180 | *---------------------------------------------------------------------* | |
181 | :h3. NegSem_1503_GlobalAndLocalTemplates_004 negative test | |
182 | .*---------------------------------------------------------------------* | |
183 | :xmp tab=0. | |
184 | ||
185 | <TC - Ensure that there's an error for re-assignment of a local parameterized template > | |
186 | ||
187 | <COMPILE> | |
188 | ||
189 | <MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_004 NegSem_1503_GlobalAndLocalTemplates_004.ttcn > | |
190 | /***************************************************************** | |
191 | ** @version 0.0.1 | |
192 | ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a local parameterized template | |
193 | ** @verdict pass reject | |
194 | *****************************************************************/ | |
195 | ||
196 | // The following requirement is tested: | |
197 | // Both global and local templates are initialized at the place of their | |
198 | // declaration. This means, all template fields which are not affected by | |
199 | // parameterization shall receive a value or matching mechanism. Template | |
200 | // fields affected by parameterization are initialized at the time of | |
201 | // template use. | |
202 | module NegSem_1503_GlobalAndLocalTemplates_004 | |
203 | { | |
204 | type component GeneralComp { | |
205 | } | |
206 | testcase TC_NegSem_1503_GlobalAndLocalTemplates_004() runs on GeneralComp { | |
207 | template integer t(in integer p) := (0..p); | |
208 | t := 2; // error expected | |
209 | } | |
210 | } | |
211 | <END_MODULE> | |
212 | ||
213 | <RESULT COUNT 1> | |
214 | error: Reference to a variable or template variable was expected instead of template `t' | |
215 | <END_RESULT> | |
216 | <RESULT COUNT 1> | |
217 | error: Reference to parameterized definition `t' without actual parameter list | |
218 | <END_RESULT> | |
219 | ||
220 | <END_TC> | |
221 | :exmp | |
222 | ||
223 | *---------------------------------------------------------------------* | |
224 | :h3. NegSyn_1503_GlobalAndLocalTemplates_001 negative test | |
225 | .*---------------------------------------------------------------------* | |
226 | :xmp tab=0. | |
227 | ||
228 | <TC - Ensure that there's an error if no value is assigned in a global non-parameterized template declaration > | |
229 | ||
230 | <COMPILE> | |
231 | ||
232 | <MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_001 NegSyn_1503_GlobalAndLocalTemplates_001.ttcn > | |
233 | /***************************************************************** | |
234 | ** @version 0.0.1 | |
235 | ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a global non-parameterized template declaration | |
236 | ** @verdict pass reject | |
237 | *****************************************************************/ | |
238 | ||
239 | // The following requirement is tested: | |
240 | // Both global and local templates are initialized at the place of their | |
241 | // declaration. This means, all template fields which are not affected by | |
242 | // parameterization shall receive a value or matching mechanism. Template | |
243 | // fields affected by parameterization are initialized at the time of | |
244 | // template use. | |
245 | module NegSyn_1503_GlobalAndLocalTemplates_001 | |
246 | { | |
247 | template integer t; | |
248 | } | |
249 | <END_MODULE> | |
250 | ||
251 | <RESULT COUNT 1> | |
252 | error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' | |
253 | <END_RESULT> | |
254 | ||
255 | <END_TC> | |
256 | :exmp | |
257 | ||
258 | *---------------------------------------------------------------------* | |
259 | :h3. NegSyn_1503_GlobalAndLocalTemplates_002 negative test | |
260 | .*---------------------------------------------------------------------* | |
261 | :xmp tab=0. | |
262 | ||
263 | <TC - Ensure that there's an error if no value is assigned in a local non-parameterized template declaration > | |
264 | ||
265 | <COMPILE> | |
266 | ||
267 | <MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_002 NegSyn_1503_GlobalAndLocalTemplates_002.ttcn > | |
268 | /***************************************************************** | |
269 | ** @version 0.0.1 | |
270 | ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a local non-parameterized template declaration | |
271 | ** @verdict pass reject | |
272 | *****************************************************************/ | |
273 | ||
274 | // The following requirement is tested: | |
275 | // Both global and local templates are initialized at the place of their | |
276 | // declaration. This means, all template fields which are not affected by | |
277 | // parameterization shall receive a value or matching mechanism. Template | |
278 | // fields affected by parameterization are initialized at the time of | |
279 | // template use. | |
280 | module NegSyn_1503_GlobalAndLocalTemplates_002 | |
281 | { | |
282 | type component GeneralComp { | |
283 | } | |
284 | testcase TC_NegSyn_1503_GlobalAndLocalTemplates_002() runs on GeneralComp { | |
285 | template integer t; | |
286 | } | |
287 | } | |
288 | <END_MODULE> | |
289 | ||
290 | <RESULT COUNT 1> | |
291 | error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' | |
292 | <END_RESULT> | |
293 | ||
294 | <END_TC> | |
295 | :exmp | |
296 | ||
297 | *---------------------------------------------------------------------* | |
298 | :h3. NegSyn_1503_GlobalAndLocalTemplates_003 negative test | |
299 | .*---------------------------------------------------------------------* | |
300 | :xmp tab=0. | |
301 | ||
302 | <TC - Ensure that there's an error if no value is assigned in a global parameterized template declaration > | |
303 | ||
304 | <COMPILE> | |
305 | ||
306 | <MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_003 NegSyn_1503_GlobalAndLocalTemplates_003.ttcn > | |
307 | /***************************************************************** | |
308 | ** @version 0.0.1 | |
309 | ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a global parameterized template declaration | |
310 | ** @verdict pass reject | |
311 | *****************************************************************/ | |
312 | ||
313 | // The following requirement is tested: | |
314 | // Both global and local templates are initialized at the place of their | |
315 | // declaration. This means, all template fields which are not affected by | |
316 | // parameterization shall receive a value or matching mechanism. Template | |
317 | // fields affected by parameterization are initialized at the time of | |
318 | // template use. | |
319 | module NegSyn_1503_GlobalAndLocalTemplates_003 | |
320 | { | |
321 | template integer t(in integer p); | |
322 | } | |
323 | <END_MODULE> | |
324 | ||
325 | <RESULT COUNT 1> | |
326 | error: at or before token `;': syntax error, unexpected ';', expecting := | |
327 | <END_RESULT> | |
328 | ||
329 | <END_TC> | |
330 | :exmp | |
331 | ||
332 | *---------------------------------------------------------------------* | |
333 | :h3. NegSyn_1503_GlobalAndLocalTemplates_004 negative test | |
334 | .*---------------------------------------------------------------------* | |
335 | :xmp tab=0. | |
336 | ||
337 | <TC - Ensure that there's an error if no value is assigned in a local parameterized template declaration > | |
338 | ||
339 | <COMPILE> | |
340 | ||
341 | <MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_004 NegSyn_1503_GlobalAndLocalTemplates_004.ttcn > | |
342 | /***************************************************************** | |
343 | ** @version 0.0.1 | |
344 | ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a local parameterized template declaration | |
345 | ** @verdict pass reject | |
346 | *****************************************************************/ | |
347 | ||
348 | // The following requirement is tested: | |
349 | // Both global and local templates are initialized at the place of their | |
350 | // declaration. This means, all template fields which are not affected by | |
351 | // parameterization shall receive a value or matching mechanism. Template | |
352 | // fields affected by parameterization are initialized at the time of | |
353 | // template use. | |
354 | module NegSyn_1503_GlobalAndLocalTemplates_004 | |
355 | { | |
356 | type component GeneralComp { | |
357 | } | |
358 | testcase TC_NegSyn_1503_GlobalAndLocalTemplates_004() runs on GeneralComp { | |
359 | template integer t(in integer p); | |
360 | } | |
361 | } | |
362 | <END_MODULE> | |
363 | ||
364 | <RESULT COUNT 1> | |
365 | error: at or before token `;': syntax error, unexpected ';', expecting := | |
366 | <END_RESULT> | |
367 | ||
368 | <END_TC> | |
369 | :exmp | |
370 | ||
371 | .*---------------------------------------------------------------------* | |
372 | :h2. 1505_modified_templates folder | |
373 | .*---------------------------------------------------------------------* | |
374 | ||
375 | *---------------------------------------------------------------------* | |
376 | :h3. NegSem_1505_ModifiedTemplates_001 negative test | |
377 | .*---------------------------------------------------------------------* | |
378 | :xmp tab=0. | |
379 | ||
380 | <TC - Ensure that a modified template does not refer to itself. > | |
381 | ||
382 | <COMPILE> | |
383 | ||
384 | <MODULE TTCN NegSem_1505_ModifiedTemplates_001 NegSem_1505_ModifiedTemplates_001.ttcn > | |
385 | /***************************************************************** | |
386 | ** @version 0.0.1 | |
387 | ** @purpose 1:15.5, Ensure that a modified template does not refer to itself. | |
388 | ** @verdict pass reject | |
389 | *****************************************************************/ | |
390 | ||
391 | module NegSem_1505_ModifiedTemplates_001 { | |
392 | ||
393 | type record of integer MyMessageType; | |
394 | ||
395 | template MyMessageType m_myBaseTemplate := { 0, 1, 2, 3, 4 }; | |
396 | ||
397 | template MyMessageType m_myOtherTemplate modifies m_myOtherTemplate := { | |
398 | [2]:=3, // switch the positions of 2 and 3 | |
399 | [3]:=2 | |
400 | } | |
401 | ||
402 | } | |
403 | <END_MODULE> | |
404 | ||
405 | <RESULT COUNT 1> | |
406 | error: While checking the chain of base templates: Circular reference: `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' -> `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' | |
407 | <END_RESULT> | |
408 | ||
409 | <END_TC> | |
410 | :exmp | |
411 | ||
412 | *---------------------------------------------------------------------* | |
413 | :h3. NegSem_1505_ModifiedTemplates_002 negative test | |
414 | .*---------------------------------------------------------------------* | |
415 | :xmp tab=0. | |
416 | ||
417 | <TC - Ensure that a modified template does not omit possible parameters of the base > | |
418 | ||
419 | <COMPILE> | |
420 | ||
421 | <MODULE TTCN NegSem_1505_ModifiedTemplates_002 NegSem_1505_ModifiedTemplates_002.ttcn > | |
422 | /***************************************************************** | |
423 | ** @version 0.0.1 | |
424 | ** @purpose 1:15.5, Ensure that a modified template does not omit possible parameters of the base template. | |
425 | ** @verdict pass reject | |
426 | *****************************************************************/ | |
427 | ||
428 | module NegSem_1505_ModifiedTemplates_002 { | |
429 | ||
430 | type record MyMessageType { | |
431 | integer field1, | |
432 | charstring field2, | |
433 | boolean field3 | |
434 | } | |
435 | ||
436 | template MyMessageType m_templateOne(integer p_value) := { | |
437 | field1 := p_value, | |
438 | field2 := "Hello World", | |
439 | field3 := true | |
440 | } | |
441 | ||
442 | // illegal definition as the (integer p_value) formal parameter is missing and must | |
443 | // not be omitted. | |
444 | template MyMessageType m_templateTwo modifies m_templateOne := { | |
445 | field3 := false | |
446 | } | |
447 | ||
448 | } | |
449 | <END_MODULE> | |
450 | ||
451 | <RESULT COUNT 1> | |
452 | error: The modified template has fewer formal parameters than base template `@NegSem_1505_ModifiedTemplates_002.m_templateOne': at least 1 parameter was expected instead of 0 | |
453 | <END_RESULT> | |
454 | ||
455 | <END_TC> | |
456 | :exmp | |
457 | ||
458 | *---------------------------------------------------------------------* | |
459 | :h3. NegSem_1505_ModifiedTemplates_003 negative test | |
460 | .*---------------------------------------------------------------------* | |
461 | :xmp tab=0. | |
462 | ||
463 | <TC - Ensure that a modified template does not omit possible parameters introduced in any modification step. > | |
464 | ||
465 | <COMPILE> | |
466 | ||
467 | <MODULE TTCN NegSem_1505_ModifiedTemplates_003 NegSem_1505_ModifiedTemplates_003.ttcn > | |
468 | /***************************************************************** | |
469 | ** @version 0.0.1 | |
470 | ** @purpose 1:15.5, Ensure that a modified template does not omit possible parameters introduced in any modification step. | |
471 | ** @verdict pass reject | |
472 | *****************************************************************/ | |
473 | ||
474 | module NegSem_1505_ModifiedTemplates_003 { | |
475 | ||
476 | type record MyMessageType { | |
477 | integer field1, | |
478 | charstring field2, | |
479 | boolean field3 | |
480 | } | |
481 | ||
482 | template MyMessageType m_templateOne(integer p_intValue) := { | |
483 | field1 := p_intValue, | |
484 | field2 := "Hello World", | |
485 | field3 := true | |
486 | } | |
487 | ||
488 | template MyMessageType m_templateTwo(integer p_intValue, boolean p_boolValue) modifies m_templateOne := { | |
489 | field1 := p_intValue, | |
490 | field3 := p_boolValue | |
491 | } | |
492 | ||
493 | // illegal as it is missing the (boolean p_boolValue) formal parameter introduced in the previous | |
494 | // modification step. | |
495 | template MyMessageType m_templateThree(integer p_intValue) modifies m_templateTwo := { | |
496 | field2 := "foobar" | |
497 | } | |
498 | } | |
499 | <END_MODULE> | |
500 | ||
501 | <RESULT COUNT 1> | |
502 | error: The modified template has fewer formal parameters than base template `@NegSem_1505_ModifiedTemplates_003.m_templateTwo': at least 2 parameters were expected instead of 1 | |
503 | <END_RESULT> | |
504 | ||
505 | <END_TC> | |
506 | :exmp | |
507 | ||
508 | *---------------------------------------------------------------------* | |
509 | :h3. NegSem_1505_ModifiedTemplates_004 negative test | |
510 | .*---------------------------------------------------------------------* | |
511 | :xmp tab=0. | |
512 | ||
513 | <TC - Ensure that parameter names in modified templates are the same. > | |
514 | ||
515 | <COMPILE> | |
516 | ||
517 | <MODULE TTCN NegSem_1505_ModifiedTemplates_004 NegSem_1505_ModifiedTemplates_004.ttcn > | |
518 | /***************************************************************** | |
519 | ** @version 0.0.1 | |
520 | ** @purpose 1:15.5, Ensure that parameter names in modified templates are the same. | |
521 | ** @verdict pass reject | |
522 | *****************************************************************/ | |
523 | ||
524 | module NegSem_1505_ModifiedTemplates_004 { | |
525 | ||
526 | type component GeneralComp { } | |
527 | ||
528 | type record MyMessageType { | |
529 | integer field1, | |
530 | charstring field2, | |
531 | boolean field3 | |
532 | } | |
533 | ||
534 | template MyMessageType m_templateOne(integer p_value) := { | |
535 | field1 := p_value, | |
536 | field2 := "Hello World", | |
537 | field3 := true | |
538 | } | |
539 | ||
540 | // illegal as p_intValue is a different parameter name than p_value | |
541 | template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateOne := { | |
542 | field3 := false | |
543 | } | |
544 | ||
545 | } | |
546 | <END_MODULE> | |
547 | ||
548 | <RESULT COUNT 1> | |
549 | error: The name of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_004.m_templateOne': `p_value' was expected instead of `p_intValue' | |
550 | <END_RESULT> | |
551 | ||
552 | <END_TC> | |
553 | :exmp | |
554 | ||
555 | *---------------------------------------------------------------------* | |
556 | :h3. NegSem_1505_ModifiedTemplates_005 negative test | |
557 | .*---------------------------------------------------------------------* | |
558 | :xmp tab=0. | |
559 | ||
560 | <TC - Ensure that the dash in default parameter values of a modified templates is only accepted when the base template actually has a default value. > | |
561 | ||
562 | <COMPILE> | |
563 | ||
564 | <MODULE TTCN NegSem_1505_ModifiedTemplates_005 NegSem_1505_ModifiedTemplates_005.ttcn > | |
565 | /***************************************************************** | |
566 | ** @version 0.0.1 | |
567 | ** @purpose 1:15.5, Ensure that the dash in default parameter values of a modified templates is only accepted when the base template actually has a default value. | |
568 | ** @verdict pass reject | |
569 | *****************************************************************/ | |
570 | ||
571 | module NegSem_1505_ModifiedTemplates_005 { | |
572 | ||
573 | type component GeneralComp { } | |
574 | ||
575 | type record MyMessageType { | |
576 | integer field1, | |
577 | charstring field2, | |
578 | boolean field3 | |
579 | } | |
580 | ||
581 | template MyMessageType m_templateOne(integer p_intValue) := { | |
582 | field1 := p_intValue, | |
583 | field2 := "Hello World", | |
584 | field3 := true | |
585 | } | |
586 | ||
587 | // illegal as p_intValue does not have a default value that can be referred to with the "-". | |
588 | template MyMessageType m_templateTwo(integer p_intValue := -) modifies m_templateOne := { | |
589 | field1 := p_intValue | |
590 | } | |
591 | ||
592 | } | |
593 | <END_MODULE> | |
594 | ||
595 | <RESULT COUNT 1> | |
596 | error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template | |
597 | <END_RESULT> | |
598 | <RESULT COUNT 1> | |
599 | error: integer value was expected | |
600 | <END_RESULT> | |
601 | ||
602 | <END_TC> | |
603 | :exmp | |
604 | ||
605 | *---------------------------------------------------------------------* | |
606 | :h3. NegSem_1505_ModifiedTemplates_006 negative test | |
607 | .*---------------------------------------------------------------------* | |
608 | :xmp tab=0. | |
609 | ||
610 | <TC - Ensure that the same parameter name is used when modifying the base template. > | |
611 | ||
612 | <COMPILE> | |
613 | ||
614 | <MODULE TTCN NegSem_1505_ModifiedTemplates_006 NegSem_1505_ModifiedTemplates_006.ttcn > | |
615 | /***************************************************************** | |
616 | ** @version 0.0.1 | |
617 | ** @purpose 1:15.5, Ensure that the same parameter name is used when modifying the base template. | |
618 | ** @verdict pass reject | |
619 | *****************************************************************/ | |
620 | ||
621 | module NegSem_1505_ModifiedTemplates_006 { | |
622 | ||
623 | type component GeneralComp { } | |
624 | ||
625 | type record MyMessageType { | |
626 | integer field1, | |
627 | charstring field2, | |
628 | boolean field3 | |
629 | } | |
630 | ||
631 | template MyMessageType m_templateOne(integer p_intValue) := { | |
632 | field1 := p_intValue, | |
633 | field2 := "Hello World", | |
634 | field3 := true | |
635 | } | |
636 | ||
637 | // illegal as parameter name mismatch p_intValue defined in m_templateOne | |
638 | template MyMessageType m_templateTwo(integer p_value := -) modifies m_templateOne := { | |
639 | field1 := p_value | |
640 | } | |
641 | ||
642 | } | |
643 | <END_MODULE> | |
644 | ||
645 | <RESULT COUNT 1> | |
646 | error: The name of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_006.m_templateOne': `p_intValue' was expected instead of `p_value' | |
647 | <END_RESULT> | |
648 | <RESULT COUNT 1> | |
649 | error: integer value was expected | |
650 | <END_RESULT> | |
651 | <RESULT COUNT 1> | |
652 | error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template | |
653 | <END_RESULT> | |
654 | ||
655 | <END_TC> | |
656 | :exmp | |
657 | ||
658 | *---------------------------------------------------------------------* | |
659 | :h3. NegSem_1505_ModifiedTemplates_007 negative test | |
660 | .*---------------------------------------------------------------------* | |
661 | :xmp tab=0. | |
662 | ||
663 | <TC - Ensure that the same parameter type is used when modifying the base template. > | |
664 | ||
665 | <COMPILE> | |
666 | ||
667 | <MODULE TTCN NegSem_1505_ModifiedTemplates_007 NegSem_1505_ModifiedTemplates_007.ttcn > | |
668 | /***************************************************************** | |
669 | ** @version 0.0.1 | |
670 | ** @purpose 1:15.5, Ensure that the same parameter type is used when modifying the base template. | |
671 | ** @verdict pass reject | |
672 | *****************************************************************/ | |
673 | ||
674 | module NegSem_1505_ModifiedTemplates_007 { | |
675 | ||
676 | type component GeneralComp { } | |
677 | ||
678 | type record MyMessageType { | |
679 | integer field1, | |
680 | charstring field2, | |
681 | boolean field3 | |
682 | } | |
683 | ||
684 | template MyMessageType m_templateOne(integer p_intValue) := { | |
685 | field1 := p_intValue, | |
686 | field2 := "Hello World", | |
687 | field3 := true | |
688 | } | |
689 | ||
690 | // illegal as parameter type mismatch boolean defined in m_templateOne | |
691 | template MyMessageType m_templateTwo(boolean p_intValue) modifies m_templateOne := { | |
692 | field1 := 5 | |
693 | } | |
694 | ||
695 | } | |
696 | <END_MODULE> | |
697 | ||
698 | <RESULT COUNT 1> | |
699 | error: The type of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_007.m_templateOne': `integer' was expected instead of `boolean | |
700 | <END_RESULT> | |
701 | ||
702 | <END_TC> | |
703 | :exmp | |
704 | ||
705 | *---------------------------------------------------------------------* | |
706 | :h3. NegSyn_1505_ModifiedTemplates_001 negative test | |
707 | .*---------------------------------------------------------------------* | |
708 | :xmp tab=0. | |
709 | ||
710 | <TC - Ensure that the base template and modified template cannot be the same > | |
711 | ||
712 | <COMPILE> | |
713 | ||
714 | <MODULE TTCN NegSyn_1505_ModifiedTemplates_001 NegSyn_1505_ModifiedTemplates_001.ttcn > | |
715 | /***************************************************************** | |
716 | ** @version 0.0.1 | |
717 | ** @purpose 1:15.5, Ensure that the base template and modified template cannot be the same | |
718 | ** @verdict pass reject, noexecution | |
719 | *****************************************************************/ | |
720 | //Restriction a) | |
721 | /*A modified template shall not refer to itself, either directly or indirectly, i.e. recursive derivation is not | |
722 | allowed.*/ | |
723 | ||
724 | module NegSyn_1505_ModifiedTemplates_001{ | |
725 | ||
726 | type component GeneralComp { } | |
727 | ||
728 | type record MyMessageType { | |
729 | integer field1, | |
730 | charstring field2, | |
731 | boolean field3 | |
732 | } | |
733 | ||
734 | template MyMessageType m_templateOne(integer p_intValue) := { | |
735 | field1 := p_intValue, | |
736 | field2 := "Hello World", | |
737 | field3 := true | |
738 | } | |
739 | ||
740 | template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateOne := { | |
741 | field1 := 5 | |
742 | } | |
743 | ||
744 | //error: not allowed to modify itself | |
745 | template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateTwo := { | |
746 | field1 := 10 | |
747 | } | |
748 | ||
749 | } | |
750 | <END_MODULE> | |
751 | ||
752 | <RESULT COUNT 1> | |
753 | error: Duplicate definition with name `m_templateTwo' | |
754 | <END_RESULT> | |
755 | ||
756 | <END_TC> | |
757 | :exmp | |
758 | ||
759 | .*---------------------------------------------------------------------* | |
760 | :h2. 1506_referencing_elements_of_templates_or_template_fields folder | |
761 | .*---------------------------------------------------------------------* | |
762 | ||
763 | *---------------------------------------------------------------------* | |
764 | :h3. NegSem_150601_ReferencingIndividualStringElements_001 negative test | |
765 | .*---------------------------------------------------------------------* | |
766 | :xmp tab=0. | |
767 | ||
768 | <TC - Ensure that the referencing of individual string elements inside templates or template fields is forbidden. > | |
769 | ||
770 | <COMPILE> | |
771 | ||
772 | <MODULE TTCN NegSem_150601_ReferencingIndividualStringElements_001 NegSem_150601_ReferencingIndividualStringElements_001.ttcn > | |
773 | /***************************************************************** | |
774 | ** @version 0.0.1 | |
775 | ** @purpose 1:15.6.1, Ensure that the referencing of individual string elements inside templates or template fields is forbidden. | |
776 | ** @verdict pass reject | |
777 | *****************************************************************/ | |
778 | ||
779 | module NegSem_150601_ReferencingIndividualStringElements_001 { | |
780 | ||
781 | type component GeneralComp { } | |
782 | ||
783 | testcase TC_NegSem_150601_ReferencingIndividualStringElements_001() runs on GeneralComp { | |
784 | var template charstring m_char1 := "MYCHAR1"; | |
785 | var template charstring m_char2; | |
786 | ||
787 | // illegal acchess. Instead, substr should be used. | |
788 | m_char2 := m_char1[1]; | |
789 | ||
790 | if (valueof(m_char2) == "Y") { | |
791 | setverdict(fail); | |
792 | } else { | |
793 | setverdict(pass); | |
794 | } | |
795 | } | |
796 | ||
797 | control{ | |
798 | execute(TC_NegSem_150601_ReferencingIndividualStringElements_001()); | |
799 | } | |
800 | ||
801 | } | |
802 | <END_MODULE> | |
803 | ||
804 | <RESULT COUNT 1> | |
805 | error: Reference to template variable `m_char1' can not be indexed | |
806 | <END_RESULT> | |
807 | ||
808 | <END_TC> | |
809 | :exmp | |
810 | ||
811 | ||
812 | *---------------------------------------------------------------------* | |
813 | :h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test | |
814 | .*---------------------------------------------------------------------* | |
815 | :xmp tab=0. | |
816 | ||
817 | <TC - Ensure that fields with omit values on the right-hand side of an assignment are rejected. > | |
818 | ||
819 | <COMPILE> | |
820 | <EXECUTE_PARALLEL> | |
821 | ||
822 | <MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_001 NegSem_150602_ReferencingRecordAndSetFields_001.ttcn > | |
823 | /***************************************************************** | |
824 | ** @version 0.0.1 | |
825 | ** @purpose 1:15.6.2, Ensure that fields with omit values on the right-hand side of an assignment are rejected. | |
826 | ** @verdict pass reject | |
827 | *****************************************************************/ | |
828 | ||
829 | module NegSem_150602_ReferencingRecordAndSetFields_001 { | |
830 | ||
831 | type component GeneralComp { } | |
832 | ||
833 | type record MyRecordTwo { | |
834 | integer g1, | |
835 | MyRecordTwo g2 optional | |
836 | } | |
837 | ||
838 | type record MyRecordOne { | |
839 | integer f1 optional, | |
840 | MyRecordTwo f2 optional | |
841 | } | |
842 | ||
843 | testcase TC_NegSem_150602_ReferencingRecordAndSetFields_001() runs on GeneralComp { | |
844 | var template MyRecordOne m_R1 := { | |
845 | f1 := 5, | |
846 | f2 := omit | |
847 | } | |
848 | ||
849 | // shall cause an error as omit is assigned to m_R1.f2 | |
850 | var template MyRecordTwo m_R2 := m_R1.f2.g2; | |
851 | // if we get here, something must be wrong | |
852 | setverdict(fail); | |
853 | } | |
854 | ||
855 | control{ | |
856 | execute(TC_NegSem_150602_ReferencingRecordAndSetFields_001()); | |
857 | } | |
858 | ||
859 | } | |
860 | <END_MODULE> | |
861 | ||
862 | <RESULT COUNT 1> | |
863 | Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_001.MyRecordTwo. | |
864 | <END_RESULT> | |
865 | ||
866 | <END_TC> | |
867 | :exmp | |
868 | ||
869 | *---------------------------------------------------------------------* | |
870 | :h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test | |
871 | .*---------------------------------------------------------------------* | |
872 | :xmp tab=0. | |
873 | ||
874 | <TC - Ensure that fields with omit values on the right-hand side of an assignment are rejected. > | |
875 | ||
876 | <COMPILE> | |
877 | <EXECUTE_PARALLEL> | |
878 | ||
879 | <MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_003 NegSem_150602_ReferencingRecordAndSetFields_003.ttcn > | |
880 | /***************************************************************** | |
881 | ** @version 0.0.1 | |
882 | ** @purpose 1:15.6.2, Ensure that value lists on the right-hand side of an assignment are not acceped. | |
883 | ** @verdict pass reject | |
884 | *****************************************************************/ | |
885 | ||
886 | module NegSem_150602_ReferencingRecordAndSetFields_003 { | |
887 | ||
888 | type component GeneralComp { } | |
889 | ||
890 | type record MyRecordTwo { | |
891 | integer g1, | |
892 | MyRecordTwo g2 optional | |
893 | } | |
894 | ||
895 | type record MyRecordOne { | |
896 | integer f1 optional, | |
897 | MyRecordTwo f2 optional | |
898 | } | |
899 | ||
900 | testcase TC_NegSem_150602_ReferencingRecordAndSetFields_003() runs on GeneralComp { | |
901 | var template MyRecordOne m_R1 := ( | |
902 | { | |
903 | f1 := omit, | |
904 | f2 := | |
905 | { | |
906 | g1 := 0, | |
907 | g2 := omit | |
908 | } | |
909 | }, | |
910 | { | |
911 | f1 := 5, | |
912 | f2 := | |
913 | { | |
914 | g1 := 1, | |
915 | g2 := | |
916 | { | |
917 | g1 := 2, | |
918 | g2 := omit | |
919 | } | |
920 | } | |
921 | } | |
922 | ); | |
923 | ||
924 | // shall cause an error as value list is assigned to m_R1 | |
925 | var template MyRecordTwo m_R2 := m_R1.f2; | |
926 | m_R2 := m_R1.f2.g2; | |
927 | m_R2 := m_R1.f2.g2.g2; | |
928 | // if we get here, something must be wrong | |
929 | setverdict(fail); | |
930 | } | |
931 | ||
932 | control{ | |
933 | execute(TC_NegSem_150602_ReferencingRecordAndSetFields_003()); | |
934 | } | |
935 | ||
936 | ||
937 | } | |
938 | <END_MODULE> | |
939 | ||
940 | <RESULT COUNT 1> | |
941 | Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_003.MyRecordTwo. | |
942 | <END_RESULT> | |
943 | ||
944 | <END_TC> | |
945 | :exmp | |
946 | ||
947 | *---------------------------------------------------------------------* | |
948 | :h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test | |
949 | .*---------------------------------------------------------------------* | |
950 | :xmp tab=0. | |
951 | ||
952 | <TC - Ensure that complement lists on the right-hand side of an assignment are not acceped. > | |
953 | ||
954 | <COMPILE> | |
955 | <EXECUTE_PARALLEL> | |
956 | ||
957 | <MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_004 NegSem_150602_ReferencingRecordAndSetFields_004.ttcn > | |
958 | /***************************************************************** | |
959 | ** @version 0.0.1 | |
960 | ** @purpose 1:15.6.2, Ensure that complement lists on the right-hand side of an assignment are not acceped. | |
961 | ** @verdict pass reject | |
962 | *****************************************************************/ | |
963 | ||
964 | module NegSem_150602_ReferencingRecordAndSetFields_004 { | |
965 | ||
966 | type component GeneralComp { } | |
967 | ||
968 | type record MyRecordTwo { | |
969 | integer g1, | |
970 | MyRecordTwo g2 optional | |
971 | } | |
972 | ||
973 | type record MyRecordOne { | |
974 | integer f1 optional, | |
975 | MyRecordTwo f2 optional | |
976 | } | |
977 | ||
978 | testcase TC_NegSem_150602_ReferencingRecordAndSetFields_004() runs on GeneralComp { | |
979 | var template MyRecordOne m_R1 := complement( | |
980 | { | |
981 | f1 := omit, | |
982 | f2 := | |
983 | { | |
984 | g1 := 0, | |
985 | g2 := omit | |
986 | } | |
987 | }, | |
988 | { | |
989 | f1 := 5, | |
990 | f2 := | |
991 | { | |
992 | g1 := 1, | |
993 | g2 := | |
994 | { | |
995 | g1 := 2, | |
996 | g2 := omit | |
997 | } | |
998 | } | |
999 | } | |
1000 | ); | |
1001 | ||
1002 | // shall cause an error as a complement list is assigned to m_R1 | |
1003 | var template MyRecordTwo m_R2 := m_R1.f2; | |
1004 | m_R2 := m_R1.f2.g2; | |
1005 | m_R2 := m_R1.f2.g2.g2; | |
1006 | // if we get here, something must be wrong | |
1007 | setverdict(fail); | |
1008 | } | |
1009 | ||
1010 | control{ | |
1011 | execute(TC_NegSem_150602_ReferencingRecordAndSetFields_004()); | |
1012 | } | |
1013 | ||
1014 | } | |
1015 | <END_MODULE> | |
1016 | ||
1017 | <RESULT COUNT 1> | |
1018 | Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_004.MyRecordTwo. | |
1019 | <END_RESULT> | |
1020 | ||
1021 | <END_TC> | |
1022 | :exmp | |
1023 | ||
1024 | *---------------------------------------------------------------------* | |
1025 | :h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test | |
1026 | .*---------------------------------------------------------------------* | |
1027 | :xmp tab=0. | |
1028 | ||
1029 | <TC - Ensure that referencing a template field with the ifpresent attribute causes a rejection. > | |
1030 | ||
1031 | <COMPILE> | |
1032 | <EXECUTE_PARALLEL> | |
1033 | ||
1034 | <MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_005 NegSem_150602_ReferencingRecordAndSetFields_005.ttcn > | |
1035 | /***************************************************************** | |
1036 | ** @version 0.0.1 | |
1037 | ** @purpose 1:15.6.2, Ensure that referencing a template field with the ifpresent attribute causes a rejection. | |
1038 | ** @verdict pass reject | |
1039 | *****************************************************************/ | |
1040 | ||
1041 | module NegSem_150602_ReferencingRecordAndSetFields_005 { | |
1042 | ||
1043 | type component GeneralComp { } | |
1044 | ||
1045 | type record MyRecordOne { | |
1046 | MyRecordOne f1 optional | |
1047 | } | |
1048 | ||
1049 | testcase TC_NegSem_150602_ReferencingRecordAndSetFields_005() runs on GeneralComp { | |
1050 | var template MyRecordOne m_R1 := { | |
1051 | f1 := * ifpresent | |
1052 | } | |
1053 | var template MyRecordOne m_R2 := { | |
1054 | f1 := m_R1.f1.f1 // access to a field with ifpresent shall cause an error! | |
1055 | } | |
1056 | setverdict(fail); | |
1057 | } | |
1058 | ||
1059 | control{ | |
1060 | execute(TC_NegSem_150602_ReferencingRecordAndSetFields_005()); | |
1061 | } | |
1062 | ||
1063 | } | |
1064 | <END_MODULE> | |
1065 | ||
1066 | <RESULT COUNT 1> | |
1067 | Dynamic test case error: Accessing field f1 of a non-specific template of type @NegSem_150602_ReferencingRecordAndSetFields_005.MyRecordOne. | |
1068 | <END_RESULT> | |
1069 | ||
1070 | <END_TC> | |
1071 | :exmp | |
1072 | ||
1073 | *---------------------------------------------------------------------* | |
1074 | :h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test | |
1075 | .*---------------------------------------------------------------------* | |
1076 | :xmp tab=0. | |
1077 | ||
1078 | <TC - Ensure that referencing a field of an address type, which actual value is null shall cause rejection. > | |
1079 | ||
1080 | <COMPILE> | |
1081 | ||
1082 | <MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_006 NegSem_150602_ReferencingRecordAndSetFields_006.ttcn > | |
1083 | /***************************************************************** | |
1084 | ** @version 0.0.1 | |
1085 | ** @purpose 1:15.6.2, Ensure that referencing a field of an address type, which actual value is null shall cause rejection. | |
1086 | ** @verdict pass reject | |
1087 | *****************************************************************/ | |
1088 | ||
1089 | //Restriction d) | |
1090 | /*Special value null: referencing a field of an address type, which actual value is null shall cause an error.*/ | |
1091 | ||
1092 | module NegSem_150602_ReferencingRecordAndSetFields_006 { | |
1093 | ||
1094 | type component GeneralComp { } | |
1095 | ||
1096 | type integer address; | |
1097 | ||
1098 | type record MyRecordOne { | |
1099 | address f1 | |
1100 | } | |
1101 | ||
1102 | testcase TC_NegSem_150602_ReferencingRecordAndSetFields_006() runs on GeneralComp { | |
1103 | var template MyRecordOne m_R1 := { | |
1104 | f1 := null | |
1105 | } | |
1106 | var template MyRecordOne m_R2 := { | |
1107 | f1 := m_R1.f1 // access to a field with null shall cause an error! | |
1108 | } | |
1109 | setverdict(pass); | |
1110 | } | |
1111 | ||
1112 | control{ | |
1113 | execute(TC_NegSem_150602_ReferencingRecordAndSetFields_006()); | |
1114 | } | |
1115 | ||
1116 | } | |
1117 | <END_MODULE> | |
1118 | ||
1119 | <RESULT COUNT 1> | |
1120 | error: integer value was expected | |
1121 | <END_RESULT> | |
1122 | ||
1123 | <END_TC> | |
1124 | :exmp | |
1125 | ||
1126 | *---------------------------------------------------------------------* | |
1127 | :h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test | |
1128 | .*---------------------------------------------------------------------* | |
1129 | :xmp tab=0. | |
1130 | ||
1131 | <TC - Ensure that referencing an element within a value list causes an error in the context of record of. > | |
1132 | ||
1133 | <COMPILE> | |
1134 | <EXECUTE_PARALLEL> | |
1135 | ||
1136 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_001 NegSem_150603_ReferencingRecordOfAndSetElements_001.ttcn > | |
1137 | /***************************************************************** | |
1138 | ** @version 0.0.1 | |
1139 | ** @purpose 1:15.6.3, Ensure that referencing an element within a value list causes an error in the context of record of. | |
1140 | ** @verdict pass reject | |
1141 | *****************************************************************/ | |
1142 | ||
1143 | module NegSem_150603_ReferencingRecordOfAndSetElements_001 { | |
1144 | ||
1145 | type component GeneralComp { } | |
1146 | ||
1147 | type record of integer RoI; | |
1148 | type record of RoI RoRoI; | |
1149 | ||
1150 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_001() runs on GeneralComp { | |
1151 | var template RoI m_one; | |
1152 | var template RoRoI m_two; | |
1153 | template RoRoI constraint_value := {{},{0},{0,0},{0,0,0}}; | |
1154 | ||
1155 | m_two := ( constraint_value, constraint_value ); // value list | |
1156 | m_one := m_two[0]; // shall cause an error as we access a value list | |
1157 | ||
1158 | setverdict(fail); | |
1159 | } | |
1160 | ||
1161 | control{ | |
1162 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_001()); | |
1163 | } | |
1164 | ||
1165 | } | |
1166 | <END_MODULE> | |
1167 | ||
1168 | <RESULT COUNT 1> | |
1169 | Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_001.RoRoI. | |
1170 | <END_RESULT> | |
1171 | ||
1172 | <END_TC> | |
1173 | :exmp | |
1174 | ||
1175 | *---------------------------------------------------------------------* | |
1176 | :h3. NegSem_150602_ReferencingRecordAndSetFields_002 negative test | |
1177 | .*---------------------------------------------------------------------* | |
1178 | :xmp tab=0. | |
1179 | ||
1180 | <TC - Ensure that access to unitialized fields in the context of record of is rejected. > | |
1181 | ||
1182 | <COMPILE> | |
1183 | <EXECUTE_PARALLEL> | |
1184 | ||
1185 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_002 NegSem_150603_ReferencingRecordOfAndSetElements_002.ttcn > | |
1186 | /***************************************************************** | |
1187 | ** @version 0.0.1 | |
1188 | ** @purpose 1:15.6.3, Ensure that access to unitialized fields in the context of record of is rejected. | |
1189 | ** @verdict pass reject | |
1190 | *****************************************************************/ | |
1191 | ||
1192 | module NegSem_150603_ReferencingRecordOfAndSetElements_002 { | |
1193 | ||
1194 | type component GeneralComp { } | |
1195 | ||
1196 | type record of integer RoI; | |
1197 | ||
1198 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_002() runs on GeneralComp { | |
1199 | var template RoI m_one; | |
1200 | var integer v_test; | |
1201 | ||
1202 | m_one[0] := 0; | |
1203 | m_one[2] := 1; | |
1204 | v_test := valueof(m_one[1]); // shall cause an error as element one is an unitialized field | |
1205 | ||
1206 | setverdict(fail); | |
1207 | } | |
1208 | ||
1209 | control{ | |
1210 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_002()); | |
1211 | } | |
1212 | ||
1213 | } | |
1214 | <END_MODULE> | |
1215 | ||
1216 | <RESULT COUNT 1> | |
1217 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
1218 | <END_RESULT> | |
1219 | ||
1220 | <END_TC> | |
1221 | :exmp | |
1222 | ||
1223 | *---------------------------------------------------------------------* | |
1224 | :h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test | |
1225 | .*---------------------------------------------------------------------* | |
1226 | :xmp tab=0. | |
1227 | ||
1228 | <TC - Ensure that anyvalueornone fields in the context of record of is rejected. > | |
1229 | ||
1230 | <COMPILE> | |
1231 | <EXECUTE_PARALLEL> | |
1232 | ||
1233 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_003 NegSem_150603_ReferencingRecordOfAndSetElements_003.ttcn > | |
1234 | /***************************************************************** | |
1235 | ** @version 0.0.1 | |
1236 | ** @purpose 1:15.6.3, Ensure that anyvalueornone fields in the context of record of is rejected. | |
1237 | ** @verdict pass reject | |
1238 | *****************************************************************/ | |
1239 | ||
1240 | module NegSem_150603_ReferencingRecordOfAndSetElements_003 { | |
1241 | ||
1242 | type component GeneralComp { } | |
1243 | ||
1244 | type record of integer RoI; | |
1245 | ||
1246 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_003() runs on GeneralComp { | |
1247 | var template RoI m_one; | |
1248 | var integer v_test; | |
1249 | ||
1250 | m_one := {0,*,1,2}; | |
1251 | v_test := valueof(m_one[1]); // shall cause an error as element one is an "any value or none" field | |
1252 | ||
1253 | setverdict(fail); | |
1254 | } | |
1255 | ||
1256 | control{ | |
1257 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_003()); | |
1258 | } | |
1259 | ||
1260 | } | |
1261 | <END_MODULE> | |
1262 | ||
1263 | <RESULT COUNT 1> | |
1264 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
1265 | <END_RESULT> | |
1266 | ||
1267 | <END_TC> | |
1268 | :exmp | |
1269 | ||
1270 | *---------------------------------------------------------------------* | |
1271 | :h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test | |
1272 | .*---------------------------------------------------------------------* | |
1273 | :xmp tab=0. | |
1274 | ||
1275 | <TC - Ensure that complement value lists in the context of record of are rejected. > | |
1276 | ||
1277 | <COMPILE> | |
1278 | <EXECUTE_PARALLEL> | |
1279 | ||
1280 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_004 NegSem_150603_ReferencingRecordOfAndSetElements_004.ttcn > | |
1281 | /***************************************************************** | |
1282 | ** @version 0.0.1 | |
1283 | ** @purpose 1:15.6.3, Ensure that complement value lists in the context of record of are rejected. | |
1284 | ** @verdict pass reject | |
1285 | *****************************************************************/ | |
1286 | ||
1287 | module NegSem_150603_ReferencingRecordOfAndSetElements_004 { | |
1288 | ||
1289 | type component GeneralComp { } | |
1290 | ||
1291 | type record of integer RoI; | |
1292 | ||
1293 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_004() runs on GeneralComp { | |
1294 | var template RoI m_one; | |
1295 | var integer v_test; | |
1296 | ||
1297 | m_one := {0,complement(1,3,5),1,2}; | |
1298 | v_test := valueof(m_one[1]); // shall cause an error as element one is a complement list | |
1299 | ||
1300 | setverdict(fail); | |
1301 | } | |
1302 | ||
1303 | control{ | |
1304 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_004()); | |
1305 | } | |
1306 | ||
1307 | } | |
1308 | <END_MODULE> | |
1309 | ||
1310 | <RESULT COUNT 1> | |
1311 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
1312 | <END_RESULT> | |
1313 | ||
1314 | <END_TC> | |
1315 | :exmp | |
1316 | ||
1317 | *---------------------------------------------------------------------* | |
1318 | :h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test | |
1319 | .*---------------------------------------------------------------------* | |
1320 | :xmp tab=0. | |
1321 | ||
1322 | <TC - Ensure that subset in the context of record of are rejected. > | |
1323 | ||
1324 | <COMPILE> | |
1325 | <EXECUTE_PARALLEL> | |
1326 | ||
1327 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_005 NegSem_150603_ReferencingRecordOfAndSetElements_005.ttcn > | |
1328 | /***************************************************************** | |
1329 | ** @version 0.0.1 | |
1330 | ** @purpose 1:15.6.3, Ensure that subset in the context of record of are rejected. | |
1331 | ** @verdict pass reject | |
1332 | *****************************************************************/ | |
1333 | ||
1334 | module NegSem_150603_ReferencingRecordOfAndSetElements_005 { | |
1335 | ||
1336 | type component GeneralComp { } | |
1337 | ||
1338 | //type record of integer RoI; | |
1339 | ||
1340 | type set of integer SoI; | |
1341 | type record of SoI RoS; | |
1342 | ||
1343 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_005() runs on GeneralComp { | |
1344 | //var template RoI m_one; | |
1345 | var template RoS m_one; | |
1346 | ||
1347 | //var integer v_test; | |
1348 | var SoI v_test; | |
1349 | ||
1350 | //m_one := {0,subset(1,3,5),1,2}; | |
1351 | m_one := {{0},subset(1,3,5), {1,2}}; | |
1352 | ||
1353 | v_test := valueof(m_one[1]); // shall cause an error as element one is a subset | |
1354 | ||
1355 | setverdict(fail); | |
1356 | } | |
1357 | ||
1358 | control{ | |
1359 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_005()); | |
1360 | } | |
1361 | ||
1362 | } | |
1363 | <END_MODULE> | |
1364 | ||
1365 | <RESULT COUNT 1> | |
1366 | Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. | |
1367 | <END_RESULT> | |
1368 | ||
1369 | <END_TC> | |
1370 | :exmp | |
1371 | ||
1372 | *---------------------------------------------------------------------* | |
1373 | :h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test | |
1374 | .*---------------------------------------------------------------------* | |
1375 | :xmp tab=0. | |
1376 | ||
1377 | <TC - Ensure that superset in the context of record of are rejected. > | |
1378 | ||
1379 | <COMPILE> | |
1380 | <EXECUTE_PARALLEL> | |
1381 | ||
1382 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_006 NegSem_150603_ReferencingRecordOfAndSetElements_006.ttcn > | |
1383 | /***************************************************************** | |
1384 | ** @version 0.0.1 | |
1385 | ** @purpose 1:15.6.3, Ensure that superset in the context of record of are rejected. | |
1386 | ** @verdict pass reject | |
1387 | *****************************************************************/ | |
1388 | ||
1389 | module NegSem_150603_ReferencingRecordOfAndSetElements_006 { | |
1390 | ||
1391 | type component GeneralComp { } | |
1392 | ||
1393 | //type record of integer RoI; | |
1394 | type set of integer SoI; | |
1395 | type record of SoI RoS; | |
1396 | ||
1397 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_006() runs on GeneralComp { | |
1398 | //var template RoI m_one; | |
1399 | var template RoS m_one; | |
1400 | ||
1401 | //var integer v_test; | |
1402 | var SoI v_test; | |
1403 | ||
1404 | //m_one := {0,superset(1,3,5),1,2}; | |
1405 | m_one := {{0},subset(1,3,5), {1,2}}; | |
1406 | v_test := valueof(m_one[1]); // shall cause an error as element one is a superset | |
1407 | ||
1408 | setverdict(fail); | |
1409 | } | |
1410 | ||
1411 | control{ | |
1412 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_006()); | |
1413 | } | |
1414 | ||
1415 | } | |
1416 | <END_MODULE> | |
1417 | ||
1418 | <RESULT COUNT 1> | |
1419 | Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. | |
1420 | <END_RESULT> | |
1421 | ||
1422 | <END_TC> | |
1423 | :exmp | |
1424 | ||
1425 | *---------------------------------------------------------------------* | |
1426 | :h3. NegSem_150602_ReferencingRecordAndSetFields_008 negative test | |
1427 | .*---------------------------------------------------------------------* | |
1428 | :xmp tab=0. | |
1429 | ||
1430 | <TC - Ensure that access to record of indexes is forbidden when a previous index entry is a permutation with a *. > | |
1431 | ||
1432 | <COMPILE> | |
1433 | <EXECUTE_PARALLEL> | |
1434 | ||
1435 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_008 NegSem_150603_ReferencingRecordOfAndSetElements_008.ttcn > | |
1436 | /***************************************************************** | |
1437 | ** @version 0.0.1 | |
1438 | ** @purpose 1:15.6.3, Ensure that access to record of indexes is forbidden when a previous index entry is a permutation with a *. | |
1439 | ** @verdict pass reject | |
1440 | *****************************************************************/ | |
1441 | ||
1442 | module NegSem_150603_ReferencingRecordOfAndSetElements_008 { | |
1443 | ||
1444 | type component GeneralComp { } | |
1445 | ||
1446 | type record of integer RoI; | |
1447 | ||
1448 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_008() runs on GeneralComp { | |
1449 | var template RoI m_one; | |
1450 | var integer v_test; | |
1451 | ||
1452 | m_one := {permutation(0,1,3,*),2,?}; | |
1453 | v_test := valueof(m_one[5]); // shall cause an error as the permutation contains a * that is able to cover any record of indexes | |
1454 | ||
1455 | setverdict(fail); | |
1456 | } | |
1457 | ||
1458 | control{ | |
1459 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_008()); | |
1460 | } | |
1461 | ||
1462 | } | |
1463 | <END_MODULE> | |
1464 | ||
1465 | <RESULT COUNT 1> | |
1466 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
1467 | <END_RESULT> | |
1468 | ||
1469 | <END_TC> | |
1470 | :exmp | |
1471 | ||
1472 | *---------------------------------------------------------------------* | |
1473 | :h3. NegSem_150602_ReferencingRecordAndSetFields_009 negative test | |
1474 | .*---------------------------------------------------------------------* | |
1475 | :xmp tab=0. | |
1476 | ||
1477 | <TC - Ensure that access to ifpresent fields is not allowed. > | |
1478 | ||
1479 | <COMPILE> | |
1480 | <EXECUTE_PARALLEL> | |
1481 | ||
1482 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_009 NegSem_150603_ReferencingRecordOfAndSetElements_009.ttcn > | |
1483 | /***************************************************************** | |
1484 | ** @version 0.0.1 | |
1485 | ** @purpose 1:15.6.3, Ensure that access to ifpresent fields is not allowed. | |
1486 | ** @verdict pass reject | |
1487 | *****************************************************************/ | |
1488 | ||
1489 | module NegSem_150603_ReferencingRecordOfAndSetElements_009 { | |
1490 | ||
1491 | type component GeneralComp { } | |
1492 | ||
1493 | template integer If := 1 ifpresent; // simple integer can't have ifpresent attribute | |
1494 | ||
1495 | type record of integer RoI; | |
1496 | ||
1497 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_009() runs on GeneralComp { | |
1498 | var template RoI m_one; | |
1499 | var integer v_test; | |
1500 | ||
1501 | m_one := {If,2,?}; | |
1502 | v_test := valueof(m_one[0]); // shall cause an error due to the presence of ifpresent | |
1503 | ||
1504 | setverdict(fail); | |
1505 | } | |
1506 | ||
1507 | control{ | |
1508 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_009()); | |
1509 | } | |
1510 | ||
1511 | } | |
1512 | <END_MODULE> | |
1513 | ||
1514 | <RESULT COUNT 1> | |
1515 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
1516 | <END_RESULT> | |
1517 | ||
1518 | <END_TC> | |
1519 | :exmp | |
1520 | ||
1521 | *---------------------------------------------------------------------* | |
1522 | :h3. NegSem_150602_ReferencingRecordAndSetFields_010 negative test | |
1523 | .*---------------------------------------------------------------------* | |
1524 | :xmp tab=0. | |
1525 | ||
1526 | <TC - Ensure that referencing AnyValueOrNone fields is not allowed. > | |
1527 | ||
1528 | <COMPILE> | |
1529 | <EXECUTE_PARALLEL> | |
1530 | ||
1531 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_010 NegSem_150603_ReferencingRecordOfAndSetElements_010.ttcn > | |
1532 | /***************************************************************** | |
1533 | ** @version 0.0.1 | |
1534 | ** @purpose 1:15.6.3, Ensure that referencing AnyValueOrNone fields is not allowed. | |
1535 | ** @verdict pass reject | |
1536 | *****************************************************************/ | |
1537 | ||
1538 | module NegSem_150603_ReferencingRecordOfAndSetElements_010 { | |
1539 | ||
1540 | type component GeneralComp { } | |
1541 | ||
1542 | type record of integer RoI; | |
1543 | ||
1544 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_010() runs on GeneralComp { | |
1545 | var template RoI m_one; | |
1546 | ||
1547 | m_one := ?; | |
1548 | m_one[2] := 2; | |
1549 | // assignment should yield {?,?,2,*} | |
1550 | ||
1551 | if (not match(5,m_one[0])) { | |
1552 | setverdict(fail); | |
1553 | } | |
1554 | if (not match(5,m_one[1])) { | |
1555 | setverdict(fail); | |
1556 | } | |
1557 | if (not match(2,m_one[2])) { | |
1558 | setverdict(fail); | |
1559 | } | |
1560 | if (not match(5,m_one[3])) { // shall cause an error due to the presence of AnyValueOrNone | |
1561 | setverdict(fail); | |
1562 | } | |
1563 | setverdict(pass); | |
1564 | } | |
1565 | ||
1566 | control{ | |
1567 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_010()); | |
1568 | } | |
1569 | ||
1570 | } | |
1571 | <END_MODULE> | |
1572 | ||
1573 | <RESULT COUNT 1> | |
1574 | Dynamic test case error: Matching with an uninitialized/unsupported integer template | |
1575 | <END_RESULT> | |
1576 | ||
1577 | <END_TC> | |
1578 | :exmp | |
1579 | ||
1580 | *---------------------------------------------------------------------* | |
1581 | :h3. NegSem_150602_ReferencingRecordAndSetFields_011 negative test | |
1582 | .*---------------------------------------------------------------------* | |
1583 | :xmp tab=0. | |
1584 | ||
1585 | <TC - Ensure that referencing uninitialized fields is not allowed. > | |
1586 | ||
1587 | <COMPILE> | |
1588 | <EXECUTE_PARALLEL> | |
1589 | ||
1590 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_011 NegSem_150603_ReferencingRecordOfAndSetElements_011.ttcn > | |
1591 | /***************************************************************** | |
1592 | ** @version 0.0.1 | |
1593 | ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. | |
1594 | ** @verdict pass reject | |
1595 | *****************************************************************/ | |
1596 | ||
1597 | //Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. | |
1598 | ||
1599 | /*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this | |
1600 | shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set | |
1601 | of field or value on the right hand side of an assignment shall cause an error.*/ | |
1602 | ||
1603 | ||
1604 | module NegSem_150603_ReferencingRecordOfAndSetElements_011 { | |
1605 | ||
1606 | type component GeneralComp { } | |
1607 | ||
1608 | type record of integer RoI; | |
1609 | ||
1610 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_011() runs on GeneralComp { | |
1611 | ||
1612 | var template RoI m_one; | |
1613 | var template RoI m_two; | |
1614 | ||
1615 | m_one := {1,-}; // {1,-} | |
1616 | m_two := {m_one[1],4}; // {-,4} error not allowed referencing | |
1617 | ||
1618 | if (not isvalue(m_two)) { | |
1619 | setverdict(pass); | |
1620 | } | |
1621 | ||
1622 | } | |
1623 | ||
1624 | control{ | |
1625 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_011()); | |
1626 | } | |
1627 | ||
1628 | } | |
1629 | <END_MODULE> | |
1630 | ||
1631 | <RESULT COUNT 1> | |
1632 | Dynamic test case error: Copying an uninitialized/unsupported integer template. | |
1633 | <END_RESULT> | |
1634 | ||
1635 | <END_TC> | |
1636 | :exmp | |
1637 | ||
1638 | *---------------------------------------------------------------------* | |
1639 | :h3. NegSem_150602_ReferencingRecordAndSetFields_012 negative test | |
1640 | .*---------------------------------------------------------------------* | |
1641 | :xmp tab=0. | |
1642 | ||
1643 | <TC - Ensure that referencing uninitialized fields is not allowed. > | |
1644 | ||
1645 | <COMPILE> | |
1646 | <EXECUTE_PARALLEL> | |
1647 | ||
1648 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_012 NegSem_150603_ReferencingRecordOfAndSetElements_012.ttcn > | |
1649 | /***************************************************************** | |
1650 | ** @version 0.0.1 | |
1651 | ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. | |
1652 | ** @verdict pass reject | |
1653 | *****************************************************************/ | |
1654 | ||
1655 | //Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. | |
1656 | ||
1657 | /*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this | |
1658 | shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set | |
1659 | of field or value on the right hand side of an assignment shall cause an error.*/ | |
1660 | ||
1661 | ||
1662 | module NegSem_150603_ReferencingRecordOfAndSetElements_012{ | |
1663 | ||
1664 | type component GeneralComp { } | |
1665 | ||
1666 | type set of integer SoI; | |
1667 | ||
1668 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_012() runs on GeneralComp { | |
1669 | ||
1670 | var template SoI m_one; | |
1671 | var template SoI m_two; | |
1672 | ||
1673 | m_one := {1,-}; // {1,-} | |
1674 | m_two := {m_one[1],2}; // {-,2} error not allowed referencing | |
1675 | ||
1676 | if (not isvalue(m_two)) { | |
1677 | setverdict(pass); | |
1678 | } | |
1679 | ||
1680 | } | |
1681 | ||
1682 | control{ | |
1683 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_012()); | |
1684 | } | |
1685 | ||
1686 | } | |
1687 | <END_MODULE> | |
1688 | ||
1689 | <RESULT COUNT 1> | |
1690 | Dynamic test case error: Copying an uninitialized/unsupported integer template. | |
1691 | <END_RESULT> | |
1692 | ||
1693 | <END_TC> | |
1694 | :exmp | |
1695 | ||
1696 | *---------------------------------------------------------------------* | |
1697 | :h3. NegSem_150602_ReferencingRecordAndSetFields_013 negative test | |
1698 | .*---------------------------------------------------------------------* | |
1699 | :xmp tab=0. | |
1700 | ||
1701 | <TC - Ensure that referencing uninitialized fields is not allowed. > | |
1702 | ||
1703 | <COMPILE> | |
1704 | <EXECUTE_PARALLEL> | |
1705 | ||
1706 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_013 NegSem_150603_ReferencingRecordOfAndSetElements_013.ttcn > | |
1707 | /***************************************************************** | |
1708 | ** @version 0.0.1 | |
1709 | ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. | |
1710 | ** @verdict pass reject | |
1711 | *****************************************************************/ | |
1712 | ||
1713 | //Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. | |
1714 | ||
1715 | /*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this | |
1716 | shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set | |
1717 | of field or value on the right hand side of an assignment shall cause an error.*/ | |
1718 | ||
1719 | ||
1720 | module NegSem_150603_ReferencingRecordOfAndSetElements_013{ | |
1721 | ||
1722 | type component GeneralComp { } | |
1723 | ||
1724 | ||
1725 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_013() runs on GeneralComp { | |
1726 | ||
1727 | var integer m_one[2]; | |
1728 | var integer m_two[2]; | |
1729 | ||
1730 | m_one := {1,-}; // {1,-} | |
1731 | m_two := {m_one[1],2}; // {-,2} error not allowed referencing | |
1732 | ||
1733 | if (not isvalue(m_two)) { | |
1734 | setverdict(pass); | |
1735 | } | |
1736 | ||
1737 | } | |
1738 | ||
1739 | control{ | |
1740 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_013()); | |
1741 | } | |
1742 | ||
1743 | } | |
1744 | <END_MODULE> | |
1745 | ||
1746 | <RESULT COUNT 1> | |
1747 | Dynamic test case error: Assignment of an unbound integer value. | |
1748 | <END_RESULT> | |
1749 | ||
1750 | <END_TC> | |
1751 | :exmp | |
1752 | ||
1753 | *---------------------------------------------------------------------* | |
1754 | :h3. NegSem_150602_ReferencingRecordAndSetFields_014 negative test | |
1755 | .*---------------------------------------------------------------------* | |
1756 | :xmp tab=0. | |
1757 | ||
1758 | <TC - Ensure that referencing an element within a value list causes an error in the context of set of. > | |
1759 | ||
1760 | <COMPILE> | |
1761 | <EXECUTE_PARALLEL> | |
1762 | ||
1763 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_014 NegSem_150603_ReferencingRecordOfAndSetElements_014.ttcn > | |
1764 | /***************************************************************** | |
1765 | ** @version 0.0.1 | |
1766 | ** @purpose 1:15.6.3, Ensure that referencing an element within a value list causes an error in the context of set of. | |
1767 | ** @verdict pass reject | |
1768 | *****************************************************************/ | |
1769 | ||
1770 | module NegSem_150603_ReferencingRecordOfAndSetElements_014 { | |
1771 | ||
1772 | type component GeneralComp { } | |
1773 | ||
1774 | type set of integer SoI; | |
1775 | type set of SoI SoSoI; | |
1776 | ||
1777 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_014() runs on GeneralComp { | |
1778 | var template SoI m_one; | |
1779 | var template SoSoI m_two; | |
1780 | template SoSoI constraint_value := {{},{0},{0,0},{0,0,0}}; | |
1781 | ||
1782 | m_two := ( constraint_value, constraint_value ); // value list | |
1783 | m_one := m_two[0]; // shall cause an error as we access a value list | |
1784 | ||
1785 | setverdict(fail); | |
1786 | } | |
1787 | ||
1788 | control{ | |
1789 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_014()); | |
1790 | } | |
1791 | ||
1792 | } | |
1793 | <END_MODULE> | |
1794 | ||
1795 | <RESULT COUNT 1> | |
1796 | Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_014.SoSoI. | |
1797 | <END_RESULT> | |
1798 | ||
1799 | <END_TC> | |
1800 | :exmp | |
1801 | ||
1802 | *---------------------------------------------------------------------* | |
1803 | :h3. NegSem_150602_ReferencingRecordAndSetFields_015 negative test | |
1804 | .*---------------------------------------------------------------------* | |
1805 | :xmp tab=0. | |
1806 | ||
1807 | <TC - Ensure that referencing an element of an address type, which actual value is null shall cause an error. > | |
1808 | ||
1809 | <COMPILE> | |
1810 | ||
1811 | <MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_015 NegSem_150603_ReferencingRecordOfAndSetElements_015.ttcn > | |
1812 | /***************************************************************** | |
1813 | ** @version 0.0.1 | |
1814 | ** @purpose 1:15.6.3, Ensure that referencing an element of an address type, which actual value is null shall cause an error. | |
1815 | ** @verdict pass reject | |
1816 | *****************************************************************/ | |
1817 | ||
1818 | //Restriction h) | |
1819 | /*Special value null: referencing an element of an address type, which actual value is null shall cause an error.*/ | |
1820 | ||
1821 | module NegSem_150603_ReferencingRecordOfAndSetElements_015 { | |
1822 | ||
1823 | type component GeneralComp { } | |
1824 | ||
1825 | type set of integer RoI; | |
1826 | type integer address; | |
1827 | ||
1828 | testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_015() runs on GeneralComp { | |
1829 | var address v_add := null; | |
1830 | var template RoI m_one; | |
1831 | ||
1832 | ||
1833 | m_one := {v_add, 1}; // // shall cause an error as we access a value list | |
1834 | ||
1835 | setverdict(pass); | |
1836 | } | |
1837 | ||
1838 | control{ | |
1839 | execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_015()); | |
1840 | } | |
1841 | ||
1842 | } | |
1843 | <END_MODULE> | |
1844 | ||
1845 | <RESULT COUNT 1> | |
1846 | error: integer value was expected | |
1847 | <END_RESULT> | |
1848 | ||
1849 | <END_TC> | |
1850 | :exmp | |
1851 | ||
1852 | *---------------------------------------------------------------------* | |
1853 | :h3. NegSem_150605_Referencing_union_alternatives_001 negative test | |
1854 | .*---------------------------------------------------------------------* | |
1855 | :xmp tab=0. | |
1856 | ||
1857 | <TC - Ensure that template variables does not allow referencing alternatives inside an union with omit > | |
1858 | ||
1859 | <COMPILE> | |
1860 | <EXECUTE_PARALLEL> | |
1861 | ||
1862 | <MODULE TTCN NegSem_150605_Referencing_union_alternatives_001 NegSem_150605_Referencing_union_alternatives_001.ttcn > | |
1863 | /***************************************************************** | |
1864 | ** @version 0.0.1 | |
1865 | ** @purpose 1:15.6.5, Ensure that template variables does not allow referencing alternatives inside an union with omit | |
1866 | ** @verdict pass reject | |
1867 | *****************************************************************/ | |
1868 | ||
1869 | //Restriction a) | |
1870 | /*referencing an alternative of a union template or template field to which Omit, AnyValueOrNone, | |
1871 | * a template list or a complemented list is assigned, at the right hand side of an assignment, shall cause an error.*/ | |
1872 | ||
1873 | ||
1874 | ||
1875 | module NegSem_150605_Referencing_union_alternatives_001 { | |
1876 | ||
1877 | type union My_Union { | |
1878 | integer u1, | |
1879 | float u2 | |
1880 | } | |
1881 | ||
1882 | type record ExampleType { // Exampletype record with union | |
1883 | integer a, | |
1884 | My_Union b optional | |
1885 | } | |
1886 | ||
1887 | ||
1888 | type component GeneralComp { } | |
1889 | ||
1890 | ||
1891 | testcase TC_NegSem_150605_Referencing_union_alternatives_001() runs on GeneralComp { | |
1892 | ||
1893 | var template ExampleType m_template; | |
1894 | var template integer m_template_2; | |
1895 | ||
1896 | //assign values to template: | |
1897 | ||
1898 | m_template.a:=10; | |
1899 | m_template.b:= omit; | |
1900 | ||
1901 | m_template_2 := m_template.b.u1; //error: omit | |
1902 | ||
1903 | setverdict(pass); | |
1904 | ||
1905 | } | |
1906 | ||
1907 | control{ | |
1908 | execute(TC_NegSem_150605_Referencing_union_alternatives_001()); | |
1909 | } | |
1910 | } | |
1911 | <END_MODULE> | |
1912 | ||
1913 | <RESULT COUNT 1> | |
1914 | Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_001.My_Union | |
1915 | <END_RESULT> | |
1916 | ||
1917 | <END_TC> | |
1918 | :exmp | |
1919 | ||
1920 | *---------------------------------------------------------------------* | |
1921 | :h3. NegSem_150605_Referencing_union_alternatives_002 negative test | |
1922 | .*---------------------------------------------------------------------* | |
1923 | :xmp tab=0. | |
1924 | ||
1925 | <TC - Ensure that template variables does not allow referencing alternatives inside an union with AnyValueOrNone > | |
1926 | ||
1927 | <COMPILE> | |
1928 | <EXECUTE_PARALLEL> | |
1929 | ||
1930 | <MODULE TTCN NegSem_150605_Referencing_union_alternatives_002 NegSem_150605_Referencing_union_alternatives_002.ttcn > | |
1931 | /***************************************************************** | |
1932 | ** @version 0.0.1 | |
1933 | ** @purpose 1:15.6.5, Ensure that template variables does not allow referencing alternatives inside an union with AnyValueOrNone | |
1934 | ** @verdict pass reject | |
1935 | *****************************************************************/ | |
1936 | //Restriction a) | |
1937 | /*referencing an alternative of a union template | |
1938 | or template field to which Omit, AnyValueOrNone, a template list or a complemented list is assigned, at the right hand side of an assignment, shall cause an error.*/ | |
1939 | ||
1940 | ||
1941 | module NegSem_150605_Referencing_union_alternatives_002 { | |
1942 | ||
1943 | type union My_Union { | |
1944 | integer u1, | |
1945 | float u2 | |
1946 | } | |
1947 | ||
1948 | type record ExampleType { // Exampletype record with union | |
1949 | integer a, | |
1950 | My_Union b optional | |
1951 | } | |
1952 | ||
1953 | type component GeneralComp { } | |
1954 | ||
1955 | ||
1956 | testcase TC_NegSem_150605_Referencing_union_alternatives_002() runs on GeneralComp { | |
1957 | ||
1958 | var template ExampleType m_template; | |
1959 | var template integer m_template_2; | |
1960 | ||
1961 | //assign values to template: | |
1962 | ||
1963 | m_template.a:=10; | |
1964 | m_template.b:= *; | |
1965 | ||
1966 | m_template_2 := m_template.b.u1; //error: AnyValueOrNone | |
1967 | ||
1968 | setverdict(pass); | |
1969 | ||
1970 | } | |
1971 | ||
1972 | control{ | |
1973 | execute(TC_NegSem_150605_Referencing_union_alternatives_002()); | |
1974 | } | |
1975 | } | |
1976 | <END_MODULE> | |
1977 | ||
1978 | <RESULT COUNT 1> | |
1979 | Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_002.My_Union. | |
1980 | <END_RESULT> | |
1981 | ||
1982 | <END_TC> | |
1983 | :exmp | |
1984 | ||
1985 | .*---------------------------------------------------------------------* | |
1986 | :h2. 1508_template_restrictions folder | |
1987 | .*---------------------------------------------------------------------* | |
1988 | ||
1989 | *---------------------------------------------------------------------* | |
1990 | :h3. NegSem_1508_TemplateRestrictions_001 negative test | |
1991 | .*---------------------------------------------------------------------* | |
1992 | :xmp tab=0. | |
1993 | ||
1994 | <TC - Ensure that template(omit) is rejected with anyvalue(?). > | |
1995 | ||
1996 | <COMPILE> | |
1997 | ||
1998 | <MODULE TTCN NegSem_1508_TemplateRestrictions_001 NegSem_1508_TemplateRestrictions_001.ttcn > | |
1999 | /***************************************************************** | |
2000 | ** @version 0.0.1 | |
2001 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyvalue(?). | |
2002 | ** @verdict pass reject | |
2003 | *****************************************************************/ | |
2004 | ||
2005 | module NegSem_1508_TemplateRestrictions_001 { | |
2006 | ||
2007 | type record ExampleType { | |
2008 | integer a, | |
2009 | boolean b optional | |
2010 | } | |
2011 | ||
2012 | template(omit) ExampleType exampleOmitAny := ?; | |
2013 | ||
2014 | } | |
2015 | <END_MODULE> | |
2016 | ||
2017 | <RESULT COUNT 1> | |
2018 | error: Restriction on template definition does not allow usage of any value | |
2019 | <END_RESULT> | |
2020 | ||
2021 | <END_TC> | |
2022 | :exmp | |
2023 | ||
2024 | *---------------------------------------------------------------------* | |
2025 | :h3. NegSem_1508_TemplateRestrictions_002 negative test | |
2026 | .*---------------------------------------------------------------------* | |
2027 | :xmp tab=0. | |
2028 | ||
2029 | <TC - Ensure that template(omit) is rejected with setof template. > | |
2030 | ||
2031 | <COMPILE> | |
2032 | ||
2033 | <MODULE TTCN NegSem_1508_TemplateRestrictions_002 NegSem_1508_TemplateRestrictions_002.ttcn > | |
2034 | /***************************************************************** | |
2035 | ** @version 0.0.1 | |
2036 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with setof template. | |
2037 | ** @verdict pass reject | |
2038 | *****************************************************************/ | |
2039 | ||
2040 | module NegSem_1508_TemplateRestrictions_002 { | |
2041 | ||
2042 | type record ExampleType { | |
2043 | integer a, | |
2044 | boolean b optional | |
2045 | } | |
2046 | ||
2047 | template(omit) ExampleType exampleOmitAny := ({1,true},{2,false}); | |
2048 | ||
2049 | } | |
2050 | <END_MODULE> | |
2051 | ||
2052 | <RESULT COUNT 1> | |
2053 | error: Restriction on template definition does not allow usage of value list match | |
2054 | <END_RESULT> | |
2055 | ||
2056 | <END_TC> | |
2057 | :exmp | |
2058 | ||
2059 | *---------------------------------------------------------------------* | |
2060 | :h3. NegSem_1508_TemplateRestrictions_003 negative test | |
2061 | .*---------------------------------------------------------------------* | |
2062 | :xmp tab=0. | |
2063 | ||
2064 | <TC - Ensure that template(omit) is rejected with anyvalueornone(*). > | |
2065 | ||
2066 | <COMPILE> | |
2067 | ||
2068 | <MODULE TTCN NegSem_1508_TemplateRestrictions_003 NegSem_1508_TemplateRestrictions_003.ttcn > | |
2069 | /***************************************************************** | |
2070 | ** @version 0.0.1 | |
2071 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyvalueornone(*). | |
2072 | ** @verdict pass reject | |
2073 | *****************************************************************/ | |
2074 | ||
2075 | module NegSem_1508_TemplateRestrictions_003 { | |
2076 | ||
2077 | type record ExampleType { | |
2078 | integer a, | |
2079 | boolean b optional | |
2080 | } | |
2081 | ||
2082 | template(omit) ExampleType exampleOmitAny := *; | |
2083 | ||
2084 | } | |
2085 | <END_MODULE> | |
2086 | ||
2087 | <RESULT COUNT 1> | |
2088 | error: Restriction on template definition does not allow usage of any or omit | |
2089 | <END_RESULT> | |
2090 | ||
2091 | <END_TC> | |
2092 | :exmp | |
2093 | ||
2094 | *---------------------------------------------------------------------* | |
2095 | :h3. NegSem_1508_TemplateRestrictions_004 negative test | |
2096 | .*---------------------------------------------------------------------* | |
2097 | :xmp tab=0. | |
2098 | ||
2099 | <TC - Ensure that template(omit) is rejected with value ranges. > | |
2100 | ||
2101 | <COMPILE> | |
2102 | ||
2103 | <MODULE TTCN NegSem_1508_TemplateRestrictions_004 NegSem_1508_TemplateRestrictions_004.ttcn > | |
2104 | /***************************************************************** | |
2105 | ** @version 0.0.1 | |
2106 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with value ranges. | |
2107 | ** @verdict pass reject | |
2108 | *****************************************************************/ | |
2109 | ||
2110 | module NegSem_1508_TemplateRestrictions_004 { | |
2111 | ||
2112 | type record ExampleType { | |
2113 | integer a, | |
2114 | boolean b optional | |
2115 | } | |
2116 | ||
2117 | template(omit) ExampleType exampleOmitAny := {(1..6), true}; | |
2118 | ||
2119 | } | |
2120 | <END_MODULE> | |
2121 | ||
2122 | <RESULT COUNT 1> | |
2123 | error: Restriction on template definition does not allow usage of value range match | |
2124 | <END_RESULT> | |
2125 | ||
2126 | <END_TC> | |
2127 | :exmp | |
2128 | ||
2129 | *---------------------------------------------------------------------* | |
2130 | :h3. NegSem_1508_TemplateRestrictions_005 negative test | |
2131 | .*---------------------------------------------------------------------* | |
2132 | :xmp tab=0. | |
2133 | ||
2134 | <TC - Ensure that template(omit) is rejected with supersets. > | |
2135 | ||
2136 | <COMPILE> | |
2137 | ||
2138 | <MODULE TTCN NegSem_1508_TemplateRestrictions_005 NegSem_1508_TemplateRestrictions_005.ttcn > | |
2139 | /***************************************************************** | |
2140 | ** @version 0.0.1 | |
2141 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with supersets. | |
2142 | ** @verdict pass reject | |
2143 | *****************************************************************/ | |
2144 | ||
2145 | module NegSem_1508_TemplateRestrictions_005 { | |
2146 | ||
2147 | type record ExampleType { | |
2148 | set of integer a, | |
2149 | boolean b optional | |
2150 | } | |
2151 | ||
2152 | template(omit) ExampleType exampleOmitAny := {superset(1,2,3), true}; | |
2153 | ||
2154 | } | |
2155 | <END_MODULE> | |
2156 | ||
2157 | <RESULT COUNT 1> | |
2158 | error: Restriction on template definition does not allow usage of superset match | |
2159 | <END_RESULT> | |
2160 | ||
2161 | <END_TC> | |
2162 | :exmp | |
2163 | ||
2164 | *---------------------------------------------------------------------* | |
2165 | :h3. NegSem_1508_TemplateRestrictions_006 negative test | |
2166 | .*---------------------------------------------------------------------* | |
2167 | :xmp tab=0. | |
2168 | ||
2169 | <TC - Ensure that template(omit) is rejected with supersets. > | |
2170 | ||
2171 | <COMPILE> | |
2172 | ||
2173 | <MODULE TTCN NegSem_1508_TemplateRestrictions_006 NegSem_1508_TemplateRestrictions_006.ttcn > | |
2174 | /***************************************************************** | |
2175 | ** @version 0.0.1 | |
2176 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with subsets. | |
2177 | ** @verdict pass reject | |
2178 | *****************************************************************/ | |
2179 | ||
2180 | module NegSem_1508_TemplateRestrictions_006 { | |
2181 | ||
2182 | type record ExampleType { | |
2183 | set of integer a, | |
2184 | boolean b optional | |
2185 | } | |
2186 | ||
2187 | template(omit) ExampleType exampleOmitAny := {subset(1,2,3), true}; | |
2188 | ||
2189 | } | |
2190 | <END_MODULE> | |
2191 | ||
2192 | <RESULT COUNT 1> | |
2193 | error: Restriction on template definition does not allow usage of subset match | |
2194 | <END_RESULT> | |
2195 | ||
2196 | <END_TC> | |
2197 | :exmp | |
2198 | ||
2199 | *---------------------------------------------------------------------* | |
2200 | :h3. NegSem_1508_TemplateRestrictions_007 negative test | |
2201 | .*---------------------------------------------------------------------* | |
2202 | :xmp tab=0. | |
2203 | ||
2204 | <TC - Ensure that template(omit) is rejected with patterns. > | |
2205 | ||
2206 | <COMPILE> | |
2207 | ||
2208 | <MODULE TTCN NegSem_1508_TemplateRestrictions_007 NegSem_1508_TemplateRestrictions_007.ttcn > | |
2209 | /***************************************************************** | |
2210 | ** @version 0.0.1 | |
2211 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with patterns. | |
2212 | ** @verdict pass reject | |
2213 | *****************************************************************/ | |
2214 | ||
2215 | module NegSem_1508_TemplateRestrictions_007 { | |
2216 | ||
2217 | type record ExampleType { | |
2218 | integer a, | |
2219 | charstring b | |
2220 | } | |
2221 | ||
2222 | template(omit) ExampleType exampleOmitAny := {1, pattern "ab*c"}; | |
2223 | ||
2224 | } | |
2225 | <END_MODULE> | |
2226 | ||
2227 | <RESULT COUNT 1> | |
2228 | error: Restriction on template definition does not allow usage of character string pattern | |
2229 | <END_RESULT> | |
2230 | ||
2231 | <END_TC> | |
2232 | :exmp | |
2233 | ||
2234 | *---------------------------------------------------------------------* | |
2235 | :h3. NegSem_1508_TemplateRestrictions_008 negative test | |
2236 | .*---------------------------------------------------------------------* | |
2237 | :xmp tab=0. | |
2238 | ||
2239 | <TC - Ensure that template(omit) is rejected with anyelement inside values. > | |
2240 | ||
2241 | <COMPILE> | |
2242 | ||
2243 | <MODULE TTCN NegSem_1508_TemplateRestrictions_008 NegSem_1508_TemplateRestrictions_008.ttcn > | |
2244 | /***************************************************************** | |
2245 | ** @version 0.0.1 | |
2246 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyelement inside values. | |
2247 | ** @verdict pass reject | |
2248 | *****************************************************************/ | |
2249 | ||
2250 | module NegSem_1508_TemplateRestrictions_008 { | |
2251 | ||
2252 | type record ExampleType { | |
2253 | integer a, | |
2254 | charstring b | |
2255 | } | |
2256 | ||
2257 | template(omit) ExampleType exampleOmitAny := {2, ?}; | |
2258 | ||
2259 | } | |
2260 | <END_MODULE> | |
2261 | ||
2262 | <RESULT COUNT 1> | |
2263 | error: Restriction on template definition does not allow usage of any value | |
2264 | <END_RESULT> | |
2265 | ||
2266 | <END_TC> | |
2267 | :exmp | |
2268 | ||
2269 | *---------------------------------------------------------------------* | |
2270 | :h3. NegSem_1508_TemplateRestrictions_009 negative test | |
2271 | .*---------------------------------------------------------------------* | |
2272 | :xmp tab=0. | |
2273 | ||
2274 | <TC - Ensure that template(omit) is rejected with anyelementornone inside values. > | |
2275 | ||
2276 | <COMPILE> | |
2277 | ||
2278 | <MODULE TTCN NegSem_1508_TemplateRestrictions_009 NegSem_1508_TemplateRestrictions_009.ttcn > | |
2279 | /***************************************************************** | |
2280 | ** @version 0.0.1 | |
2281 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyelementornone inside values. | |
2282 | ** @verdict pass reject | |
2283 | *****************************************************************/ | |
2284 | ||
2285 | module NegSem_1508_TemplateRestrictions_009 { | |
2286 | ||
2287 | type record ExampleType { | |
2288 | integer a, | |
2289 | charstring b | |
2290 | } | |
2291 | ||
2292 | template(omit) ExampleType exampleOmitAny := {2, *}; | |
2293 | ||
2294 | } | |
2295 | <END_MODULE> | |
2296 | ||
2297 | <RESULT COUNT 1> | |
2298 | error: Restriction on template definition does not allow usage of any or omit | |
2299 | <END_RESULT> | |
2300 | ||
2301 | <END_TC> | |
2302 | :exmp | |
2303 | ||
2304 | *---------------------------------------------------------------------* | |
2305 | :h3. NegSem_1508_TemplateRestrictions_010 negative test | |
2306 | .*---------------------------------------------------------------------* | |
2307 | :xmp tab=0. | |
2308 | ||
2309 | <TC - Ensure that template(omit) is rejected with permutation inside values. > | |
2310 | ||
2311 | <COMPILE> | |
2312 | ||
2313 | <MODULE TTCN NegSem_1508_TemplateRestrictions_010 NegSem_1508_TemplateRestrictions_010.ttcn > | |
2314 | /***************************************************************** | |
2315 | ** @version 0.0.1 | |
2316 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with permutation inside values. | |
2317 | ** @verdict pass reject | |
2318 | *****************************************************************/ | |
2319 | ||
2320 | module NegSem_1508_TemplateRestrictions_010 { | |
2321 | ||
2322 | type record ExampleType { | |
2323 | set of integer a, | |
2324 | charstring b | |
2325 | } | |
2326 | ||
2327 | template(omit) ExampleType exampleOmitAny := {permutation(2,4,6),"abcde"}; | |
2328 | ||
2329 | } | |
2330 | <END_MODULE> | |
2331 | ||
2332 | <RESULT COUNT 1> | |
2333 | error: Restriction on template definition does not allow usage of permutation match | |
2334 | <END_RESULT> | |
2335 | ||
2336 | <END_TC> | |
2337 | :exmp | |
2338 | ||
2339 | *---------------------------------------------------------------------* | |
2340 | :h3. NegSem_1508_TemplateRestrictions_011 negative test | |
2341 | .*---------------------------------------------------------------------* | |
2342 | :xmp tab=0. | |
2343 | ||
2344 | <TC - Ensure that template(omit) is rejected with length restrictions. > | |
2345 | ||
2346 | <COMPILE> | |
2347 | ||
2348 | <MODULE TTCN NegSem_1508_TemplateRestrictions_011 NegSem_1508_TemplateRestrictions_011.ttcn > | |
2349 | /***************************************************************** | |
2350 | ** @version 0.0.1 | |
2351 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. | |
2352 | ** @verdict pass reject | |
2353 | *****************************************************************/ | |
2354 | ||
2355 | module NegSem_1508_TemplateRestrictions_011 { | |
2356 | ||
2357 | type record ExampleType { | |
2358 | charstring b | |
2359 | } | |
2360 | ||
2361 | template(omit) ExampleType exampleOmitAny := {"abcde" length(1..3)}; | |
2362 | ||
2363 | } | |
2364 | <END_MODULE> | |
2365 | ||
2366 | <RESULT COUNT 1> | |
2367 | error: Restriction on template definition does not allow usage of length restriction | |
2368 | <END_RESULT> | |
2369 | ||
2370 | <END_TC> | |
2371 | :exmp | |
2372 | ||
2373 | *---------------------------------------------------------------------* | |
2374 | :h3. NegSem_1508_TemplateRestrictions_012 negative test | |
2375 | .*---------------------------------------------------------------------* | |
2376 | :xmp tab=0. | |
2377 | ||
2378 | <TC - Ensure that template(omit) is rejected with length restrictions. > | |
2379 | ||
2380 | <COMPILE> | |
2381 | ||
2382 | <MODULE TTCN NegSem_1508_TemplateRestrictions_012 NegSem_1508_TemplateRestrictions_012.ttcn > | |
2383 | /***************************************************************** | |
2384 | ** @version 0.0.1 | |
2385 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. | |
2386 | ** @verdict pass reject | |
2387 | *****************************************************************/ | |
2388 | ||
2389 | module NegSem_1508_TemplateRestrictions_012 { | |
2390 | ||
2391 | type record ExampleType { | |
2392 | charstring b | |
2393 | } | |
2394 | ||
2395 | template(omit) ExampleType exampleOmitAny := {"abcde" ifpresent}; | |
2396 | ||
2397 | } | |
2398 | <END_MODULE> | |
2399 | ||
2400 | <RESULT COUNT 1> | |
2401 | error: Restriction on template definition does not allow usage of `ifpresent' | |
2402 | <END_RESULT> | |
2403 | <RESULT COUNT 1> | |
2404 | error: `ifpresent' is not allowed here | |
2405 | <END_RESULT> | |
2406 | ||
2407 | <END_TC> | |
2408 | :exmp | |
2409 | ||
2410 | *---------------------------------------------------------------------* | |
2411 | :h3. NegSem_1508_TemplateRestrictions_013 negative test | |
2412 | .*---------------------------------------------------------------------* | |
2413 | :xmp tab=0. | |
2414 | ||
2415 | <TC - Ensure that template(omit) is rejected with length restrictions. > | |
2416 | ||
2417 | <COMPILE> | |
2418 | ||
2419 | <MODULE TTCN NegSem_1508_TemplateRestrictions_013 NegSem_1508_TemplateRestrictions_013.ttcn > | |
2420 | /***************************************************************** | |
2421 | ** @version 0.0.1 | |
2422 | ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. | |
2423 | ** @verdict pass reject | |
2424 | *****************************************************************/ | |
2425 | ||
2426 | module NegSem_1508_TemplateRestrictions_013 { | |
2427 | ||
2428 | type record ExampleType { | |
2429 | integer f1 | |
2430 | } | |
2431 | ||
2432 | template(omit) ExampleType exampleOmitAny := {complement(2,3)}; | |
2433 | ||
2434 | } | |
2435 | <END_MODULE> | |
2436 | ||
2437 | <RESULT COUNT 1> | |
2438 | error: Restriction on template definition does not allow usage of complemented list match | |
2439 | <END_RESULT> | |
2440 | ||
2441 | <END_TC> | |
2442 | :exmp | |
2443 | ||
2444 | *---------------------------------------------------------------------* | |
2445 | :h3. NegSem_1508_TemplateRestrictions_014 negative test | |
2446 | .*---------------------------------------------------------------------* | |
2447 | :xmp tab=0. | |
2448 | ||
2449 | <TC - Ensure that template(value) is rejected with anyvalue(?). > | |
2450 | ||
2451 | <COMPILE> | |
2452 | ||
2453 | <MODULE TTCN NegSem_1508_TemplateRestrictions_014 NegSem_1508_TemplateRestrictions_014.ttcn > | |
2454 | /***************************************************************** | |
2455 | ** @version 0.0.1 | |
2456 | ** @purpose 1:15.8, Ensure that template(value) is rejected with anyvalue(?). | |
2457 | ** @verdict pass reject | |
2458 | *****************************************************************/ | |
2459 | ||
2460 | module NegSem_1508_TemplateRestrictions_014 { | |
2461 | ||
2462 | type record ExampleType { | |
2463 | integer a, | |
2464 | boolean b optional | |
2465 | } | |
2466 | ||
2467 | template(value) ExampleType exampleOmitAny := ?; | |
2468 | ||
2469 | } | |
2470 | <END_MODULE> | |
2471 | ||
2472 | <RESULT COUNT 1> | |
2473 | error: Restriction on template definition does not allow usage of any value | |
2474 | <END_RESULT> | |
2475 | ||
2476 | <END_TC> | |
2477 | :exmp | |
2478 | ||
2479 | *---------------------------------------------------------------------* | |
2480 | :h3. NegSem_1508_TemplateRestrictions_015 negative test | |
2481 | .*---------------------------------------------------------------------* | |
2482 | :xmp tab=0. | |
2483 | ||
2484 | <TC - Ensure that template(value) is rejected with valuelist. > | |
2485 | ||
2486 | <COMPILE> | |
2487 | ||
2488 | <MODULE TTCN NegSem_1508_TemplateRestrictions_015 NegSem_1508_TemplateRestrictions_015.ttcn > | |
2489 | /***************************************************************** | |
2490 | ** @version 0.0.1 | |
2491 | ** @purpose 1:15.8, Ensure that template(value) is rejected with valuelist. | |
2492 | ** @verdict pass reject | |
2493 | *****************************************************************/ | |
2494 | ||
2495 | module NegSem_1508_TemplateRestrictions_015 { | |
2496 | ||
2497 | type record ExampleType { | |
2498 | integer a, | |
2499 | boolean b optional | |
2500 | } | |
2501 | ||
2502 | template(value) ExampleType exampleOmitAny := ({1,true},{2,false}); | |
2503 | ||
2504 | } | |
2505 | <END_MODULE> | |
2506 | ||
2507 | <RESULT COUNT 1> | |
2508 | error: Restriction on template definition does not allow usage of value list match | |
2509 | <END_RESULT> | |
2510 | ||
2511 | <END_TC> | |
2512 | :exmp | |
2513 | ||
2514 | *---------------------------------------------------------------------* | |
2515 | :h3. NegSem_1508_TemplateRestrictions_016 negative test | |
2516 | .*---------------------------------------------------------------------* | |
2517 | :xmp tab=0. | |
2518 | ||
2519 | <TC - Ensure that template(value) is rejected with anyvalueornone(*). > | |
2520 | ||
2521 | <COMPILE> | |
2522 | ||
2523 | <MODULE TTCN NegSem_1508_TemplateRestrictions_016 NegSem_1508_TemplateRestrictions_016.ttcn > | |
2524 | /***************************************************************** | |
2525 | ** @version 0.0.1 | |
2526 | ** @purpose 1:15.8, Ensure that template(value) is rejected with anyvalueornone(*). | |
2527 | ** @verdict pass reject | |
2528 | *****************************************************************/ | |
2529 | ||
2530 | module NegSem_1508_TemplateRestrictions_016 { | |
2531 | ||
2532 | type record ExampleType { | |
2533 | integer a, | |
2534 | boolean b optional | |
2535 | } | |
2536 | ||
2537 | template(value) ExampleType exampleOmitAny := *; | |
2538 | ||
2539 | } | |
2540 | <END_MODULE> | |
2541 | ||
2542 | <RESULT COUNT 1> | |
2543 | error: Restriction on template definition does not allow usage of any or omit | |
2544 | <END_RESULT> | |
2545 | ||
2546 | <END_TC> | |
2547 | :exmp | |
2548 | ||
2549 | *---------------------------------------------------------------------* | |
2550 | :h3. NegSem_1508_TemplateRestrictions_017 negative test | |
2551 | .*---------------------------------------------------------------------* | |
2552 | :xmp tab=0. | |
2553 | ||
2554 | <TC - Ensure that template(value) is rejected with value ranges. > | |
2555 | ||
2556 | <COMPILE> | |
2557 | ||
2558 | <MODULE TTCN NegSem_1508_TemplateRestrictions_017 NegSem_1508_TemplateRestrictions_017.ttcn > | |
2559 | /***************************************************************** | |
2560 | ** @version 0.0.1 | |
2561 | ** @purpose 1:15.8, Ensure that template(value) is rejected with value ranges. | |
2562 | ** @verdict pass reject | |
2563 | *****************************************************************/ | |
2564 | ||
2565 | module NegSem_1508_TemplateRestrictions_017 { | |
2566 | ||
2567 | type record ExampleType { | |
2568 | integer a, | |
2569 | boolean b optional | |
2570 | } | |
2571 | ||
2572 | template(value) ExampleType exampleOmitAny := {(1..6), true}; | |
2573 | ||
2574 | } | |
2575 | <END_MODULE> | |
2576 | ||
2577 | <RESULT COUNT 1> | |
2578 | error: Restriction on template definition does not allow usage of value range match | |
2579 | <END_RESULT> | |
2580 | ||
2581 | <END_TC> | |
2582 | :exmp | |
2583 | ||
2584 | *---------------------------------------------------------------------* | |
2585 | :h3. NegSem_1508_TemplateRestrictions_018 negative test | |
2586 | .*---------------------------------------------------------------------* | |
2587 | :xmp tab=0. | |
2588 | ||
2589 | <TC - Ensure that template(value) is rejected with supersets. > | |
2590 | ||
2591 | <COMPILE> | |
2592 | ||
2593 | <MODULE TTCN NegSem_1508_TemplateRestrictions_018 NegSem_1508_TemplateRestrictions_018.ttcn > | |
2594 | /***************************************************************** | |
2595 | ** @version 0.0.1 | |
2596 | ** @purpose 1:15.8, Ensure that template(value) is rejected with supersets. | |
2597 | ** @verdict pass reject | |
2598 | *****************************************************************/ | |
2599 | ||
2600 | module NegSem_1508_TemplateRestrictions_018 { | |
2601 | ||
2602 | type record ExampleType { | |
2603 | set of integer a, | |
2604 | boolean b optional | |
2605 | } | |
2606 | ||
2607 | template(value) ExampleType exampleOmitAny := {superset(1,2,3), true}; | |
2608 | ||
2609 | } | |
2610 | <END_MODULE> | |
2611 | ||
2612 | <RESULT COUNT 1> | |
2613 | error: Restriction on template definition does not allow usage of superset match | |
2614 | <END_RESULT> | |
2615 | ||
2616 | <END_TC> | |
2617 | :exmp | |
2618 | ||
2619 | *---------------------------------------------------------------------* | |
2620 | :h3. NegSem_1508_TemplateRestrictions_019 negative test | |
2621 | .*---------------------------------------------------------------------* | |
2622 | :xmp tab=0. | |
2623 | ||
2624 | <TC - Ensure that template(value) is rejected with supersets. > | |
2625 | ||
2626 | <COMPILE> | |
2627 | ||
2628 | <MODULE TTCN NegSem_1508_TemplateRestrictions_019 NegSem_1508_TemplateRestrictions_019.ttcn > | |
2629 | /***************************************************************** | |
2630 | ** @version 0.0.1 | |
2631 | ** @purpose 1:15.8, Ensure that template(value) is rejected with supersets. | |
2632 | ** @verdict pass reject | |
2633 | *****************************************************************/ | |
2634 | ||
2635 | module NegSem_1508_TemplateRestrictions_019 { | |
2636 | ||
2637 | type record ExampleType { | |
2638 | set of integer a, | |
2639 | boolean b optional | |
2640 | } | |
2641 | ||
2642 | template(value) ExampleType exampleOmitAny := {subset(1,2,3), true}; | |
2643 | ||
2644 | } | |
2645 | <END_MODULE> | |
2646 | ||
2647 | <RESULT COUNT 1> | |
2648 | error: Restriction on template definition does not allow usage of subset match | |
2649 | <END_RESULT> | |
2650 | ||
2651 | <END_TC> | |
2652 | :exmp | |
2653 | ||
2654 | *---------------------------------------------------------------------* | |
2655 | :h3. NegSem_1508_TemplateRestrictions_020 negative test | |
2656 | .*---------------------------------------------------------------------* | |
2657 | :xmp tab=0. | |
2658 | ||
2659 | <TC - Ensure that template(value) is rejected with patterns. > | |
2660 | ||
2661 | <COMPILE> | |
2662 | ||
2663 | <MODULE TTCN NegSem_1508_TemplateRestrictions_020 NegSem_1508_TemplateRestrictions_020.ttcn > | |
2664 | /***************************************************************** | |
2665 | ** @version 0.0.1 | |
2666 | ** @purpose 1:15.8, Ensure that template(value) is rejected with patterns. | |
2667 | ** @verdict pass reject | |
2668 | *****************************************************************/ | |
2669 | ||
2670 | module NegSem_1508_TemplateRestrictions_020 { | |
2671 | ||
2672 | type record ExampleType { | |
2673 | integer a, | |
2674 | charstring b | |
2675 | } | |
2676 | ||
2677 | template(value) ExampleType exampleOmitAny := {1, pattern "ab*c"}; | |
2678 | ||
2679 | } | |
2680 | <END_MODULE> | |
2681 | ||
2682 | <RESULT COUNT 1> | |
2683 | error: Restriction on template definition does not allow usage of character string pattern | |
2684 | <END_RESULT> | |
2685 | ||
2686 | <END_TC> | |
2687 | :exmp | |
2688 | ||
2689 | *---------------------------------------------------------------------* | |
2690 | :h3. NegSem_1508_TemplateRestrictions_021 negative test | |
2691 | .*---------------------------------------------------------------------* | |
2692 | :xmp tab=0. | |
2693 | ||
2694 | <TC - Ensure that template(value) is rejected with anyelement inside values. > | |
2695 | ||
2696 | <COMPILE> | |
2697 | ||
2698 | <MODULE TTCN NegSem_1508_TemplateRestrictions_021 NegSem_1508_TemplateRestrictions_021.ttcn > | |
2699 | /***************************************************************** | |
2700 | ** @version 0.0.1 | |
2701 | ** @purpose 1:15.8, Ensure that template(value) is rejected with anyelement inside values. | |
2702 | ** @verdict pass reject | |
2703 | *****************************************************************/ | |
2704 | ||
2705 | module NegSem_1508_TemplateRestrictions_021 { | |
2706 | ||
2707 | type record ExampleType { | |
2708 | integer a, | |
2709 | charstring b | |
2710 | } | |
2711 | ||
2712 | template(value) ExampleType exampleOmitAny := {2, ?}; | |
2713 | ||
2714 | ||
2715 | } | |
2716 | <END_MODULE> | |
2717 | ||
2718 | <RESULT COUNT 1> | |
2719 | error: Restriction on template definition does not allow usage of any value | |
2720 | <END_RESULT> | |
2721 | ||
2722 | <END_TC> | |
2723 | :exmp | |
2724 | ||
2725 | *---------------------------------------------------------------------* | |
2726 | :h3. NegSem_1508_TemplateRestrictions_022 negative test | |
2727 | .*---------------------------------------------------------------------* | |
2728 | :xmp tab=0. | |
2729 | ||
2730 | <TC - Ensure that template(value) is rejected with permutation inside values. > | |
2731 | ||
2732 | <COMPILE> | |
2733 | ||
2734 | <MODULE TTCN NegSem_1508_TemplateRestrictions_022 NegSem_1508_TemplateRestrictions_022.ttcn > | |
2735 | /***************************************************************** | |
2736 | ** @version 0.0.1 | |
2737 | ** @purpose 1:15.8, Ensure that template(value) is rejected with permutation inside values. | |
2738 | ** @verdict pass reject | |
2739 | *****************************************************************/ | |
2740 | ||
2741 | module NegSem_1508_TemplateRestrictions_022 { | |
2742 | ||
2743 | type record ExampleType { | |
2744 | set of integer a, | |
2745 | charstring b | |
2746 | } | |
2747 | ||
2748 | template(value) ExampleType exampleOmitAny := {permutation(2,4,6),"abcde"}; | |
2749 | ||
2750 | } | |
2751 | <END_MODULE> | |
2752 | ||
2753 | <RESULT COUNT 1> | |
2754 | error: Restriction on template definition does not allow usage of permutation match | |
2755 | <END_RESULT> | |
2756 | ||
2757 | <END_TC> | |
2758 | :exmp | |
2759 | ||
2760 | *---------------------------------------------------------------------* | |
2761 | :h3. NegSem_1508_TemplateRestrictions_023 negative test | |
2762 | .*---------------------------------------------------------------------* | |
2763 | :xmp tab=0. | |
2764 | ||
2765 | <TC - Ensure that template(value) is rejected with length restrictions. > | |
2766 | ||
2767 | <COMPILE> | |
2768 | ||
2769 | <MODULE TTCN NegSem_1508_TemplateRestrictions_023 NegSem_1508_TemplateRestrictions_023.ttcn > | |
2770 | /***************************************************************** | |
2771 | ** @version 0.0.1 | |
2772 | ** @purpose 1:15.8, Ensure that template(value) is rejected with length restrictions. | |
2773 | ** @verdict pass reject | |
2774 | *****************************************************************/ | |
2775 | ||
2776 | module NegSem_1508_TemplateRestrictions_023 { | |
2777 | ||
2778 | type record ExampleType { | |
2779 | charstring b | |
2780 | } | |
2781 | ||
2782 | template(value) ExampleType exampleOmitAny := {"abcde" length(1..3)}; | |
2783 | ||
2784 | } | |
2785 | <END_MODULE> | |
2786 | ||
2787 | <RESULT COUNT 1> | |
2788 | error: Restriction on template definition does not allow usage of length restriction | |
2789 | <END_RESULT> | |
2790 | ||
2791 | <END_TC> | |
2792 | :exmp | |
2793 | ||
2794 | *---------------------------------------------------------------------* | |
2795 | :h3. NegSem_1508_TemplateRestrictions_024 negative test | |
2796 | .*---------------------------------------------------------------------* | |
2797 | :xmp tab=0. | |
2798 | ||
2799 | <TC - Ensure that template(value) is rejected with length restrictions. > | |
2800 | ||
2801 | <COMPILE> | |
2802 | ||
2803 | <MODULE TTCN NegSem_1508_TemplateRestrictions_024 NegSem_1508_TemplateRestrictions_024.ttcn > | |
2804 | /***************************************************************** | |
2805 | ** @version 0.0.1 | |
2806 | ** @purpose 1:15.8, Ensure that template(value) is rejected with length restrictions. | |
2807 | ** @verdict pass reject | |
2808 | *****************************************************************/ | |
2809 | ||
2810 | module NegSem_1508_TemplateRestrictions_024 { | |
2811 | ||
2812 | type record ExampleType { | |
2813 | charstring b | |
2814 | } | |
2815 | ||
2816 | template(value) ExampleType exampleOmitAny := {"abcde" ifpresent}; | |
2817 | ||
2818 | } | |
2819 | <END_MODULE> | |
2820 | ||
2821 | <RESULT COUNT 1> | |
2822 | error: Restriction on template definition does not allow usage of `ifpresent' | |
2823 | <END_RESULT> | |
2824 | <RESULT COUNT 1> | |
2825 | error: `ifpresent' is not allowed here | |
2826 | <END_RESULT> | |
2827 | ||
2828 | <END_TC> | |
2829 | :exmp | |
2830 | ||
2831 | *---------------------------------------------------------------------* | |
2832 | :h3. NegSem_1508_TemplateRestrictions_025 negative test | |
2833 | .*---------------------------------------------------------------------* | |
2834 | :xmp tab=0. | |
2835 | ||
2836 | <TC - Ensure that template(value) is rejected with length restrictions. > | |
2837 | ||
2838 | <COMPILE> | |
2839 | ||
2840 | <MODULE TTCN NegSem_1508_TemplateRestrictions_025 NegSem_1508_TemplateRestrictions_025.ttcn > | |
2841 | /***************************************************************** | |
2842 | ** @version 0.0.1 | |
2843 | ** @purpose 1:15.8, Ensure that template(present) refuses omitvalue as a whole. | |
2844 | ** @verdict pass reject | |
2845 | *****************************************************************/ | |
2846 | ||
2847 | module NegSem_1508_TemplateRestrictions_025 { | |
2848 | ||
2849 | type record ExampleType { | |
2850 | integer a, | |
2851 | boolean b optional | |
2852 | } | |
2853 | ||
2854 | template(present) ExampleType exampleOmit := omit; | |
2855 | ||
2856 | } | |
2857 | <END_MODULE> | |
2858 | ||
2859 | <RESULT COUNT 1> | |
2860 | error: Restriction on template definition does not allow usage of omit value | |
2861 | <END_RESULT> | |
2862 | ||
2863 | <END_TC> | |
2864 | :exmp | |
2865 | ||
2866 | *---------------------------------------------------------------------* | |
2867 | :h3. NegSem_1508_TemplateRestrictions_026 negative test | |
2868 | .*---------------------------------------------------------------------* | |
2869 | :xmp tab=0. | |
2870 | ||
2871 | <TC - Ensure that template(value) refuses omit as a whole. > | |
2872 | ||
2873 | <COMPILE> | |
2874 | ||
2875 | <MODULE TTCN NegSem_1508_TemplateRestrictions_026 NegSem_1508_TemplateRestrictions_026.ttcn > | |
2876 | /***************************************************************** | |
2877 | ** @version 0.0.1 | |
2878 | ** @purpose 1:15.8, Ensure that template(value) refuses omit as a whole. | |
2879 | ** @verdict pass reject | |
2880 | *****************************************************************/ | |
2881 | ||
2882 | module NegSem_1508_TemplateRestrictions_026 { | |
2883 | ||
2884 | type record ExampleType { | |
2885 | integer a, | |
2886 | boolean b optional | |
2887 | } | |
2888 | ||
2889 | template(value) ExampleType exampleOmit := omit; | |
2890 | ||
2891 | } | |
2892 | <END_MODULE> | |
2893 | ||
2894 | <RESULT COUNT 1> | |
2895 | error: Restriction on template definition does not allow usage of omit value | |
2896 | <END_RESULT> | |
2897 | ||
2898 | <END_TC> | |
2899 | :exmp | |
2900 | ||
2901 | *---------------------------------------------------------------------* | |
2902 | :h3. NegSem_1508_TemplateRestrictions_029 negative test | |
2903 | .*---------------------------------------------------------------------* | |
2904 | :xmp tab=0. | |
2905 | ||
2906 | <TC - Ensure that the template(present) with anyvalue(?) can't be assigned to an omit restricted variable template > | |
2907 | ||
2908 | <COMPILE> | |
2909 | ||
2910 | <MODULE TTCN NegSem_1508_TemplateRestrictions_029 NegSem_1508_TemplateRestrictions_029.ttcn > | |
2911 | /***************************************************************** | |
2912 | ** @version 0.0.1 | |
2913 | ** @purpose 1:15.8, Ensure that the template(present) with anyvalue(?) can't be assigned to an omit restricted variable template | |
2914 | ** @verdict pass reject | |
2915 | *****************************************************************/ | |
2916 | ||
2917 | ||
2918 | module NegSem_1508_TemplateRestrictions_029 { | |
2919 | ||
2920 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
2921 | charstring a, | |
2922 | boolean b | |
2923 | } | |
2924 | ||
2925 | type component GeneralComp { | |
2926 | var template (omit) ExampleType v_omit; //omit restricted template variable | |
2927 | } | |
2928 | ||
2929 | template (present) ExampleType MyintTemplate :={ | |
2930 | //actual template with present restriction contains anytype (?) | |
2931 | a := ?, | |
2932 | b := false | |
2933 | } | |
2934 | ||
2935 | testcase TC_NegSem_1508_TemplateRestrictions_029() runs on GeneralComp { | |
2936 | ||
2937 | v_omit := MyintTemplate; //error: v_omit is omit restricted, hence can not contain anytype(?) | |
2938 | ||
2939 | if (valueof(v_omit.b) == false) { | |
2940 | setverdict(pass); | |
2941 | } else { | |
2942 | setverdict(fail); | |
2943 | } | |
2944 | } | |
2945 | ||
2946 | control{ | |
2947 | execute(TC_NegSem_1508_TemplateRestrictions_029()); | |
2948 | } | |
2949 | } | |
2950 | <END_MODULE> | |
2951 | ||
2952 | <RESULT COUNT 1> | |
2953 | error: Restriction on template does not allow usage of any value | |
2954 | <END_RESULT> | |
2955 | ||
2956 | <END_TC> | |
2957 | :exmp | |
2958 | ||
2959 | *---------------------------------------------------------------------* | |
2960 | :h3. NegSem_1508_TemplateRestrictions_030 negative test | |
2961 | .*---------------------------------------------------------------------* | |
2962 | :xmp tab=0. | |
2963 | ||
2964 | <TC - Ensure that unrestricted template with anyvalue(?) can't be assigned to an omit restricted variable template > | |
2965 | ||
2966 | <COMPILE> | |
2967 | ||
2968 | <MODULE TTCN NegSem_1508_TemplateRestrictions_030 NegSem_1508_TemplateRestrictions_030.ttcn > | |
2969 | /***************************************************************** | |
2970 | ** @version 0.0.1 | |
2971 | ** @purpose 1:15.8, Ensure that unrestricted template with anyvalue(?) can't be assigned to an omit restricted variable template | |
2972 | ** @verdict pass reject | |
2973 | *****************************************************************/ | |
2974 | ||
2975 | ||
2976 | module NegSem_1508_TemplateRestrictions_030 { | |
2977 | ||
2978 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
2979 | charstring a optional, | |
2980 | boolean b | |
2981 | } | |
2982 | ||
2983 | type component GeneralComp { | |
2984 | var template (omit) ExampleType v_omit; //omit restricted template variable | |
2985 | } | |
2986 | ||
2987 | ||
2988 | template ExampleType MyintTemplate :={ //actual template without restriction contains anyvalue (?) | |
2989 | a := ?, | |
2990 | b := false | |
2991 | } | |
2992 | ||
2993 | ||
2994 | testcase TC_NegSem_1508_TemplateRestrictions_030() runs on GeneralComp { | |
2995 | ||
2996 | v_omit := MyintTemplate; //error: v_omit is omit restricted, hence can not contain anyvalue(?) | |
2997 | ||
2998 | if (valueof(v_omit.b) == false) { | |
2999 | setverdict(pass); | |
3000 | } else { | |
3001 | setverdict(fail); | |
3002 | } | |
3003 | } | |
3004 | ||
3005 | control{ | |
3006 | execute(TC_NegSem_1508_TemplateRestrictions_030()); | |
3007 | } | |
3008 | } | |
3009 | <END_MODULE> | |
3010 | ||
3011 | <RESULT COUNT 1> | |
3012 | error: Restriction on template does not allow usage of any value | |
3013 | <END_RESULT> | |
3014 | ||
3015 | <END_TC> | |
3016 | :exmp | |
3017 | ||
3018 | *---------------------------------------------------------------------* | |
3019 | :h3. NegSem_1508_TemplateRestrictions_031 negative test | |
3020 | .*---------------------------------------------------------------------* | |
3021 | :xmp tab=0. | |
3022 | ||
3023 | <TC - Ensure that template(omit) can't be assigned to a variable template(value) if omit > | |
3024 | ||
3025 | <COMPILE> | |
3026 | ||
3027 | <MODULE TTCN NegSem_1508_TemplateRestrictions_031 NegSem_1508_TemplateRestrictions_031.ttcn > | |
3028 | /***************************************************************** | |
3029 | ** @version 0.0.1 | |
3030 | ** @purpose 1:15.8, Ensure that template(omit) can't be assigned to a variable template(value) if omit | |
3031 | ** @verdict pass reject | |
3032 | *****************************************************************/ | |
3033 | ||
3034 | ||
3035 | module NegSem_1508_TemplateRestrictions_031 { | |
3036 | ||
3037 | type record ExampleType { | |
3038 | // Exampletype record contains a charstring and a boolean | |
3039 | charstring a optional, | |
3040 | boolean b | |
3041 | } | |
3042 | ||
3043 | type component GeneralComp { | |
3044 | var template (value) ExampleType v_value; //value restricted template variable | |
3045 | } | |
3046 | ||
3047 | //actual template (with omit restriction) is omit | |
3048 | template (omit) ExampleType MyintTemplate := omit; | |
3049 | ||
3050 | testcase TC_NegSem_1508_TemplateRestrictions_031() runs on GeneralComp { | |
3051 | ||
3052 | v_value := MyintTemplate; //error: v_value is value restricted, hence can not be omit | |
3053 | ||
3054 | if (valueof(v_value.b) == false) { | |
3055 | setverdict(pass); | |
3056 | } else { | |
3057 | setverdict(fail); | |
3058 | } | |
3059 | } | |
3060 | ||
3061 | control{ | |
3062 | execute(TC_NegSem_1508_TemplateRestrictions_031()); | |
3063 | } | |
3064 | } | |
3065 | <END_MODULE> | |
3066 | ||
3067 | <RESULT COUNT 1> | |
3068 | error: Restriction on template does not allow usage of omit value | |
3069 | <END_RESULT> | |
3070 | ||
3071 | <END_TC> | |
3072 | :exmp | |
3073 | ||
3074 | *---------------------------------------------------------------------* | |
3075 | :h3. NegSem_1508_TemplateRestrictions_032 negative test | |
3076 | .*---------------------------------------------------------------------* | |
3077 | :xmp tab=0. | |
3078 | ||
3079 | <TC - Ensure that template(present) can't be assigned to a template(value) variable if contains anyvalueornone(*) > | |
3080 | ||
3081 | <COMPILE> | |
3082 | ||
3083 | <MODULE TTCN NegSem_1508_TemplateRestrictions_032 NegSem_1508_TemplateRestrictions_032.ttcn > | |
3084 | /***************************************************************** | |
3085 | ** @version 0.0.1 | |
3086 | ** @purpose 1:15.8, Ensure that template(present) can't be assigned to a template(value) variable if contains anyvalueornone(*) | |
3087 | ** @verdict pass reject | |
3088 | *****************************************************************/ | |
3089 | ||
3090 | ||
3091 | module NegSem_1508_TemplateRestrictions_032 { | |
3092 | ||
3093 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
3094 | charstring a optional, | |
3095 | boolean b | |
3096 | } | |
3097 | ||
3098 | type component GeneralComp { | |
3099 | var template (value) ExampleType v_value; //value restricted template variable | |
3100 | } | |
3101 | ||
3102 | template (present) ExampleType MyintTemplate :={ | |
3103 | //actual template (with present restriction) contains * | |
3104 | a := *, | |
3105 | b:= true | |
3106 | } | |
3107 | ||
3108 | testcase TC_NegSem_1508_TemplateRestrictions_032() runs on GeneralComp { | |
3109 | ||
3110 | v_value := MyintTemplate; //error: v_value is value restricted, hence can not contain * | |
3111 | ||
3112 | if (valueof(v_value.b) == false) { | |
3113 | setverdict(pass); | |
3114 | } else { | |
3115 | setverdict(fail); | |
3116 | } | |
3117 | } | |
3118 | ||
3119 | control{ | |
3120 | execute(TC_NegSem_1508_TemplateRestrictions_032()); | |
3121 | } | |
3122 | } | |
3123 | <END_MODULE> | |
3124 | ||
3125 | <RESULT COUNT 1> | |
3126 | error: Restriction on template does not allow usage of any or omit | |
3127 | <END_RESULT> | |
3128 | ||
3129 | <END_TC> | |
3130 | :exmp | |
3131 | ||
3132 | *---------------------------------------------------------------------* | |
3133 | :h3. NegSem_1508_TemplateRestrictions_033 negative test | |
3134 | .*---------------------------------------------------------------------* | |
3135 | :xmp tab=0. | |
3136 | ||
3137 | <TC - Ensure that an unrestricted template can't be assigned to a template(value) variable if contains anyvalueornone(*) > | |
3138 | ||
3139 | <COMPILE> | |
3140 | ||
3141 | <MODULE TTCN NegSem_1508_TemplateRestrictions_033 NegSem_1508_TemplateRestrictions_033.ttcn > | |
3142 | /***************************************************************** | |
3143 | ** @version 0.0.1 | |
3144 | ** @purpose 1:15.8, Ensure that an unrestricted template can't be assigned to a template(value) variable if contains anyvalueornone(*) | |
3145 | ** @verdict pass reject | |
3146 | *****************************************************************/ | |
3147 | ||
3148 | ||
3149 | module NegSem_1508_TemplateRestrictions_033 { | |
3150 | ||
3151 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
3152 | charstring a optional, | |
3153 | boolean b | |
3154 | } | |
3155 | ||
3156 | type component GeneralComp { | |
3157 | var template (value) ExampleType v_value; //value restricted template variable | |
3158 | } | |
3159 | ||
3160 | ||
3161 | template ExampleType MyintTemplate :={ //actual template (without restriction) contains * | |
3162 | a := *, | |
3163 | b:= true | |
3164 | } | |
3165 | ||
3166 | testcase TC_NegSem_1508_TemplateRestrictions_033() runs on GeneralComp { | |
3167 | ||
3168 | v_value := MyintTemplate; //error: v_value is value restricted, hence can not contain * | |
3169 | ||
3170 | if (valueof(v_value.b) == false) { | |
3171 | setverdict(pass); | |
3172 | } else { | |
3173 | setverdict(fail); | |
3174 | } | |
3175 | } | |
3176 | ||
3177 | control{ | |
3178 | execute(TC_NegSem_1508_TemplateRestrictions_033()); | |
3179 | } | |
3180 | } | |
3181 | <END_MODULE> | |
3182 | ||
3183 | <RESULT COUNT 1> | |
3184 | error: Restriction on template does not allow usage of any or omit | |
3185 | <END_RESULT> | |
3186 | ||
3187 | <END_TC> | |
3188 | :exmp | |
3189 | ||
3190 | *---------------------------------------------------------------------* | |
3191 | :h3. NegSem_1508_TemplateRestrictions_034 negative test | |
3192 | .*---------------------------------------------------------------------* | |
3193 | :xmp tab=0. | |
3194 | ||
3195 | <TC - Ensure that a template with omit restriction can't be assigned to a template(present)variable if omit > | |
3196 | ||
3197 | <COMPILE> | |
3198 | ||
3199 | <MODULE TTCN NegSem_1508_TemplateRestrictions_034 NegSem_1508_TemplateRestrictions_034.ttcn > | |
3200 | /***************************************************************** | |
3201 | ** @version 0.0.1 | |
3202 | ** @purpose 1:15.8, Ensure that a template with omit restriction can't be assigned to a template(present)variable if omit | |
3203 | ** @verdict pass reject | |
3204 | *****************************************************************/ | |
3205 | ||
3206 | ||
3207 | module NegSem_1508_TemplateRestrictions_034 { | |
3208 | ||
3209 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
3210 | charstring a , | |
3211 | boolean b optional | |
3212 | } | |
3213 | ||
3214 | type component GeneralComp { | |
3215 | var template (present) ExampleType v_present; //value restricted template variable | |
3216 | } | |
3217 | ||
3218 | template (omit) ExampleType MyintTemplate := omit; //actual template (omit) is omit | |
3219 | ||
3220 | testcase TC_NegSem_1508_TemplateRestrictions_034() runs on GeneralComp { | |
3221 | ||
3222 | v_present := MyintTemplate; //error: v_present is present restricted, hence can not be omit | |
3223 | ||
3224 | if (valueof(v_present.b) == false) { | |
3225 | setverdict(pass); | |
3226 | } else { | |
3227 | setverdict(fail); | |
3228 | } | |
3229 | } | |
3230 | ||
3231 | control{ | |
3232 | execute(TC_NegSem_1508_TemplateRestrictions_034()); | |
3233 | } | |
3234 | } | |
3235 | <END_MODULE> | |
3236 | ||
3237 | <RESULT COUNT 1> | |
3238 | error: Restriction on template does not allow usage of omit value | |
3239 | <END_RESULT> | |
3240 | ||
3241 | <END_TC> | |
3242 | :exmp | |
3243 | ||
3244 | *---------------------------------------------------------------------* | |
3245 | :h3. NegSem_1508_TemplateRestrictions_035 negative test | |
3246 | .*---------------------------------------------------------------------* | |
3247 | :xmp tab=0. | |
3248 | ||
3249 | <TC - Ensure that an unrestricted template can't be assigned to a template(present)variable if omit > | |
3250 | ||
3251 | <COMPILE> | |
3252 | ||
3253 | <MODULE TTCN NegSem_1508_TemplateRestrictions_035 NegSem_1508_TemplateRestrictions_035.ttcn > | |
3254 | /***************************************************************** | |
3255 | ** @version 0.0.1 | |
3256 | ** @purpose 1:15.8, Ensure that an unrestricted template can't be assigned to a template(present)variable if omit | |
3257 | ** @verdict pass reject | |
3258 | *****************************************************************/ | |
3259 | ||
3260 | ||
3261 | module NegSem_1508_TemplateRestrictions_035 { | |
3262 | ||
3263 | type record ExampleType { // Exampletype record contains a charstring and a boolean | |
3264 | charstring a , | |
3265 | boolean b optional | |
3266 | } | |
3267 | ||
3268 | type component GeneralComp { | |
3269 | var template (present) ExampleType v_present; //value restricted template variable | |
3270 | } | |
3271 | ||
3272 | template ExampleType MyintTemplate := omit; //actual template is omit | |
3273 | ||
3274 | testcase TC_NegSem_1508_TemplateRestrictions_035() runs on GeneralComp { | |
3275 | ||
3276 | v_present := MyintTemplate; //error: v_present is present restricted, hence can not be omit | |
3277 | ||
3278 | if (valueof(v_present.b) == false) { | |
3279 | setverdict(pass); | |
3280 | } else { | |
3281 | setverdict(fail); | |
3282 | } | |
3283 | } | |
3284 | ||
3285 | control{ | |
3286 | execute(TC_NegSem_1508_TemplateRestrictions_035()); | |
3287 | } | |
3288 | } | |
3289 | <END_MODULE> | |
3290 | ||
3291 | <RESULT COUNT 1> | |
3292 | error: Restriction on template does not allow usage of omit value | |
3293 | <END_RESULT> | |
3294 | ||
3295 | <END_TC> | |
3296 | :exmp | |
3297 | ||
15185010 AK |
3298 | *---------------------------------------------------------------------* |
3299 | :h3. NegSem_1508_TemplateRestrictions_050 negative test | |
3300 | .*---------------------------------------------------------------------* | |
3301 | :xmp tab=0. | |
3302 | ||
3303 | <TC - Ensure that decoded content match is not allowed for omit template restriction > | |
3304 | ||
3305 | <COMPILE> | |
3306 | ||
3307 | <MODULE TTCN NegSem_1508_TemplateRestrictions_050 NegSem_1508_TemplateRestrictions_050.ttcn > | |
3308 | /****************************************************************************** | |
3309 | ** @version 0.0.1 | |
3310 | ** @purpose 1:15.8, Ensure that decoded content match is not allowed for omit template restriction | |
3311 | ** @verdict pass reject, noexecution | |
3312 | ***************************************************/ | |
3313 | ||
3314 | module NegSem_1508_TemplateRestrictions_050 { | |
3315 | ||
3316 | type record MessageType { | |
3317 | hexstring payload | |
3318 | } | |
3319 | ||
3320 | type record Mymessage { | |
3321 | integer field1, | |
3322 | bitstring field2 optional | |
3323 | } with { variant " "}; | |
3324 | ||
3325 | ||
3326 | type port loopbackPort message | |
3327 | {inout MessageType} with {extension "internal"}; | |
3328 | ||
3329 | ||
3330 | type component GeneralComp { | |
3331 | port loopbackPort messagePort | |
3332 | } | |
3333 | ||
3334 | testcase TC_NegSem_1508_TemplateRestrictions_050() runs on GeneralComp { | |
3335 | var bitstring v_enc; | |
3336 | var Mymessage v_testMessage; | |
3337 | var MessageType Message; | |
3338 | ||
3339 | v_testMessage:= { | |
3340 | field1 := 10, | |
3341 | field2 := '1001'B | |
3342 | } | |
3343 | ||
3344 | connect(self:messagePort,self:messagePort); | |
3345 | ||
3346 | Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload | |
3347 | ||
3348 | template (omit) MessageType mw_matchingTemplate:= | |
3349 | { | |
3350 | payload := decmatch Mymessage: {field1:= 10, field2 := omit} | |
3351 | //error: omit restriction not allowed | |
3352 | } | |
3353 | ||
3354 | messagePort.send(Message); //send message | |
3355 | ||
3356 | alt { | |
3357 | [] messagePort.receive(mw_matchingTemplate) { | |
3358 | setverdict(pass); | |
3359 | } | |
3360 | [] messagePort.receive { | |
3361 | setverdict(fail,mw_matchingTemplate); | |
3362 | } | |
3363 | } | |
3364 | ||
3365 | } | |
3366 | ||
3367 | control{ | |
3368 | execute(TC_NegSem_1508_TemplateRestrictions_050()); | |
3369 | } | |
3370 | ||
3371 | } with { encode "RAW"} | |
3372 | ||
3373 | <END_MODULE> | |
3374 | ||
3375 | <RESULT COUNT 1> | |
3376 | error: Restriction on template definition does not allow usage of decoded content match | |
3377 | <END_RESULT> | |
3378 | ||
3379 | <END_TC> | |
3380 | :exmp | |
3381 | ||
3382 | *---------------------------------------------------------------------* | |
3383 | :h3. NegSem_1508_TemplateRestrictions_051 negative test | |
3384 | .*---------------------------------------------------------------------* | |
3385 | :xmp tab=0. | |
3386 | ||
3387 | <TC - Ensure that decoded content match is not allowed for omit template restriction > | |
3388 | ||
3389 | <COMPILE> | |
3390 | ||
3391 | <MODULE TTCN NegSem_1508_TemplateRestrictions_051 NegSem_1508_TemplateRestrictions_051.ttcn > | |
3392 | /****************************************************************************** | |
3393 | ** @version 0.0.1 | |
3394 | ** @purpose 1:15.8, Ensure that decoded content match is not allowed for omit template restriction | |
3395 | ** @verdict pass reject, noexecution | |
3396 | ***************************************************/ | |
3397 | ||
3398 | module NegSem_1508_TemplateRestrictions_051 { | |
3399 | ||
3400 | type record MessageType { | |
3401 | hexstring payload | |
3402 | } | |
3403 | ||
3404 | type record Mymessage { | |
3405 | integer field1, | |
3406 | bitstring field2 optional | |
3407 | } with { variant " "}; | |
3408 | ||
3409 | type port loopbackPort message | |
3410 | {inout MessageType} with {extension "internal"}; | |
3411 | ||
3412 | type component GeneralComp { | |
3413 | port loopbackPort messagePort | |
3414 | } | |
3415 | ||
3416 | testcase TC_NegSem_1508_TemplateRestrictions_051() runs on GeneralComp { | |
3417 | var bitstring v_enc; | |
3418 | var Mymessage v_testMessage; | |
3419 | var MessageType Message; | |
3420 | ||
3421 | v_testMessage:= { | |
3422 | field1 := 10, | |
3423 | field2 := '1001'B | |
3424 | } | |
3425 | ||
3426 | Message.payload := bit2hex(encvalue(v_testMessage)); //encode message to payload | |
3427 | ||
3428 | template (value) MessageType mw_matchingTemplate:= | |
3429 | { | |
3430 | payload := decmatch Mymessage: {field1:= 10, field2 := '1001'B} | |
3431 | //error: value restriction not allowed | |
3432 | } | |
3433 | ||
3434 | messagePort.send(Message); //send message | |
3435 | ||
3436 | alt { | |
3437 | [] messagePort.receive(mw_matchingTemplate) { | |
3438 | setverdict(pass); | |
3439 | } | |
3440 | [] messagePort.receive { | |
3441 | setverdict(fail,mw_matchingTemplate); | |
3442 | } | |
3443 | } | |
3444 | ||
3445 | } | |
3446 | ||
3447 | control{ | |
3448 | execute(TC_NegSem_1508_TemplateRestrictions_051()); | |
3449 | } | |
3450 | ||
3451 | } with { encode "RAW"} | |
3452 | ||
3453 | <END_MODULE> | |
3454 | ||
3455 | <RESULT COUNT 1> | |
3456 | error: Restriction on template definition does not allow usage of decoded content match | |
3457 | <END_RESULT> | |
3458 | ||
3459 | <END_TC> | |
3460 | :exmp | |
3461 | ||
8930eefa | 3462 | .*---------------------------------------------------------------------* |
3463 | :h2. 1509_match_operation folder | |
3464 | .*---------------------------------------------------------------------* | |
3465 | ||
3466 | *---------------------------------------------------------------------* | |
3467 | :h3. NegSem_1509_MatchOperation_001 negative test | |
3468 | .*---------------------------------------------------------------------* | |
3469 | :xmp tab=0. | |
3470 | ||
3471 | <TC - Ensure that the match operation refuses two templates as actual parameters. > | |
3472 | ||
3473 | <COMPILE> | |
3474 | ||
3475 | <MODULE TTCN NegSem_1509_MatchOperation_001 NegSem_1509_MatchOperation_001.ttcn > | |
3476 | /***************************************************************** | |
3477 | ** @version 0.0.1 | |
3478 | ** @purpose 1:15.9, Ensure that the match operation refuses two templates as actual parameters. | |
3479 | ** @verdict pass reject | |
3480 | *****************************************************************/ | |
3481 | ||
3482 | module NegSem_1509_MatchOperation_001 { | |
3483 | ||
3484 | type component GeneralComp { } | |
3485 | ||
3486 | template integer m_lessThan10 := (-infinity..9); | |
3487 | template integer m_second := (-20,-40); | |
3488 | ||
3489 | testcase TC_NegSem_1509_MatchOperation_001() runs on GeneralComp { | |
3490 | if (match(m_second, m_lessThan10)) { // shall fail as both actual parameters refer to templates | |
3491 | setverdict(fail); | |
3492 | } else { | |
3493 | setverdict(pass); | |
3494 | } | |
3495 | } | |
3496 | ||
3497 | control{ | |
3498 | execute(TC_NegSem_1509_MatchOperation_001()); | |
3499 | } | |
3500 | ||
3501 | } | |
3502 | <END_MODULE> | |
3503 | ||
3504 | <RESULT COUNT 1> | |
3505 | error: Reference to a value was expected instead of template `@NegSem_1509_MatchOperation_001.m_second' | |
3506 | <END_RESULT> | |
3507 | ||
3508 | <END_TC> | |
3509 | :exmp | |
3510 | ||
3511 | .*---------------------------------------------------------------------* | |
3512 | :h2. 1510_valueof_operation folder | |
3513 | .*---------------------------------------------------------------------* | |
3514 | ||
3515 | *---------------------------------------------------------------------* | |
3516 | :h3. NegSem_1510_ValueOfOperation_001 negative test | |
3517 | .*---------------------------------------------------------------------* | |
3518 | :xmp tab=0. | |
3519 | ||
3520 | <TC - Ensure that the valueof function works correctly on omit. > | |
3521 | ||
3522 | <COMPILE> | |
3523 | <EXECUTE_PARALLEL> | |
3524 | ||
3525 | <MODULE TTCN NegSem_1510_ValueOfOperation_001 NegSem_1510_ValueOfOperation_001.ttcn > | |
3526 | /***************************************************************** | |
3527 | ** @version 0.0.1 | |
3528 | ** @purpose 1:15.10, Ensure that the valueof function works correctly on omit. | |
3529 | ** @verdict pass reject | |
3530 | *****************************************************************/ | |
3531 | ||
3532 | module NegSem_1510_ValueOfOperation_001 { | |
3533 | ||
3534 | type component GeneralComp { } | |
3535 | ||
3536 | testcase TC_NegSem_1510_ValueOfOperation_001() runs on GeneralComp { | |
3537 | var template integer m_int := omit; | |
3538 | var integer v_int := valueof(m_int); | |
3539 | ||
3540 | // if we get here, something must be wrong as valueof on m_int shall cause an error | |
3541 | // due to the omit. | |
3542 | setverdict(fail); | |
3543 | } | |
3544 | ||
3545 | control{ | |
3546 | execute(TC_NegSem_1510_ValueOfOperation_001()); | |
3547 | } | |
3548 | ||
3549 | } | |
3550 | <END_MODULE> | |
3551 | ||
3552 | <RESULT COUNT 1> | |
3553 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. | |
3554 | <END_RESULT> | |
3555 | ||
3556 | <END_TC> | |
3557 | :exmp | |
3558 | ||
3559 | *---------------------------------------------------------------------* | |
3560 | :h3. NegSem_1510_ValueOfOperation_002 negative test | |
3561 | .*---------------------------------------------------------------------* | |
3562 | :xmp tab=0. | |
3563 | ||
3564 | <TC - Ensure that the valueof function works correctly on templates with wildcards. > | |
3565 | ||
3566 | <COMPILE> | |
3567 | ||
3568 | <MODULE TTCN NegSem_1510_ValueOfOperation_002 NegSem_1510_ValueOfOperation_002.ttcn > | |
3569 | /***************************************************************** | |
3570 | ** @version 0.0.1 | |
3571 | ** @purpose 1:15.10, Ensure that the valueof function works correctly on templates with wildcards. | |
3572 | ** @verdict pass reject | |
3573 | *****************************************************************/ | |
3574 | ||
3575 | module NegSem_1510_ValueOfOperation_002 { | |
3576 | ||
3577 | type component GeneralComp { } | |
3578 | ||
3579 | type record ExampleType { | |
3580 | integer field1, | |
3581 | boolean field2 | |
3582 | } | |
3583 | ||
3584 | template ExampleType m_template := { | |
3585 | field1 := *, | |
3586 | field2 := ? | |
3587 | } | |
3588 | ||
3589 | testcase TC_NegSem_1510_ValueOfOperation_002() runs on GeneralComp { | |
3590 | var ExampleType v_int := valueof(m_template); | |
3591 | ||
3592 | // if we get here, something must be wrong as valueof on m_template shall cause an error | |
3593 | // due to the * and ? wildcards. | |
3594 | setverdict(fail); | |
3595 | } | |
3596 | ||
3597 | control{ | |
3598 | execute(TC_NegSem_1510_ValueOfOperation_002()); | |
3599 | } | |
3600 | ||
3601 | } | |
3602 | <END_MODULE> | |
3603 | ||
3604 | <RESULT COUNT 1> | |
3605 | error: A specific value was expected instead of any value | |
3606 | <END_RESULT> | |
3607 | <RESULT COUNT 1> | |
3608 | error: A specific value was expected instead of any or omit | |
3609 | <END_RESULT> | |
3610 | ||
3611 | ||
3612 | <END_TC> | |
3613 | :exmp | |
3614 | ||
3615 | *---------------------------------------------------------------------* | |
3616 | :h3. NegSem_1510_ValueOfOperation_003 negative test | |
3617 | .*---------------------------------------------------------------------* | |
3618 | :xmp tab=0. | |
3619 | ||
3620 | <TC - Ensure that the valueof function works correctly on regular value templates. > | |
3621 | ||
3622 | <COMPILE> | |
3623 | <EXECUTE_PARALLEL> | |
3624 | ||
3625 | <MODULE TTCN NegSem_1510_ValueOfOperation_003 NegSem_1510_ValueOfOperation_003.ttcn > | |
3626 | /***************************************************************** | |
3627 | ** @version 0.0.1 | |
3628 | ** @purpose 1:15.10, Ensure that the valueof function works correctly on regular value templates. | |
3629 | ** @verdict pass reject | |
3630 | *****************************************************************/ | |
3631 | ||
3632 | module NegSem_1510_ValueOfOperation_003 { | |
3633 | ||
3634 | type component GeneralComp { } | |
3635 | ||
3636 | type record ExampleType { | |
3637 | integer field1, | |
3638 | boolean field2 | |
3639 | } | |
3640 | ||
3641 | testcase TC_NegSem_1510_ValueOfOperation_003() runs on GeneralComp { | |
3642 | var template ExampleType f_first := { | |
3643 | field1 := (1, 2), | |
3644 | field2 := true | |
3645 | }; | |
3646 | ||
3647 | var ExampleType v_second := valueof(f_first); | |
3648 | ||
3649 | // if we get here, something must be wrong as valueof on m_template shall cause an error | |
3650 | setverdict(fail); | |
3651 | } | |
3652 | ||
3653 | control{ | |
3654 | execute(TC_NegSem_1510_ValueOfOperation_003()); | |
3655 | } | |
3656 | ||
3657 | } | |
3658 | <END_MODULE> | |
3659 | ||
3660 | <RESULT COUNT 1> | |
3661 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template | |
3662 | <END_RESULT> | |
3663 | ||
3664 | <END_TC> | |
3665 | :exmp | |
3666 | ||
3667 | *---------------------------------------------------------------------* | |
3668 | :h3. NegSem_1510_ValueOfOperation_004 negative test | |
3669 | .*---------------------------------------------------------------------* | |
3670 | :xmp tab=0. | |
3671 | ||
3672 | <TC - Ensure that the valueof function works correctly on range templates. > | |
3673 | ||
3674 | <COMPILE> | |
3675 | <EXECUTE_PARALLEL> | |
3676 | ||
3677 | <MODULE TTCN NegSem_1510_ValueOfOperation_004 NegSem_1510_ValueOfOperation_004.ttcn > | |
3678 | /***************************************************************** | |
3679 | ** @version 0.0.1 | |
3680 | ** @purpose 1:15.10, Ensure that the valueof function works correctly on range templates. | |
3681 | ** @verdict pass reject | |
3682 | *****************************************************************/ | |
3683 | ||
3684 | module NegSem_1510_ValueOfOperation_004 { | |
3685 | ||
3686 | type component GeneralComp { } | |
3687 | ||
3688 | testcase TC_NegSem_1510_ValueOfOperation_004() runs on GeneralComp { | |
3689 | var template integer v_test := (1..5); | |
3690 | ||
3691 | var integer v_second := valueof(v_test); | |
3692 | ||
3693 | // if we get here, something must be wrong as valueof on v_test shall cause an error | |
3694 | // as it is not a template. | |
3695 | setverdict(fail); | |
3696 | } | |
3697 | ||
3698 | control{ | |
3699 | execute(TC_NegSem_1510_ValueOfOperation_004()); | |
3700 | } | |
3701 | ||
3702 | } | |
3703 | <END_MODULE> | |
3704 | ||
3705 | <RESULT COUNT 1> | |
3706 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template | |
3707 | <END_RESULT> | |
3708 | ||
3709 | <END_TC> | |
3710 | :exmp | |
3711 | ||
3712 | *---------------------------------------------------------------------* | |
3713 | :h3. NegSem_1510_ValueOfOperation_005 negative test | |
3714 | .*---------------------------------------------------------------------* | |
3715 | :xmp tab=0. | |
3716 | ||
3717 | <TC - Ensure that the valueof function works correctly on range templates. > | |
3718 | ||
3719 | <COMPILE> | |
3720 | <EXECUTE_PARALLEL> | |
3721 | ||
3722 | <MODULE TTCN NegSem_1510_ValueOfOperation_005 NegSem_1510_ValueOfOperation_005.ttcn > | |
3723 | /***************************************************************** | |
3724 | ** @version 0.0.1 | |
3725 | ** @purpose 1:15.10, Ensure that the valueof function works correctly on range templates. | |
3726 | ** @verdict pass reject | |
3727 | *****************************************************************/ | |
3728 | ||
3729 | module NegSem_1510_ValueOfOperation_004 { | |
3730 | ||
3731 | type component GeneralComp { } | |
3732 | ||
3733 | testcase TC_NegSem_1510_ValueOfOperation_004() runs on GeneralComp { | |
3734 | var template integer v_test := (1..5); | |
3735 | ||
3736 | var integer v_second := valueof(v_test); | |
3737 | ||
3738 | // if we get here, something must be wrong as valueof on v_test shall cause an error | |
3739 | // as it is not a template. | |
3740 | setverdict(fail); | |
3741 | } | |
3742 | ||
3743 | control{ | |
3744 | execute(TC_NegSem_1510_ValueOfOperation_004()); | |
3745 | } | |
3746 | ||
3747 | } | |
3748 | <END_MODULE> | |
3749 | ||
3750 | <RESULT COUNT 1> | |
3751 | Dynamic test case error: Performing a valueof or send operation on a non-specific integer template | |
3752 | <END_RESULT> | |
3753 | ||
3754 | <END_TC> | |
3755 | :exmp | |
3756 | ||
3757 | .*---------------------------------------------------------------------* | |
3758 | :h2. 1511_concatenating_templates_of_string_and_list_types folder | |
3759 | .*---------------------------------------------------------------------* | |
3760 | ||
3761 | *---------------------------------------------------------------------* | |
3762 | :h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 negative test | |
3763 | .*---------------------------------------------------------------------* | |
3764 | :xmp tab=0. | |
3765 | ||
3766 | <TC - Ensure that concatenation of octetstring types yields an even number of digits. > | |
3767 | ||
3768 | <COMPILE> | |
3769 | ||
3770 | <MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001.ttcn > | |
3771 | /***************************************************************** | |
3772 | ** @version 0.0.1 | |
3773 | ** @purpose 1:15.11, Ensure that concatenation of octetstring types yields an even number of digits. | |
3774 | ** @verdict pass reject | |
3775 | *****************************************************************/ | |
3776 | //Note: see CR5805 regarding corresponding BNF update | |
3777 | ||
3778 | module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 { | |
3779 | ||
3780 | type component GeneralComp { } | |
3781 | ||
3782 | testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001() runs on GeneralComp { | |
3783 | var template octetstring v_str := 'ABCD'O & '?'O & '?E'O; | |
3784 | ||
3785 | // shall cause an error as it would denote 9 (i.e., uneven) number of digits | |
3786 | setverdict(fail); | |
3787 | } | |
3788 | ||
3789 | control{ | |
3790 | execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001()); | |
3791 | } | |
3792 | ||
3793 | } | |
3794 | <END_MODULE> | |
3795 | ||
3796 | <RESULT COUNT 1> | |
3797 | error: Octetstring match contains half octet\(s\) | |
3798 | <END_RESULT> | |
3799 | <RESULT COUNT 1> | |
3800 | error: at or before token `'O': syntax error, unexpected OctetStringMatch | |
3801 | <END_RESULT> | |
3802 | ||
3803 | <END_TC> | |
3804 | :exmp | |
3805 | ||
3806 | *---------------------------------------------------------------------* | |
3807 | :h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 negative test | |
3808 | .*---------------------------------------------------------------------* | |
3809 | :xmp tab=0. | |
3810 | ||
3811 | <TC - Ensure that a simple concatenation of non-wildcard octetstring must not yield in a non-even number of hexadecimals. > | |
3812 | ||
3813 | <COMPILE> | |
3814 | ||
3815 | <MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003.ttcn > | |
3816 | /***************************************************************** | |
3817 | ** @version 0.0.1 | |
3818 | ** @purpose 1:15.11, Ensure that a simple concatenation of non-wildcard octetstring must not yield in a non-even number of hexadecimals. | |
3819 | ** @verdict pass reject | |
3820 | *****************************************************************/ | |
3821 | //Note: see CR5805 regarding corresponding BNF update | |
3822 | ||
3823 | module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 { | |
3824 | ||
3825 | type component GeneralComp { } | |
3826 | ||
3827 | testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003() runs on GeneralComp { | |
3828 | var template octetstring v_str := 'AB'O & '0F'O & '2A'O & 'F'O; | |
3829 | ||
3830 | // shall cause an error as the length of the concantenated octetstring is is uneven | |
3831 | setverdict(fail); | |
3832 | } | |
3833 | ||
3834 | control{ | |
3835 | execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003()); | |
3836 | } | |
3837 | ||
3838 | } | |
3839 | <END_MODULE> | |
3840 | ||
3841 | <RESULT COUNT 1> | |
3842 | error: Octetstring value contains odd number of hexadecimal digits | |
3843 | <END_RESULT> | |
3844 | ||
3845 | <END_TC> | |
3846 | :exmp | |
3847 | ||
3848 | *---------------------------------------------------------------------* | |
3849 | :h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 negative test | |
3850 | .*---------------------------------------------------------------------* | |
3851 | :xmp tab=0. | |
3852 | ||
3853 | <TC - Ensure that the inline template definitions are correctly concatenated. > | |
3854 | ||
3855 | <COMPILE> | |
3856 | ||
3857 | <MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004.ttcn > | |
3858 | /***************************************************************** | |
3859 | ** @version 0.0.1 | |
3860 | ** @purpose 1:15.11, Ensure that the inline template definitions are correctly concatenated. | |
3861 | ** @verdict pass reject | |
3862 | *****************************************************************/ | |
3863 | ||
3864 | module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 { | |
3865 | ||
3866 | type component GeneralComp { } | |
3867 | ||
3868 | type record MyRecord { | |
3869 | charstring field1, | |
3870 | charstring field2 | |
3871 | } | |
3872 | ||
3873 | template MyRecord m_receiveTemplate := { | |
3874 | field1 := pattern "AB*DE", | |
3875 | field2 := "ABCC" & * & "EF" //only specific values allowed when there is no pattern keyword | |
3876 | } | |
3877 | ||
3878 | testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004() runs on GeneralComp { | |
3879 | var MyRecord v_value := { | |
3880 | field1 := "AB*DE", | |
3881 | field2 := "ABCCDE*EF" | |
3882 | } | |
3883 | ||
3884 | if (match(v_value, m_receiveTemplate)) { | |
3885 | setverdict(pass); | |
3886 | } else { | |
3887 | setverdict(fail); | |
3888 | } | |
3889 | } | |
3890 | ||
3891 | control{ | |
3892 | execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004()); | |
3893 | } | |
3894 | ||
3895 | } | |
3896 | <END_MODULE> | |
3897 | ||
3898 | <RESULT COUNT 1> | |
3899 | error: at or before token `\*': syntax error, unexpected '\*' | |
3900 | <END_RESULT> | |
3901 | ||
3902 | <END_TC> | |
3903 | :exmp | |
3904 | ||
3905 | *---------------------------------------------------------------------* | |
3906 | :h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 negative test | |
3907 | .*---------------------------------------------------------------------* | |
3908 | :xmp tab=0. | |
3909 | ||
3910 | <TC - Ensure that the inline template definitions are correctly concatenated. > | |
3911 | ||
3912 | <COMPILE> | |
3913 | ||
3914 | <MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005.ttcn > | |
3915 | /***************************************************************** | |
3916 | ** @version 0.0.1 | |
3917 | ** @purpose 1:15.11, Ensure that the inline template definitions are correctly concatenated. | |
3918 | ** @verdict pass reject | |
3919 | *****************************************************************/ | |
3920 | ||
3921 | module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 { | |
3922 | ||
3923 | type component GeneralComp { } | |
3924 | ||
3925 | type record MyRecord { | |
3926 | charstring field1, | |
3927 | charstring field2 | |
3928 | } | |
3929 | ||
3930 | template MyRecord m_receiveTemplate := { | |
3931 | field1 := pattern "AB*DE", | |
3932 | field2 := pattern "ABCC" & * length(2) & "EF" | |
3933 | //cannot use length(n) attribute on charstring pattern | |
3934 | } | |
3935 | ||
3936 | testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005() runs on GeneralComp { | |
3937 | var MyRecord v_value := { | |
3938 | field1 := "AB*DE", | |
3939 | field2 := "ABCCDE*EF" | |
3940 | } | |
3941 | ||
3942 | if (match(v_value, m_receiveTemplate)) { | |
3943 | setverdict(pass); | |
3944 | } else { | |
3945 | setverdict(fail); | |
3946 | } | |
3947 | } | |
3948 | ||
3949 | control{ | |
3950 | execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005()); | |
3951 | } | |
3952 | ||
3953 | } | |
3954 | <END_MODULE> | |
3955 | ||
3956 | <RESULT COUNT 1> | |
3957 | error: at or before token `\*': syntax error, unexpected '\*', expecting Identifier or Cstring or CharKeyword | |
3958 | <END_RESULT> | |
3959 | ||
3960 | <END_TC> | |
3961 | :exmp | |
3962 | ||
3963 | *---------------------------------------------------------------------* | |
3964 | :h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 negative test | |
3965 | .*---------------------------------------------------------------------* | |
3966 | :xmp tab=0. | |
3967 | ||
3968 | <TC - Ensure that concatenation of octetstring types and ? patterns works as expected. > | |
3969 | ||
3970 | <COMPILE> | |
3971 | ||
3972 | <MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006.ttcn > | |
3973 | /***************************************************************** | |
3974 | ** @version 0.0.1 | |
3975 | ** @purpose 1:15.11, Ensure that concatenation of octetstring types and ? patterns works as expected. | |
3976 | ** @verdict pass reject | |
3977 | *****************************************************************/ | |
3978 | ||
3979 | module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 { | |
3980 | ||
3981 | type component GeneralComp { } | |
3982 | ||
3983 | testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006() runs on GeneralComp { | |
3984 | var template octetstring v_myString1 := 'ABCD'O & ? length(2) length (6); //missing parenthesis | |
3985 | if (match('ABCD12'O, v_myString1)) { | |
3986 | setverdict(pass); | |
3987 | } else { | |
3988 | setverdict(fail); | |
3989 | } | |
3990 | } | |
3991 | ||
3992 | control{ | |
3993 | execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006()); | |
3994 | } | |
3995 | ||
3996 | } | |
3997 | <END_MODULE> | |
3998 | ||
3999 | <RESULT COUNT 1> | |
4000 | error: at or before token `\?': syntax error, unexpected '\?' | |
4001 | <END_RESULT> | |
4002 | <RESULT COUNT 1> | |
4003 | error: at or before token `else': syntax error, unexpected ElseKeyword | |
4004 | <END_RESULT> | |
4005 | ||
4006 | <END_TC> | |
4007 | :exmp | |
4008 | ||
4009 | .*---------------------------------------------------------------------* | |
4010 | :h1.References | |
4011 | .*---------------------------------------------------------------------* | |
4012 | :list. | |
4013 | :li D='[1]'.1/174 02-CRL 113 200/5 Uen | |
4014 | :nl.Statement of Compliance for TITAN project | |
4015 | :li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): | |
4016 | :nl.Testing and Test Control Notation version 3., | |
4017 | :nl.Part 1: TTCN-3 Core Language | |
4018 | :elist. |