conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 22_communication_operations / 2203_procedure_based_communication / 220302_getcall_operation / Sem_220302_GetcallOperation_012.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.2, Verify any from getcall index redirection to lazy variable
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // Restriction k
17 // If a variable referenced in the @index clause is a lazy or fuzzy variable, the expression
18 // assigned to this variable is equal to the result produced by the getcall operation. Later
19 // evaluation of the lazy or fuzzy variable does not lead to repeated invocation of the
20 // getcall operation.
21 module Sem_220302_GetcallOperation_012 {
22
23 signature S(integer p_par);
24
25 type port P procedure {
26 inout S;
27 } with {extension "internal"}
28
29 const integer c_portCount := 4;
30 type component GeneralComp
31 {
32 port P p[c_portCount];
33 }
34 function f() runs on GeneralComp
35 {
36 var @lazy integer v_index;
37 alt
38 {
39 [] any from p.getcall -> @index v_index {
40 if(v_index == 1){ // no getcall call during evaluation, v_index remains equal to 1
41 setverdict(pass);
42 } else {
43 setverdict(fail, "Index incorrectly assigned");
44 }
45 }
46 [else] { setverdict(fail, "The any from getcall didn't match for some reason"); }
47 }
48 }
49 testcase TC_Sem_220302_GetcallOperation_012() runs on GeneralComp system GeneralComp {
50 var GeneralComp v_ptc := GeneralComp.create;
51
52 for(var integer i := 0; i < c_portCount; i := i + 1) {
53 connect(self:p[i], v_ptc:p[i]);
54 if (i mod 2 > 0) { p[i].call(S:{ p_par := i + 100 }, nowait); }
55 }
56
57 v_ptc.start(f());
58 v_ptc.done;
59 }
60
61 control {
62 execute(TC_Sem_220302_GetcallOperation_012(), 5.0);
63 }
64 }
This page took 0.042806 seconds and 5 git commands to generate.