conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 21_configuration_operations / 2103_test_component_operations / 210307_done_operation / Sem_210307_done_operation_009.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:21.3.7, Verify any from done index redirection to lazy variable
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // Restriction g
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 done operation. Later
19 // evaluation of the lazy or fuzzy variable does not lead to repeated invocation of the
20 // done operation.
21 module Sem_210307_done_operation_009 {
22
23 type component GeneralComp {}
24
25 function f(float p_time) runs on GeneralComp {
26 timer t := p_time;
27 t.start;
28 t.timeout;
29 }
30
31 testcase TC_Sem_210307_done_operation_009() runs on GeneralComp system GeneralComp {
32 const integer c_size := 4;
33 var GeneralComp v_ptc[c_size];
34 var @lazy integer v_index;
35 timer t := 2.0;
36
37 for (var integer i := 0; i < c_size; i := i + 1) {
38 v_ptc[i] := GeneralComp.create; // created components are inactive
39 if (i == 2) { v_ptc[i].start(f(1.0)); }
40 else { v_ptc[i].start(f(100.0)); }
41 }
42
43 t.start;
44 t.timeout;
45
46 alt
47 {
48 [] any from v_ptc.done -> @index v_index {
49 v_ptc[0].kill; // component at position 0 is killed after the redirect assignment
50 if(v_index == 2){ // no done call during evaluation, v_index remains equal to 2
51 setverdict(pass);
52 } else {
53 setverdict(fail, "Index incorrectly assigned");
54 }
55 }
56 [else] { setverdict(fail, "The any from done operation didn't found stopped or killed component"); }
57 }
58 }
59
60 control {
61 execute(TC_Sem_210307_done_operation_009(), 5.0);
62 }
63 }
This page took 0.035228 seconds and 5 git commands to generate.