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 catch matches if at least one port contains enqueued reply
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // To catch an exception on any port from a specific port array, use the any from PortArrayRef syntax
17 // where PortArrayRef shall be a reference to a port array identifier.
18 // The first port which matches all the criteria will cause the operation to be successful even if
19 // other ports in the array would also meet the criteria.
20 module Sem_220306_catch_operation_002 {
21 signature S() exception(integer);
23 type port P procedure {
25 } with {extension "internal"}
27 const integer c_portCount := 4;
28 type component GeneralComp
30 port P p[c_portCount];
33 function f() runs on GeneralComp
35 for(var integer i := 0; i < c_portCount; i := i + 1) {
37 if (i mod 2 == 1) { p[i].raise(S, 1) };
41 testcase TC_Sem_220306_catch_operation_002() runs on GeneralComp system GeneralComp {
42 var GeneralComp v_ptc := GeneralComp.create;
44 for(var integer i := 0; i < c_portCount; i := i + 1) {
45 connect(self:p[i], v_ptc:p[i]);
46 p[i].call(S:{}, nowait);
54 [] any from p.catch { setverdict(pass); }
55 [else] { setverdict(fail, "The any from catch operation didn't match for some reason"); }
60 execute(TC_Sem_220306_catch_operation_002(), 5.0);