conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 21_configuration_operations / 2103_test_component_operations / 210308_killed_operation / Sem_210308_killed_operation_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:21.3.8, Verify any from killed index redirection to fuzzy 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 killed operation. Later
19 // evaluation of the lazy or fuzzy variable does not lead to repeated invocation of the
20 // killed operation.
21 module Sem_210308_killed_operation_012 {
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_210308_killed_operation_012() runs on GeneralComp system GeneralComp {
32 const integer c_size := 4;
33 var GeneralComp v_ptc[c_size];
34 var @fuzzy integer v_index;
35 timer t := 2.0;
36 for (var integer i := 0; i < c_size; i := i + 1) {
37 v_ptc[i] := GeneralComp.create; // created components are inactive
38 if (i == 2) { v_ptc[i].start(f(1.0)); }
39 else { v_ptc[i].start(f(100.0)); }
40 }
41 t.start;
42 t.timeout;
43 alt
44 {
45 [] any from v_ptc.killed -> @index v_index {
46 v_ptc[0].kill; // component at position 0 is killed after the redirect assignment
47 if(v_index == 2){ // no killed call during evaluation, v_index remains equal to 2
48 setverdict(pass);
49 } else {
50 setverdict(fail, "Index incorrectly assigned");
51 }
52 }
53 [else] { setverdict(fail, "The any from killed operation didn't found killed component"); }
54 }
55 }
56
57 control {
58 execute(TC_Sem_210308_killed_operation_012(), 5.0);
59 }
60 }
This page took 0.032788 seconds and 5 git commands to generate.