Last sync 2016.04.01
[deliverable/titan.core.git] / regression_test / templateRecof / TmultiplePermutations.ttcn
CommitLineData
970ed795 1/******************************************************************************
d44e3c4f 2 * Copyright (c) 2000-2016 Ericsson Telecom AB
970ed795
EL
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
d44e3c4f 7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Baranyi, Botond
11 *
970ed795
EL
12 ******************************************************************************/
13// Test cases for TR HQ19911:
14// Adding multiple permutations to the same template variable, testing if permutation data is
15// cleared properly between commands
16module TmultiplePermutations {
17
18type record of integer RoI;
19type record of float RoF;
20type record of charstring RoCS;
21
22type record Roios {
23 RoI roi,
24 octetstring os
25}
26
27type component CT_empty { };
28type component CT_perm {
29 var template RoI vt_comp_perm := { permutation(1,2,3) };
30}
31
32template RoI t_perm1 := { permutation(10,20,30) };
33template RoI t_perm2 := { 1, 2, permutation(5, ?) };
34template RoI t_simple := { 6, 7, 8 };
35
36function f_do_nothing(in template RoI p_roi) runs on CT_empty return template RoI {
37 return p_roi;
38}
39
40modulepar {
41 template RoI mpt_roi := { };
42}
43
44// Testing permutation with template variable in a component
45testcase tc_mul_perm_component1() runs on CT_perm {
46 setverdict(pass);
47}
48
49testcase tc_mul_perm_component2() runs on CT_perm {
50 setverdict(pass);
51}
52
53// Testing multiple permutations on a template variable
54testcase tc_mul_perm_var() runs on CT_empty {
55 var template RoI vt_roi := { permutation(2) };
56 vt_roi := { permutation(3,4,7) };
57 setverdict(pass);
58}
59
60testcase tc_mul_perm_temp() runs on CT_empty {
61 var template RoI vt_roi := { permutation(5,2) };
62 vt_roi := t_perm1;
63 vt_roi := t_perm2;
64 setverdict(pass);
65}
66
67testcase tc_mul_perm_var2() runs on CT_empty {
68 var template RoI vt_roi1 := { permutation(1,2,3,4) };
69 var template RoI vt_roi2 := { permutation(5,6) };
70 vt_roi2 := valueof(vt_roi1) & { 10, 20, 30 };
71 vt_roi2 := t_perm2;
72 vt_roi1 := vt_roi2;
73 vt_roi1 := vt_roi1;
74 setverdict(pass);
75}
76
77testcase tc_mul_perm_var_f() runs on CT_empty {
78 var template RoF vt_rof := { 1.0, 0.0, permutation(9.5, *) };
79 vt_rof := { 0.0, permutation(1.0, 2.0, ?), 10.0, permutation(2.73, 3.14, *) };
80 vt_rof := { permutation( (0.0 .. 1.0) ) };
81 setverdict(pass);
82}
83
84testcase tc_mul_perm_var_cs() runs on CT_empty {
85 var template RoCS vt_rocs := { "one", "two", permutation("six", "seven", "eight") };
86 vt_rocs := { permutation("cat", "dog", pattern "a*d" length (4..10) ) };
87 vt_rocs := { permutation( ("a".."f") ) };
88 setverdict(pass);
89}
90
91testcase tc_mul_perm_func() runs on CT_empty {
92 var template RoI vt_roi := { 1, 2, permutation(6,7,8) };
93 vt_roi := f_do_nothing(vt_roi);
94 setverdict(pass);
95}
96
97testcase tc_mul_perm_modulepar() runs on CT_empty {
98 var template RoI vt_roi := { permutation(8,9) };
99 vt_roi := mpt_roi;
100 vt_roi := { permutation(8,9,10) };
101 setverdict(pass);
102}
103
104testcase tc_mul_perm_all_from() runs on CT_empty {
105 var template RoI vt_roi := { 1, 2, permutation(3, 4, all from t_simple ) };
106 vt_roi := { permutation(-2, -1, all from t_simple) };
107 vt_roi := { -2, -1, permutation(all from t_simple) };
108 setverdict(pass);
109}
110
111testcase tc_mul_perm_var3() runs on CT_empty {
112 var template RoI vt_roi := { permutation( 1, 2, 3 ), 10 };
113 vt_roi := { 1, complement(1, 2, 3), 3, 4 };
114 var template RoI vt_target := { 1, complement(1, 2, 3), 3, 4 };
115 if (log2str(vt_roi) == log2str(vt_target)) { setverdict(pass); }
116 else { setverdict(fail, vt_roi); }
117}
118
119testcase tc_mul_perm_field() runs on CT_empty {
120 var template Roios vt_roios := { { permutation (1, 2, 3) } , 'DEAD'O };
121 vt_roios.roi := { 1, permutation(2, 3) };
122 vt_roios.roi := { permutation(7, lengthof(vt_roios.roi)), 19 };
123 setverdict(pass);
124}
125
126control {
127 execute(tc_mul_perm_component1());
128 execute(tc_mul_perm_component2());
129 execute(tc_mul_perm_var());
130 execute(tc_mul_perm_temp());
131 execute(tc_mul_perm_var2());
132 execute(tc_mul_perm_var_f());
133 execute(tc_mul_perm_var_cs());
134 execute(tc_mul_perm_func());
135 execute(tc_mul_perm_modulepar());
136 execute(tc_mul_perm_all_from());
137 execute(tc_mul_perm_var3());
138 execute(tc_mul_perm_field());
139}
140
141} // end of module
This page took 0.028591 seconds and 5 git commands to generate.