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