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
9 * Adrien Kirjak – initial implementation
12 ** @purpose 1:22.3.6, Verify that any from done assigns index
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // It is also possible to store the index of a port in a single-dimensional port array at which
17 // the operation was successful to a variable of type integer or, in case of multi-dimensional
18 // port arrays the index of the successful port to an integer array or record of integer variable.
19 // When checking the port array for matching exceptions, the port indices to be checked are iterated
20 // from lowest to highest.
21 module Sem_220306_catch_operation_005 {
23 signature S() exception(integer);
25 type port P procedure {
27 } with {extension "internal"}
29 const integer c_portCount := 4;
30 type component GeneralComp
32 port P p[c_portCount];
35 function f() runs on GeneralComp
37 for(var integer i := 0; i < c_portCount; i := i + 1) {
39 if (i mod 2 == 1) { p[i].raise(S, i + 1); };
43 testcase TC_Sem_220306_catch_operation_005() runs on GeneralComp system GeneralComp {
44 var GeneralComp v_ptc := GeneralComp.create;
45 var integer v_index, v_res;
47 for(var integer i := 0; i < c_portCount; i := i + 1) {
48 connect(self:p[i], v_ptc:p[i]);
49 p[i].call(S:{}, nowait);
57 [] any from p.catch(S, integer:(0..c_portCount)) -> value v_res @index v_index {
58 if(v_index == 1 and v_res == v_index + 1){
61 setverdict(fail, "Index or parameter value incorrectly assigned");
64 [else] { setverdict(fail, "The any from catch operation didn't match for some reason"); }
69 execute(TC_Sem_220306_catch_operation_005(), 5.0);