Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
3abe9331 | 2 | * Copyright (c) 2000-2015 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 | |
7 | ******************************************************************************/ | |
8 | module TsetofMatch { | |
9 | // Type definitions | |
10 | ||
11 | type component my_comp {}; | |
12 | type enumerated my_enum {amstel, buckler, coronita, desperados}; | |
13 | type record of integer recordof_int; | |
14 | //type union my_union { | |
15 | // int x1, | |
16 | // recordof_int x2 | |
17 | //}; | |
18 | ||
19 | type set of integer setof_int; // set of basic type | |
20 | type set of my_enum setof_enum; // set of enum | |
21 | //type set of my_union setof_union; // set of union | |
22 | type set of recordof_int setof_recordof; // set of record of | |
23 | type set of setof_int setof_setof; // recursive set of | |
24 | ||
25 | // Constants | |
26 | ||
27 | const recordof_int record_element1:={4,3,2}; | |
28 | ||
29 | const setof_int setof_const1:={1,2,3,4,5}; | |
30 | const setof_enum setof_const2:={amstel, coronita}; | |
31 | //const setof_union setof_const3:={{1,{1,2,3}}, {9,{4}}}; | |
32 | const setof_recordof setof_const4:={record_element1, {5,4,3}, {2}}; | |
33 | const setof_setof setof_const5:={{0,1}, setof_const1, {1}}; | |
34 | ||
35 | // Templates | |
36 | ||
37 | template setof_int setof_temp1 := {1,2,3,4}; | |
38 | template setof_enum setof_temp2 := {amstel, buckler, ?}; | |
39 | template setof_enum setof_temp3 := {?, buckler, ?, buckler}; | |
40 | template setof_int setof_temp4 := {*}; | |
41 | template setof_int setof_temp5 := {1, *, 3}; | |
42 | template setof_recordof setof_temp6 := {*, {1,2}, {3}, *}; | |
43 | template setof_setof setof_temp7 := {{?,1}, {7,3}, ?, {5,*}}; | |
44 | template setof_setof setof_temp8 := {{1,*}, * length (4)}; | |
45 | template setof_int setof_temp9 := ({1},{2,?},{(3,4,5),?,?}); | |
46 | template setof_setof setof_temp10 := {* length(2), * length(3), *}; | |
47 | ||
48 | // Testcases - non-template part | |
49 | ||
50 | testcase setofIntAssign() runs on my_comp { | |
51 | var setof_int x1:= {25, 13, 37}; | |
52 | var setof_int x2, x3, x4; | |
53 | x2:={32,12}; | |
54 | x3:={11}; | |
55 | x3:={11,22}; | |
56 | x4:={}; | |
57 | ||
58 | if (x1[0]==25) {setverdict(pass);} // at declaration | |
59 | else {setverdict(fail);} | |
60 | if (x1[1]==13) {setverdict(pass);} | |
61 | else {setverdict(fail);} | |
62 | if (x2[0]==32) {setverdict(pass);} // later | |
63 | else {setverdict(fail);} | |
64 | if (x2[1]==12) {setverdict(pass);} | |
65 | else {setverdict(fail);} | |
66 | if (x3[0]==11) {setverdict(pass);} // after changing size | |
67 | else {setverdict(fail);} | |
68 | if (x3[1]==22) {setverdict(pass);} | |
69 | else {setverdict(fail);} | |
70 | if (sizeof(x4)==0) {setverdict(pass);} // empty set of | |
71 | else {setverdict(fail);} | |
72 | } | |
73 | ||
74 | testcase setofIntEq() runs on my_comp { | |
75 | // setof_int setof_const1:={1,2,3,4,5}; | |
76 | var setof_int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10; | |
77 | x1 := {1, 2, 3, 4, 5}; | |
78 | x2 := {1, 3, 2, 5, 4}; | |
79 | x3 := {4, 3, 2, 1, 5}; | |
80 | x4 := {5, 1, 4, 3, 2}; | |
81 | x5 := {3, 4, 5, 2, 1}; | |
82 | x6 := {1, 2, 3, 4, 4}; | |
83 | x7 := {1, 1, 1, 1, 1}; | |
84 | x8 := {1, 2, 3, 4, 5, 6}; | |
85 | x9:= {1, 4, 3, 2}; | |
86 | //equality - the same order | |
87 | if (x1==setof_const1) {setverdict(pass);} | |
88 | else {setverdict(fail);} | |
89 | //equality - other order | |
90 | if (x2==setof_const1) {setverdict(pass);} | |
91 | else {setverdict(fail);} | |
92 | if (x3==setof_const1) {setverdict(pass);} | |
93 | else {setverdict(fail);} | |
94 | if (x4==setof_const1) {setverdict(pass);} | |
95 | else {setverdict(fail);} | |
96 | if (x5==setof_const1) {setverdict(pass);} | |
97 | else {setverdict(fail);} | |
98 | //non-equality - unmatched elements | |
99 | if (x6!=setof_const1) {setverdict(pass);} | |
100 | else {setverdict(fail);} | |
101 | if (x7!=setof_const1) {setverdict(pass);} | |
102 | else {setverdict(fail);} | |
103 | //non-equality - too many elements | |
104 | if (x8!=setof_const1) {setverdict(pass);} | |
105 | else {setverdict(fail);} | |
106 | //non-equality - too few elements | |
107 | if (x9!=setof_const1) {setverdict(pass);} | |
108 | else {setverdict(fail);} | |
109 | } | |
110 | ||
111 | testcase setofSetofEq() runs on my_comp { | |
112 | var setof_setof x1, x2, x3, x4, x5, x6, x7; | |
113 | x1 := {{1,2},{3,4}}; | |
114 | x2 := {{1,2},{3,4}}; | |
115 | x3 := {{3,4},{1,2}}; | |
116 | x4 := {{2,1},{4,3}}; | |
117 | x5 := {{2,1},{4,3},{1,2}}; | |
118 | x6 := {{4,1},{3,2}}; | |
119 | x7 := {{1},{2,4}}; | |
120 | //equality - in same order | |
121 | if (x2==x1) {setverdict(pass);} | |
122 | else {setverdict(fail);} | |
123 | //equality - different orders | |
124 | if (x3==x1) {setverdict(pass);} | |
125 | else {setverdict(fail);} | |
126 | if (x4==x1) {setverdict(pass);} | |
127 | else {setverdict(fail);} | |
128 | //non-equality - too many elements | |
129 | if (x5!=x1) {setverdict(pass);} | |
130 | else {setverdict(fail);} | |
131 | //non-equality - elements not matching | |
132 | if (x6!=x1) {setverdict(pass);} | |
133 | else {setverdict(fail);} | |
134 | //non-equality - elements size not proper | |
135 | if (x7!=x1) {setverdict(pass);} | |
136 | else {setverdict(fail);} | |
137 | } | |
138 | ||
139 | // Testcases - template part | |
140 | ||
141 | testcase tsetofIntSpecValueMatch() runs on my_comp { | |
142 | //template setof_int setof_temp1 := {1,2,3,4}; | |
143 | var setof_int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10; | |
144 | x1 := {1, 2, 3, 4} | |
145 | x2 := {1, 3, 2, 4} | |
146 | x3 := {4, 3, 2, 1} | |
147 | x4 := {2, 1, 4, 3} | |
148 | x5 := {3, 4, 1, 2} | |
149 | x6 := {1, 2, 3} | |
150 | x7 := {1, 2, 3, 4, 5} | |
151 | x8 := {4, 3, 2, 2} | |
152 | x9 := {1, 1, 4, 3} | |
153 | x10 := {3, 5, 1, 2} | |
154 | //match - in same order | |
155 | if (match(x1,setof_temp1)) {setverdict(pass);} | |
156 | else {setverdict(fail);} | |
157 | //match - in different orders | |
158 | if (match(x2,setof_temp1)) {setverdict(pass);} | |
159 | else {setverdict(fail);} | |
160 | if (match(x3,setof_temp1)) {setverdict(pass);} | |
161 | else {setverdict(fail);} | |
162 | if (match(x4,setof_temp1)) {setverdict(pass);} | |
163 | else {setverdict(fail);} | |
164 | if (match(x5,setof_temp1)) {setverdict(pass);} | |
165 | else {setverdict(fail);} | |
166 | //no match: too few elements | |
167 | if (not(match(x6,setof_temp1))) {setverdict(pass);} | |
168 | else {setverdict(fail);} | |
169 | //no match: too many elements | |
170 | if (not(match(x7,setof_temp1))) {setverdict(pass);} | |
171 | else {setverdict(fail);} | |
172 | //no match: two different elements only match one | |
173 | if (not(match(x8,setof_temp1))) {setverdict(pass);} | |
174 | else {setverdict(fail);} | |
175 | if (not(match(x9,setof_temp1))) {setverdict(pass);} | |
176 | else {setverdict(fail);} | |
177 | //no match: unmatched element | |
178 | if (not(match(x10,setof_temp1))) {setverdict(pass);} | |
179 | else {setverdict(fail);} | |
180 | } | |
181 | ||
182 | testcase tsetofEnumAnyValueMatch() runs on my_comp { | |
183 | //template setof_enum setof_temp2 := {amstel, buckler, ?}; | |
184 | //template setof_enum setof_temp3 := {?, buckler, ?, buckler}; | |
185 | var setof_enum x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12; | |
186 | x1 := {amstel, buckler, coronita} | |
187 | x2 := {buckler, coronita, amstel} | |
188 | x3 := {buckler, buckler, amstel} | |
189 | x4 := {buckler, amstel, amstel} | |
190 | x5 := {buckler, amstel, desperados} | |
191 | x6 := {amstel, amstel, buckler, buckler} | |
192 | x7 := {buckler, coronita, buckler, amstel} | |
193 | x8 := {amstel, buckler} | |
194 | x9 := {buckler, coronita, buckler} | |
195 | x10 := {buckler, buckler, buckler} | |
196 | x11 := {coronita, amstel, amstel} | |
197 | x12 := {amstel, buckler, coronita, desperados} | |
198 | //match - in same order | |
199 | if (match(x1,setof_temp2)) {setverdict(pass);} | |
200 | else {setverdict(fail);} | |
201 | //match - in other orders | |
202 | if (match(x2,setof_temp2)) {setverdict(pass);} | |
203 | else {setverdict(fail);} | |
204 | if (match(x3,setof_temp2)) {setverdict(pass);} | |
205 | else {setverdict(fail);} | |
206 | if (match(x4,setof_temp2)) {setverdict(pass);} | |
207 | else {setverdict(fail);} | |
208 | if (match(x5,setof_temp2)) {setverdict(pass);} | |
209 | else {setverdict(fail);} | |
210 | if (match(x6,setof_temp3)) {setverdict(pass);} | |
211 | else {setverdict(fail);} | |
212 | if (match(x7,setof_temp3)) {setverdict(pass);} | |
213 | else {setverdict(fail);} | |
214 | //no match - too many elements | |
215 | if (match(x6,setof_temp2)) {setverdict(fail);} | |
216 | else {setverdict(pass);} | |
217 | //no match - too few elements | |
218 | if (match(x8,setof_temp2)) {setverdict(fail);} | |
219 | else {setverdict(pass);} | |
220 | //no match - element unmatched | |
221 | if (match(x9,setof_temp2)) {setverdict(fail);} | |
222 | else {setverdict(pass);} | |
223 | if (match(x10,setof_temp2)) {setverdict(fail);} | |
224 | else {setverdict(pass);} | |
225 | if (match(x11,setof_temp2)) {setverdict(fail);} | |
226 | else {setverdict(pass);} | |
227 | if (match(x12,setof_temp3)) {setverdict(fail);} | |
228 | else {setverdict(pass);} | |
229 | } | |
230 | ||
231 | testcase tsetofIntAnyorNoneMatch() runs on my_comp { | |
232 | //template setof_int setof_temp4 := {*}; | |
233 | //template setof_int setof_temp5 := {1, *, 3}; | |
234 | var setof_int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10; | |
235 | //x0 := {omit} | |
236 | x1 := {} | |
237 | x2 := {1} | |
238 | x3 := {2} | |
239 | x4 := {2, 1} | |
240 | x5 := {3, 2, 1} | |
241 | x6 := {1, 3} | |
242 | x7 := {3, 1} | |
243 | x8 := {1, 2, 3} | |
244 | x9 := {3, 2, 1} | |
245 | x10 := {4, 3, 2, 1} | |
246 | //match - matches everything | |
247 | /* | |
248 | if (match(x0,setof_temp4)) {setverdict(pass);} | |
249 | else {setverdict(fail);} | |
250 | */ | |
251 | if (match(x1,setof_temp4)) {setverdict(pass);} | |
252 | else {setverdict(fail);} | |
253 | if (match(x2,setof_temp4)) {setverdict(pass);} | |
254 | else {setverdict(fail);} | |
255 | if (match(x3,setof_temp4)) {setverdict(pass);} | |
256 | else {setverdict(fail);} | |
257 | if (match(x4,setof_temp4)) {setverdict(pass);} | |
258 | else {setverdict(fail);} | |
259 | if (match(x5,setof_temp4)) {setverdict(pass);} | |
260 | else {setverdict(fail);} | |
261 | //match - in same and reverse order | |
262 | if (match(x6,setof_temp5)) {setverdict(pass);} | |
263 | else {setverdict(fail);} | |
264 | if (match(x7,setof_temp5)) {setverdict(pass);} | |
265 | else {setverdict(fail);} | |
266 | //match - with one or more anyvalues | |
267 | if (match(x8,setof_temp5)) {setverdict(pass);} | |
268 | else {setverdict(fail);} | |
269 | if (match(x9,setof_temp5)) {setverdict(pass);} | |
270 | else {setverdict(fail);} | |
271 | if (match(x10,setof_temp5)) {setverdict(pass);} | |
272 | else {setverdict(fail);} | |
273 | } | |
274 | ||
275 | testcase tsetofRecordofAnyorNoneMatch() runs on my_comp { | |
276 | // setof_recordof setof_temp6 := {*, {1,2}, {3}, *}; | |
277 | var setof_recordof x1, x2, x3, x4, x5, x6, x7; | |
278 | x1 := {{1,2},{3}}; | |
279 | x2 := {{3},{1,2}}; | |
280 | x3 := {{2,1},{3}}; | |
281 | x4 := {{1,2},{3},{1,2}}; | |
282 | x5 := {{1,2,3},{1},{2},{3},{1,2},{2,3},{1,3}}; | |
283 | x6 := {{1,2,3},{3},{2,3},{1,3},{3,3}}; | |
284 | x7 := {{1,2}}; | |
285 | //match in both order | |
286 | if (match(x1,setof_temp6)) {setverdict(pass);} | |
287 | else {setverdict(fail);} | |
288 | if (match(x2,setof_temp6)) {setverdict(pass);} | |
289 | else {setverdict(fail);} | |
290 | //no match - wrong order in the record | |
291 | if (not(match(x3,setof_temp6))) {setverdict(pass);} | |
292 | else {setverdict(fail);} | |
293 | //match - use anyornone values | |
294 | if (match(x4,setof_temp6)) {setverdict(pass);} | |
295 | else {setverdict(fail);} | |
296 | if (match(x5,setof_temp6)) {setverdict(pass);} | |
297 | else {setverdict(fail);} | |
298 | //no match - no match for one of the elements | |
299 | if (not(match(x6,setof_temp6))) {setverdict(pass);} | |
300 | else {setverdict(fail);} | |
301 | if (not(match(x7,setof_temp6))) {setverdict(pass);} | |
302 | else {setverdict(fail);} | |
303 | } | |
304 | ||
305 | testcase tsetofSetofMatch() runs on my_comp { | |
306 | // setof_setof setof_temp7 := {{?,1}, {7,3}, ?, {5,*}}; | |
307 | var setof_setof x1, x2, x3, x4, x5; | |
308 | x1 := {{1,1},{7,3},{8,9},{5}}; | |
309 | x2 := {{7,6,5},{1,0},{3,7},{11}}; | |
310 | x3 := {{5,7,3},{7,3},{},{1,5}}; | |
311 | x4 := {{7,3},{1,2},{5}}; | |
312 | x5 := {{1,1,1},{3,7},{2,3},{5,5}}; | |
313 | //match - in the same order | |
314 | if (match(x1,setof_temp7)) {setverdict(pass);} | |
315 | else {setverdict(fail);} | |
316 | //match - in different order | |
317 | if (match(x2,setof_temp7)) {setverdict(pass);} | |
318 | else {setverdict(fail);} | |
319 | if (match(x3,setof_temp7)) {setverdict(pass);} | |
320 | else {setverdict(fail);} | |
321 | //no match: too few elements | |
322 | if (not(match(x4,setof_temp7))) {setverdict(pass);} | |
323 | else {setverdict(fail);} | |
324 | //no match: first element unmatched | |
325 | if (not(match(x5,setof_temp7))) {setverdict(pass);} | |
326 | else {setverdict(fail);} | |
327 | } | |
328 | ||
329 | testcase tsetofSetofLengthMatch1() runs on my_comp { | |
330 | //template setof_setof setof_temp8 := {{1,*}, * length (4)}; | |
331 | // Note: the interpretation of the asterisk with length restriction is | |
332 | // unspecified in the standard. | |
333 | // In our interpretation the asterisk matches exactly one element if it has | |
334 | // extra matching attributes (e.g. length restriction). | |
335 | // That is, * length(4) and ? length(4) are treated as equivalents. | |
336 | var setof_setof x1, x2, x3, x4, x5, x6, x7, x8; | |
337 | x1 := {{1},{1,1,1,1}}; | |
338 | x2 := {{1,2,3,4},{5,1}}; | |
339 | x3 := {{1,2,3},{1,2,3,4},{4,3,2,1}}; | |
340 | x4 := {{5,1}}; | |
341 | x5 := {{2,3,4,5}}; | |
342 | x6 := {{1},{1,2},{1,2,3,4}}; | |
343 | x8 := {{1},{1,2,3,4},{1,2}}; | |
344 | x7 := {{1},{1,2}}; | |
345 | //match - in same order | |
346 | if (match(x1,setof_temp8)) {setverdict(pass);} | |
347 | else {setverdict(fail);} | |
348 | //match - in different order | |
349 | if (match(x2,setof_temp8)) {setverdict(pass);} | |
350 | else {setverdict(fail);} | |
351 | //no match - multiple fixed length elements | |
352 | if (not match(x3,setof_temp8)) {setverdict(pass);} | |
353 | else {setverdict(fail);} | |
354 | //no match - no fixed length elements | |
355 | if (not match(x4,setof_temp8)) {setverdict(pass);} | |
356 | else {setverdict(fail);} | |
357 | //no match: element unmatched | |
358 | if (not match(x5,setof_temp8)) {setverdict(pass);} | |
359 | else {setverdict(fail);} | |
360 | //no match - element of wrong length | |
361 | if (not(match(x6,setof_temp8))) {setverdict(pass);} | |
362 | else {setverdict(fail);} | |
363 | if (not(match(x8,setof_temp8))) {setverdict(pass);} | |
364 | else {setverdict(fail);} | |
365 | if (not(match(x7,setof_temp8))) {setverdict(pass);} | |
366 | else {setverdict(fail);} | |
367 | } | |
368 | ||
369 | testcase tsetofIntValueListMatch() runs on my_comp { | |
370 | //template setof_int setof_temp9 := ({1},{2,?},{3..5,?,?}); | |
371 | var setof_int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10; | |
372 | x1 := {1}; | |
373 | x2 := {2,5}; | |
374 | x3 := {3,3,3}; | |
375 | x4 := {1,2,3}; | |
376 | x5 := {2,1}; | |
377 | x6 := {2}; | |
378 | x7 := {1,2,6}; | |
379 | x8 := {1,3}; | |
380 | x9 := {1,2,2}; | |
381 | x10 := {1,2,3,4}; | |
382 | //match | |
383 | if (match(x1,setof_temp9)) {setverdict(pass);} | |
384 | else {setverdict(fail);} | |
385 | if (match(x2,setof_temp9)) {setverdict(pass);} | |
386 | else {setverdict(fail);} | |
387 | if (match(x3,setof_temp9)) {setverdict(pass);} | |
388 | else {setverdict(fail);} | |
389 | if (match(x4,setof_temp9)) {setverdict(pass);} | |
390 | else {setverdict(fail);} | |
391 | if (match(x5,setof_temp9)) {setverdict(pass);} | |
392 | else {setverdict(fail);} | |
393 | //no match | |
394 | if (not(match(x6,setof_temp9))) {setverdict(pass);} | |
395 | else {setverdict(fail);} | |
396 | if (not(match(x7,setof_temp9))) {setverdict(pass);} | |
397 | else {setverdict(fail);} | |
398 | if (not(match(x8,setof_temp9))) {setverdict(pass);} | |
399 | else {setverdict(fail);} | |
400 | if (not(match(x9,setof_temp9))) {setverdict(pass);} | |
401 | else {setverdict(fail);} | |
402 | if (not(match(x10,setof_temp9))) {setverdict(pass);} | |
403 | else {setverdict(fail);} | |
404 | } | |
405 | ||
406 | testcase tsetofSetofLengthMatch2() runs on my_comp { | |
407 | //template setof_setof setof_temp10 := {* length(2), * length(3), *}; | |
408 | // See the note for testcase tsetofSetofLengthMatch1 | |
409 | var setof_setof x1, x2, x3, x4, x5; | |
410 | x1 := {}; | |
411 | x2 := {{1,2},{2,3},{1,2,3}}; | |
412 | x3 := {{1}, {1,2}}; | |
413 | x4 := {{1,2,3},{4,3}}; | |
414 | x5 := {{},{}}; | |
415 | //no match - empty set | |
416 | if (not match(x1,setof_temp10)) {setverdict(pass);} | |
417 | else {setverdict(fail);} | |
418 | //match - lengths are ok | |
419 | if (match(x2,setof_temp10)) {setverdict(pass);} | |
420 | else {setverdict(fail);} | |
421 | //no match: length too short | |
422 | if (not(match(x3,setof_temp10))) {setverdict(pass);} | |
423 | else {setverdict(fail);} | |
424 | //match: lengths are ok | |
425 | if (match(x4,setof_temp10)) {setverdict(pass);} | |
426 | else {setverdict(fail);} | |
427 | //no match: lengths are zero | |
428 | if (not(match(x5,setof_temp10))) {setverdict(pass);} | |
429 | else {setverdict(fail);} | |
430 | } | |
431 | ||
432 | testcase tsetofSuperset1() runs on my_comp { | |
433 | template setof_int t1 := superset(1, 2, 3); | |
434 | template setof_int t2 := superset(5, 4, 3, 2, 1); | |
435 | template setof_int t3 := superset(5, 4, 3, 2, 1, 6); | |
436 | template setof_int t4 := superset(5, 4, 3, 2, 1, ?); | |
437 | template setof_int t5 := superset(5, 4, 3, 2, ?); | |
438 | template setof_int t6 := superset(?, 5, 4, 3, 2); | |
439 | template setof_int t7 := superset(?, 5, 4, 3, 2, *); | |
440 | template setof_int t8 := superset(?, 5, 4, 3, *); | |
441 | template setof_int t9 := superset(5, 4, 3, 2, 1, ?, *); | |
442 | template setof_int t1a := superset(1, 7, 2, 3); | |
443 | template setof_int t2a := superset(5, 4, 7, 3, 2, 1); | |
444 | template setof_int t3a := superset(5, 4, 3, 7, 2, 1, 6); | |
445 | template setof_int t4a := superset(5, 7, 4, 3, 2, 1, ?); | |
446 | template setof_int t5a := superset(5, 4, 3, 2, ?, 7); | |
447 | template setof_int t6a := superset(?, 5, 7, 4, 3, 2); | |
448 | template setof_int t7a := superset(7, ?, 5, 4, 3, 2, *); | |
449 | template setof_int t8a := superset(?, 5, 4, 7, 3, *); | |
450 | template setof_int t9a := superset(5, 4, 3, 2, 7, 1, ?, *); | |
451 | template setof_int t10 := superset(?, ?, ?, ?, ?, ?); | |
452 | template setof_int t11 := superset(?, ?, ?, ?, ?); | |
453 | ||
454 | if(match(setof_const1, t1)) {setverdict(pass);} | |
455 | else {setverdict(fail);} | |
456 | if(match(setof_const1, t2)) {setverdict(pass);} | |
457 | else {setverdict(fail);} | |
458 | if(not match(setof_const1, t3)) {setverdict(pass);} | |
459 | else {setverdict(fail);} | |
460 | if(not match(setof_const1, t4)) {setverdict(pass);} | |
461 | else {setverdict(fail);} | |
462 | if(match(setof_const1, t5)) {setverdict(pass);} | |
463 | else {setverdict(fail);} | |
464 | if(match(setof_const1, t6)) {setverdict(pass);} | |
465 | else {setverdict(fail);} | |
466 | if(match(setof_const1, t7)) {setverdict(pass);} | |
467 | else {setverdict(fail);} | |
468 | if(match(setof_const1, t8)) {setverdict(pass);} | |
469 | else {setverdict(fail);} | |
470 | if(not match(setof_const1, t9)) {setverdict(pass);} | |
471 | else {setverdict(fail);} | |
472 | ||
473 | if(not match(setof_const1, t1a)) {setverdict(pass);} | |
474 | else {setverdict(fail);} | |
475 | if(not match(setof_const1, t2a)) {setverdict(pass);} | |
476 | else {setverdict(fail);} | |
477 | if(not match(setof_const1, t3a)) {setverdict(pass);} | |
478 | else {setverdict(fail);} | |
479 | if(not match(setof_const1, t4a)) {setverdict(pass);} | |
480 | else {setverdict(fail);} | |
481 | if(not match(setof_const1, t5a)) {setverdict(pass);} | |
482 | else {setverdict(fail);} | |
483 | if(not match(setof_const1, t6a)) {setverdict(pass);} | |
484 | else {setverdict(fail);} | |
485 | if(not match(setof_const1, t7a)) {setverdict(pass);} | |
486 | else {setverdict(fail);} | |
487 | if(not match(setof_const1, t8a)) {setverdict(pass);} | |
488 | else {setverdict(fail);} | |
489 | if(not match(setof_const1, t9a)) {setverdict(pass);} | |
490 | else {setverdict(fail);} | |
491 | ||
492 | if(not match(setof_const1, t10)) {setverdict(pass);} | |
493 | else {setverdict(fail);} | |
494 | if(match(setof_const1, t11)) {setverdict(pass);} | |
495 | else {setverdict(fail);} | |
496 | ||
497 | /* --- */ | |
498 | ||
499 | template setof_setof tt1 := superset(t1); | |
500 | template setof_setof tt2 := superset(t2, superset(1)); | |
501 | template setof_setof tt3 := superset(t5, superset(1), superset(1)); | |
502 | template setof_setof tt4 := superset(t6, superset(1), superset(1, 0)); | |
503 | template setof_setof tt5 := superset(t7, superset(1), superset(1, 2)); | |
504 | template setof_setof tt6 := superset(t7, superset(1), t3); | |
505 | ||
506 | if(match(setof_const5, tt1)) {setverdict(pass);} | |
507 | else {setverdict(fail);} | |
508 | if(match(setof_const5, tt2)) {setverdict(pass);} | |
509 | else {setverdict(fail);} | |
510 | if(match(setof_const5, tt3)) {setverdict(pass);} | |
511 | else {setverdict(fail);} | |
512 | if(match(setof_const5, tt4)) {setverdict(pass);} | |
513 | else {setverdict(fail);} | |
514 | if(not match(setof_const5, tt5)) {setverdict(pass);} | |
515 | else {setverdict(fail);} | |
516 | if(not match(setof_const5, tt6)) {setverdict(pass);} | |
517 | else {setverdict(fail);} | |
518 | } | |
519 | ||
520 | testcase tsetofSuperset2() runs on my_comp { | |
521 | template setof_enum t1 := superset(buckler); | |
522 | template setof_enum t2 := superset(coronita); | |
523 | template setof_enum t3 := superset(coronita, buckler); | |
524 | template setof_enum t4 := superset(coronita, amstel); | |
525 | ||
526 | if(not match(setof_const2, t1)) {setverdict(pass);} | |
527 | else {setverdict(fail);} | |
528 | if(match(setof_const2, t2)) {setverdict(pass);} | |
529 | else {setverdict(fail);} | |
530 | if(not match(setof_const2, t3)) {setverdict(pass);} | |
531 | else {setverdict(fail);} | |
532 | if(match(setof_const2, t4)) {setverdict(pass);} | |
533 | else {setverdict(fail);} | |
534 | } | |
535 | ||
536 | testcase tsetofSubset1() runs on my_comp { | |
537 | template setof_int t1 := subset(1, 2, 3); | |
538 | template setof_int t2 := subset(1, 2, 3, 4, 5, 6); | |
539 | template setof_int t3 := subset(6, 5, 4, 3, 2, 1); | |
540 | template setof_int t4 := subset(?); | |
541 | template setof_int t5 := subset(*); | |
542 | template setof_int t6 := subset(?, ?, ?, ?); | |
543 | template setof_int t7 := subset(?, ?, ?, ?, ?); | |
544 | template setof_int t8 := subset(?, ?, ?, ?, ?, ?); | |
545 | template setof_int t9 := subset(?, ?, ?, ?, *); | |
546 | template setof_int t10 := subset(2, 3, 4, 5, 6); | |
547 | template setof_int t11 := subset(2, 3, 4, 5, 6, ?); | |
548 | template setof_int t12 := subset(2, 3, 4, 5, 6, *); | |
549 | template setof_int t13 := subset(3, 4, 5, 6, ?); | |
550 | ||
551 | if(not match(setof_const1, t1)) {setverdict(pass);} | |
552 | else {setverdict(fail);} | |
553 | if(match(setof_const1, t2)) {setverdict(pass);} | |
554 | else {setverdict(fail);} | |
555 | if(match(setof_const1, t3)) {setverdict(pass);} | |
556 | else {setverdict(fail);} | |
557 | if(not match(setof_const1, t4)) {setverdict(pass);} | |
558 | else {setverdict(fail);} | |
559 | if(match(setof_const1, t5)) {setverdict(pass);} | |
560 | else {setverdict(fail);} | |
561 | if(not match(setof_const1, t6)) {setverdict(pass);} | |
562 | else {setverdict(fail);} | |
563 | if(match(setof_const1, t7)) {setverdict(pass);} | |
564 | else {setverdict(fail);} | |
565 | if(match(setof_const1, t8)) {setverdict(pass);} | |
566 | else {setverdict(fail);} | |
567 | if(match(setof_const1, t9)) {setverdict(pass);} | |
568 | else {setverdict(fail);} | |
569 | if(not match(setof_const1, t10)) {setverdict(pass);} | |
570 | else {setverdict(fail);} | |
571 | if(match(setof_const1, t11)) {setverdict(pass);} | |
572 | else {setverdict(fail);} | |
573 | if(match(setof_const1, t12)) {setverdict(pass);} | |
574 | else {setverdict(fail);} | |
575 | if(not match(setof_const1, t13)) {setverdict(pass);} | |
576 | else {setverdict(fail);} | |
577 | } | |
578 | ||
579 | testcase tsetofSubset2() runs on my_comp { | |
580 | template setof_enum t1 := subset(buckler); | |
581 | template setof_enum t2 := subset(coronita); | |
582 | template setof_enum t3 := subset(coronita, buckler); | |
583 | template setof_enum t4 := subset(coronita, amstel); | |
584 | template setof_enum t5 := subset(coronita, buckler, amstel); | |
585 | ||
586 | if(not match(setof_const2, t1)) {setverdict(pass);} | |
587 | else {setverdict(fail);} | |
588 | if(not match(setof_const2, t2)) {setverdict(pass);} | |
589 | else {setverdict(fail);} | |
590 | if(not match(setof_const2, t3)) {setverdict(pass);} | |
591 | else {setverdict(fail);} | |
592 | if(match(setof_const2, t4)) {setverdict(pass);} | |
593 | else {setverdict(fail);} | |
594 | if(match(setof_const2, t5)) {setverdict(pass);} | |
595 | else {setverdict(fail);} | |
596 | } | |
597 | ||
598 | control { | |
599 | execute(setofIntAssign()); | |
600 | execute(setofIntEq()); | |
601 | execute(setofSetofEq()); | |
602 | ||
603 | execute(tsetofIntSpecValueMatch()); | |
604 | execute(tsetofEnumAnyValueMatch()); | |
605 | execute(tsetofIntAnyorNoneMatch()); | |
606 | execute(tsetofRecordofAnyorNoneMatch()); | |
607 | execute(tsetofSetofMatch()); | |
608 | execute(tsetofSetofLengthMatch1()); | |
609 | execute(tsetofIntValueListMatch()); | |
610 | execute(tsetofSetofLengthMatch2()); | |
611 | execute(tsetofSuperset1()); | |
612 | execute(tsetofSuperset2()); | |
613 | execute(tsetofSubset1()); | |
614 | execute(tsetofSubset2()); | |
615 | } | |
616 | } |