conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 22_communication_operations / 2203_procedure_based_communication / 220306_catch_operation / NegSem_220306_catch_operation_002.ttcn
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 ** @version 0.0.1
12 ** @purpose 1:22.3.6, Verify that error occurs when any from catch is applied to 1D array and index target is array
13 ** @verdict pass reject
14 *****************************************************************/
15 // The following requirements are tested:
16 // Restriction i
17 // If the index redirection is used for single-dimensional port arrays, the type
18 // of the integer variable shall allow storing the highest index of the respective array.
19 module NegSem_220306_catch_operation_002 {
20
21 signature S() exception(integer);
22
23 type port P procedure {
24 inout S;
25 } with {extension "internal"}
26
27 const integer c_portCount := 4;
28 type component GeneralComp
29 {
30 port P p[c_portCount];
31 }
32
33 function f() runs on GeneralComp
34 {
35 for(var integer i := 0; i < c_portCount; i := i + 1) {
36 p[i].getcall;
37 if (i mod 2 == 1) { p[i].raise(S, 10) };
38 }
39 }
40
41 testcase TC_NegSem_220306_catch_operation_002() runs on GeneralComp system GeneralComp {
42 var GeneralComp v_ptc := GeneralComp.create;
43
44 var integer v_index[1];
45 for(var integer i := 0; i < c_portCount; i := i + 1) {
46 connect(self:p[i], v_ptc:p[i]);
47 p[i].call(S:{}, nowait);
48 }
49
50 v_ptc.start(f());
51 v_ptc.done;
52
53 alt
54 {
55 [] any from p.catch(S, integer:?) -> @index v_index {
56 if(v_index[0] == 1){
57 setverdict(pass);
58 } else {
59 setverdict(fail, "Index or parameter value incorrectly assigned");
60 }
61 }
62 [else] { setverdict(fail, "The any from catch operation didn't match for some reason"); }
63 }
64 }
65
66 control {
67 execute(TC_NegSem_220306_catch_operation_002(), 5.0);
68 }
69 }
This page took 0.04716 seconds and 5 git commands to generate.