conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 22_communication_operations / 2202_message_based_communication / 220202_receive_operation / Sem_220202_ReceiveOperation_026.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.2, lazy variable in index redirect
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15
16 // The following requirements are tested:
17 // If a variable referenced in the value, sender or @index clause is a lazy or fuzzy
18 // variable, the expression assigned to this variable is equal to the result produced
19 // by the receive operation i.e. later evaluation of the lazy or fuzzy variable does not
20 // lead to repeated invocation of the receive operation.
21
22 module Sem_220202_ReceiveOperation_026 {
23 type port P message {
24 inout integer;
25 } with {extension "internal"}
26
27 type component GeneralComp {
28 port P p[2];
29 }
30
31 testcase TC_Sem_220202_ReceiveOperation_026() runs on GeneralComp {
32 var @lazy integer v_int;
33
34 connect(self:p[1], self:p[1]);
35
36 p[1].send(1);
37 p[1].send(2);
38 p[1].send(3);
39
40 any from p.receive(integer:?) -> @index v_int;
41
42 if (v_int == 1) { // evaluation of @lazy (receive shall not be called again)
43 alt {
44 [] p[1].receive(integer:2) { setverdict(pass); }
45 [] any from p.receive { setverdict(fail); }
46 }
47 } else {
48 setverdict(fail);
49 }
50 }
51
52 control {
53 execute(TC_Sem_220202_ReceiveOperation_026(), 5.0);
54 }
55 }
This page took 0.043852 seconds and 5 git commands to generate.