conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 21_configuration_operations / 2103_test_component_operations / 210305_alive_operation / Sem_210305_alive_operation_013.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.5, Verify any from alive index redirection to lazy variable
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // Restriction f
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 alive operation. Later
19 // evaluation of the lazy or fuzzy variable does not lead to repeated invocation of the alive
20 // operation.
21 module Sem_210305_alive_operation_013 {
22
23 type component GeneralComp {}
24
25 function f() runs on GeneralComp {
26 timer t := 100.0;
27 t.start;
28 t.timeout;
29 }
30
31 testcase TC_Sem_210305_alive_operation_013() runs on GeneralComp system GeneralComp {
32 var boolean v_isAlive;
33 const integer c_size := 4;
34 var GeneralComp v_ptc[c_size];
35 var @lazy integer v_index;
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 mod 2 == 0) { v_ptc[i].kill; } // kill components on even indices
40 else { v_ptc[i].start(f());} // activate v_ptc
41 }
42
43 v_isAlive := any from v_ptc.alive -> @index v_index;
44 v_ptc[1].kill; // component at position 1 is killed after the redirect assignment
45
46 if(v_index == 1) { // no alive call during evaluation, v_index remains equal to 1
47 setverdict(pass);
48 } else {
49 setverdict(fail, "Index incorrectly assigned");
50 }
51 }
52
53 control {
54 execute(TC_Sem_210305_alive_operation_013(), 5.0);
55 }
56 }
This page took 0.033144 seconds and 5 git commands to generate.