conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 22_communication_operations / 2203_procedure_based_communication / 220306_catch_operation / Sem_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 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);
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, 1) };
38 }
39 }
40
41 testcase TC_Sem_220306_catch_operation_002() runs on GeneralComp system GeneralComp {
42 var GeneralComp v_ptc := GeneralComp.create;
43
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);
47 }
48
49 v_ptc.start(f());
50 v_ptc.done;
51
52 alt
53 {
54 [] any from p.catch { setverdict(pass); }
55 [else] { setverdict(fail, "The any from catch operation didn't match for some reason"); }
56 }
57 }
58
59 control {
60 execute(TC_Sem_220306_catch_operation_002(), 5.0);
61 }
62 }
This page took 0.0345 seconds and 5 git commands to generate.