conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 22_communication_operations / 2202_message_based_communication / 220203_trigger_operation / Sem_220203_TriggerOperation_006.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.2.3, trigger with a from clause (single item)
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15
16 // The following requirements are tested:
17 // The matching criteria as defined in clause 22.2.2 apply also to the trigger
18 // operation.
19 // In the case of one-to-many connections the [trigger] operation may be restricted
20 // to a certain communication partner. This restriction shall be denoted using the
21 // from keyword.
22
23 module Sem_220203_TriggerOperation_006 {
24
25 type port P message {
26 inout integer;
27 } with {extension "internal"}
28
29 type component GeneralComp
30 {
31 port P p;
32 }
33
34 function f(integer i) runs on GeneralComp
35 {
36 p.send(i);
37 }
38
39 const integer c_ptcCount := 3;
40
41 testcase TC_Sem_220203_TriggerOperation_006() runs on GeneralComp system GeneralComp {
42 var GeneralComp v_ptcs[c_ptcCount];
43 var integer v_int;
44
45 for (var integer i := 0; i < c_ptcCount; i := i + 1) {
46 v_ptcs[i] := GeneralComp.create;
47 connect(self:p, v_ptcs[i]:p);
48 v_ptcs[i].start(f(i));
49 }
50
51 alt {
52 [] p.trigger(integer:?) from v_ptcs[c_ptcCount - 1] -> value v_int {
53 if (v_int == c_ptcCount - 1) { setverdict(pass); }
54 else { setverdict(fail) };
55 }
56 }
57 }
58
59 control {
60 execute(TC_Sem_220203_TriggerOperation_006(), 5.0);
61 }
62 }
This page took 0.045321 seconds and 5 git commands to generate.