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_011.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 that any from alive index redirection works for multidimensional arrays
13 ** @verdict pass accept, ttcn3verdict:pass
14 *****************************************************************/
15 // The following requirements are tested:
16 // Restriction e:
17 // If the index redirection is used for multi-dimensional component arrays, the size
18 // of the integer array or record of integer type shall exactly be the same as the dimension
19 // of the respective array, and its type shall allow storing the highest index (from all
20 // dimensions) of the array.
21 module Sem_210305_alive_operation_011 {
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_011() runs on GeneralComp system GeneralComp {
32 var boolean v_isAlive;
33 const integer c_size := 3;
34 var GeneralComp v_ptc[c_size][c_size];
35 var integer v_index[2];
36
37 for (var integer i := 0; i < c_size; i := i + 1) {
38 for (var integer j := 0; j < c_size; j := j + 1) {
39 v_ptc[i][j] := GeneralComp.create; // created components are inactive
40 if (i mod 2 == 0 or j mod 2 == 1) { v_ptc[i][j].kill; } // kill components on even i or odd j
41 else { v_ptc[i][j].start(f());} // activate v_ptc
42 }
43 }
44
45 v_isAlive := any from v_ptc.alive -> @index v_index;
46
47 if(v_index[0] == 1 and v_index[1] == 0){
48 setverdict(pass);
49 } else {
50 setverdict(fail, "Index incorrectly assigned");
51 }
52 }
53
54 control {
55 execute(TC_Sem_210305_alive_operation_011(), 5.0);
56 }
57 }
This page took 0.036486 seconds and 5 git commands to generate.