1dfab6a77db702e1b9e75fa26b5bdba82f265e7e
[deliverable/titan.core.git] / regression_test / all_from / functions.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2015 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 module functions {
9 import from types all;
10
11 //************************* Functions ******************************
12
13
14 function f_checkIntegerTemplate(in template integer pl_template,in RoI pl_goodValues, in RoI pl_badValues) {
15
16 action("template=", pl_template, " will be checked against ",pl_goodValues);
17
18 var integer N:=sizeof(pl_goodValues);
19 for(var integer i:=0;i<N;i:=i+1) {
20 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
21 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
22 }
23
24 action("template=", pl_template, " will be checked against ",pl_badValues);
25 N:=sizeof(pl_badValues);
26 for(var integer i:=0;i<N;i:=i+1) {
27 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
28 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
29 }
30
31 }
32 with { extension "transparent" }
33
34 function f_checkCharstringTemplate(in template charstring pl_template,in RoCS pl_goodValues, in RoCS pl_badValues) {
35
36 action("template=", pl_template, " will be checked against ",pl_goodValues);
37
38 var integer N:=sizeof(pl_goodValues);
39 for(var integer i:=0;i<N;i:=i+1) {
40 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
41 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
42 }
43
44 action("template=", pl_template, " will be checked against ",pl_badValues);
45 N:=sizeof(pl_badValues);
46 for(var integer i:=0;i<N;i:=i+1) {
47 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
48 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
49 }
50
51 }
52 with { extension "transparent" }
53
54 function f_checkOctetstringTemplate(in template octetstring pl_template,in RoOS pl_goodValues, in RoOS pl_badValues) {
55
56 action("template=", pl_template, " will be checked against ",pl_goodValues);
57
58 var integer N:=sizeof(pl_goodValues);
59 for(var integer i:=0;i<N;i:=i+1) {
60 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
61 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
62 }
63
64 action("template=", pl_template, " will be checked against ",pl_badValues);
65 N:=sizeof(pl_badValues);
66 for(var integer i:=0;i<N;i:=i+1) {
67 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
68 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
69 }
70
71 }
72 function f_checkRoITemplate(in template RoI pl_template,in RoRoI pl_goodValues, in RoRoI pl_badValues) {
73
74 action("template=", pl_template, " will be checked against ",pl_goodValues);
75
76 var integer N:=sizeof(pl_goodValues);
77 for(var integer i:=0;i<N;i:=i+1) {
78 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
79 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
80 }
81
82 action("template=", pl_template, " will be checked against ",pl_badValues);
83 N:=sizeof(pl_badValues);
84 for(var integer i:=0;i<N;i:=i+1) {
85 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
86 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
87 }
88
89 }
90 with { extension "transparent" }
91
92 function f_checkSoITemplate(in template SoI pl_template,in RoSoI pl_goodValues, in RoSoI pl_badValues) {
93
94 action("template=", pl_template, " will be checked against ",pl_goodValues);
95
96 var integer N:=sizeof(pl_goodValues);
97 for(var integer i:=0;i<N;i:=i+1) {
98 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
99 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
100 }
101
102 action("template=", pl_template, " will be checked against ",pl_badValues);
103 N:=sizeof(pl_badValues);
104 for(var integer i:=0;i<N;i:=i+1) {
105 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
106 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
107 }
108
109 }
110 with { extension "transparent" }
111
112 function f_checkMyRecTemplate(in template MyRecord pl_template,in RoMyRec pl_goodValues, in RoMyRec pl_badValues) {
113
114 action("template=", pl_template, " will be checked against ",pl_goodValues);
115
116 var integer N:=sizeof(pl_goodValues);
117 for(var integer i:=0;i<N;i:=i+1) {
118 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
119 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
120 }
121
122 action("template=", pl_template, " will be checked against ",pl_badValues);
123 N:=sizeof(pl_badValues);
124 for(var integer i:=0;i<N;i:=i+1) {
125 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
126 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
127 }
128
129 }
130
131 function f_checkMyUnionTemplate(in template MyUnion pl_template,in RoMyUnion pl_goodValues, in RoMyUnion pl_badValues) {
132
133 action("template=", pl_template, " will be checked against ",pl_goodValues);
134
135 var integer N:=sizeof(pl_goodValues);
136 for(var integer i:=0;i<N;i:=i+1) {
137 if (match(pl_goodValues[i], pl_template)) { setverdict(pass); }
138 else { setverdict(fail,pl_goodValues[i], " should match ", pl_template); }
139 }
140
141 action("template=", pl_template, " will be checked against ",pl_badValues);
142 N:=sizeof(pl_badValues);
143 for(var integer i:=0;i<N;i:=i+1) {
144 if (not match(pl_badValues[i], pl_template)) { setverdict(pass); }
145 else { setverdict(fail,pl_badValues[i], " should not match ", pl_template); }
146 }
147
148 }
149 //==== Equivalence ====
150
151 function f_checkSoITemplateEquivalence(in template SoI pl_template1, in template SoI pl_template2) {
152 action("template1=",pl_template1," check against ",pl_template2);
153 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
154 }
155 with { extension "transparent" }
156
157 function f_checkRoITemplateEquivalence(in template RoI pl_template1, in template RoI pl_template2) {
158 action("template1=",pl_template1," check against ",pl_template2);
159 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
160 }
161 with { extension "transparent" }
162
163 function f_checkRoCSTemplateEquivalence(in template RoCS pl_template1, in template RoCS pl_template2) {
164 action("template1=",pl_template1," check against ",pl_template2);
165 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
166 }
167 function f_checkIntTemplateEquivalence(in template integer pl_template1, in template integer pl_template2) {
168 action("template1=",pl_template1," check against ",pl_template2);
169 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
170 }
171 with { extension "transparent" }
172
173 function f_checkCharstringTemplateEquivalence(in template charstring pl_template1, in template charstring pl_template2) {
174 action("template1=",pl_template1," check against ",pl_template2);
175 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
176 }
177 with { extension "transparent" }
178
179 function f_checkOctetstringTemplateEquivalence(in template octetstring pl_template1, in template octetstring pl_template2) {
180 action("template1=",pl_template1," check against ",pl_template2);
181 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
182 }
183 with { extension "transparent" }
184
185 function f_checkMyRecordTemplateEquivalence(in template MyRecord pl_template1, in template MyRecord pl_template2) {
186 action("template1=",pl_template1," check against ",pl_template2);
187 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
188 }
189 with { extension "transparent" }
190
191 function f_checkMyUnionTemplateEquivalence(in template MyUnion pl_template1, in template MyUnion pl_template2) {
192 action("template1=",pl_template1," check against ",pl_template2);
193 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
194 }
195 with { extension "transparent" }
196
197 function f_checkMyFunctionRefTemplateEquivalence(in template F_int2int pl_template1, in template F_int2int pl_template2) {
198 action("template1=",pl_template1," check against ",pl_template2);
199 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
200 }
201 with { extension "transparent" }
202
203 function f_checkMyRoFRefTemplateEquivalence(in template RoF_int2int pl_template1, in template RoF_int2int pl_template2) {
204 action("template1=",pl_template1," check against ",pl_template2);
205 if(log2str(pl_template1)==log2str(pl_template2)) {setverdict(pass);} else {setverdict(fail,"template1=",pl_template1," should match against ",pl_template2 );}
206 }
207 with { extension "transparent" }
208
209 function f_createIntegerWithAllFromFromInTemplateFromRoi(in template RoI pl_template1, inout template integer pl_template2) {
210 pl_template2:= (all from pl_template1);
211 }
212
213 function f_createIntegerWithAllFromFromInOutTemplateFromRoi(inout template RoI pl_template1, inout template integer pl_template2) {
214 pl_template2:= (all from pl_template1);
215 }
216
217 function f_createIntegerWithAllFromFromInTemplateFromSoi(in template SoI pl_template1, inout template integer pl_template2) {
218 pl_template2:= (all from pl_template1);
219 }
220
221 function f_createIntegerWithAllFromFromInOutTemplateFromSoi(inout template SoI pl_template1, inout template integer pl_template2) {
222 pl_template2:= (all from pl_template1);
223 }
224
225 //====== function references =======
226 function f_int2int_1(in integer pl_i) return integer { log("f_int2int_1 called with ", pl_i);return 1;}
227 function f_int2int_2(in integer pl_i) return integer { log("f_int2int_2 called with ", pl_i);return 2;}
228
229 }//module
This page took 0.034189 seconds and 4 git commands to generate.