1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 ******************************************************************************/
10 type component PDTestComponent {};
13 /*--- ROTATE ON BITSTRING --------------------------------------------------*/
15 const bitstring rotconb := '1000110001'B // '0000000000'B
16 modulepar bitstring rotparb1 := rotconb
17 modulepar bitstring rotparb2 := rotconb @> 2 // '0110001100'B
18 modulepar bitstring rotparb3 := rotconb <@ 2 // '0011000110'B
19 modulepar bitstring rotparb4 := rotconb <@ 5 // '1000110001'B
20 modulepar bitstring rotparb5 := rotconb @> 5 // '1000110001'B
21 modulepar bitstring rotparb6 := rotconb <@ 0 // '1000110001'B
22 modulepar bitstring rotparb7 := rotconb @> 0 // '1000110001'B
23 modulepar bitstring rotparb8 := rotconb <@ 11 // '0001100011'B
24 modulepar bitstring rotparb9 := rotconb @> 11 // '1100011000'B
25 modulepar bitstring rotparb10 := ''B
26 modulepar bitstring rotparb11 := ''B @> 2
27 modulepar bitstring rotparb12 := ''B <@ 2
28 modulepar bitstring rotparb13 := ''B @> 0
29 modulepar bitstring rotparb14 := ''B <@ 0
30 modulepar bitstring rotparb15 := rotconb @> -2 // '0011000110'B
31 modulepar bitstring rotparb16 := rotconb <@ -2 // '0110001100'B
33 testcase rotate_bitstr() runs on PDTestComponent{
37 if (rotparb1 == rotparb1 <@ lengthof(rotparb1))
39 else {setverdict(fail);}
40 if (rotparb1 == rotparb1 @> lengthof(rotparb1))
42 else {setverdict(fail);}
43 if (rotparb1 == rotparb2 <@ 2)
45 else {setverdict(fail);}
46 if (rotparb1 == rotparb3 @> 2)
48 else {setverdict(fail);}
49 if (rotparb1 == rotparb4 @> 5)
51 else {setverdict(fail);}
52 if (rotparb1 == rotparb5 <@ 5)
54 else {setverdict(fail);}
55 if (rotparb1 == rotparb6)
57 else {setverdict(fail);}
58 if (rotparb1 == rotparb7)
60 else {setverdict(fail);}
61 if (rotparb8 == '0001100011'B)
63 else {setverdict(fail);}
64 if (rotparb9 == '1100011000'B)
66 else {setverdict(fail);}
67 if ((rotparb10 == rotparb11)
68 and (rotparb10 == rotparb12))
70 else {setverdict(fail);}
71 if ((rotparb10 == rotparb13)
72 and (rotparb10 == rotparb14))
74 else {setverdict(fail);}
75 if (rotparb15 == rotparb3)
77 else {setverdict(fail);}
78 if (rotparb16 == rotparb2)
80 else {setverdict(fail);}
82 var bitstring b1 := '0000011111'B
83 for (j:=0; j<15; j:=j+1) {
84 if ((b1 <@ j) @> j == b1)
86 else {setverdict(fail);}
87 if ((b1 <@ -j) <@ j == b1)
89 else {setverdict(fail);}
90 if ((b1 @> -j) @> j == b1)
92 else {setverdict(fail);}
96 else {setverdict(fail);}
99 var bitstring b2 := '10101010101010101010'B
100 for (j:=1; j<30; j:=j+2) {
103 else {setverdict(fail);}
104 if ((b2 <@ j-1) == b2)
106 else {setverdict(fail);}
109 else {setverdict(fail);}
110 if ((b2 @> j-1) == b2)
112 else {setverdict(fail);}
118 /*--- ROTATE ON HEXSTRING --------------------------------------------------*/
120 const hexstring rotconh := '1000110001'H // '0000000000'H
121 modulepar hexstring rotparh1 := rotconh
122 modulepar hexstring rotparh2 := rotconh @> 2 // '0110001100'H
123 modulepar hexstring rotparh3 := rotconh <@ 2 // '0011000110'H
124 modulepar hexstring rotparh4 := rotconh <@ 5 // '1000110001'H
125 modulepar hexstring rotparh5 := rotconh @> 5 // '1000110001'H
126 modulepar hexstring rotparh6 := rotconh <@ 0 // '1000110001'H
127 modulepar hexstring rotparh7 := rotconh @> 0 // '1000110001'H
128 modulepar hexstring rotparh8 := rotconh <@ 11 // '0001100011'H
129 modulepar hexstring rotparh9 := rotconh @> 11 // '1100011000'H
130 modulepar hexstring rotparh10 := ''H
131 modulepar hexstring rotparh11 := ''H @> 2
132 modulepar hexstring rotparh12 := ''H <@ 2
133 modulepar hexstring rotparh13 := ''H @> 0
134 modulepar hexstring rotparh14 := ''H <@ 0
135 modulepar hexstring rotparh15 := rotconh @> -2 // '0011000110'H
136 modulepar hexstring rotparh16 := rotconh <@ -2 // '0110001100'H
138 testcase rotate_hexstr() runs on PDTestComponent{
143 if (rotparh1 == rotparh1 <@ lengthof(rotparh1))
145 else {setverdict(fail);}
146 if (rotparh1 == rotparh1 @> lengthof(rotparh1))
148 else {setverdict(fail);}
149 if (rotparh1 == rotparh2 <@ 2)
151 else {setverdict(fail);}
152 if (rotparh1 == rotparh3 @> 2)
154 else {setverdict(fail);}
155 if (rotparh1 == rotparh4 @> 5)
157 else {setverdict(fail);}
158 if (rotparh1 == rotparh5 <@ 5)
160 else {setverdict(fail);}
161 if (rotparh1 == rotparh6)
163 else {setverdict(fail);}
164 if (rotparh1 == rotparh7)
166 else {setverdict(fail);}
167 if (rotparh8 == '0001100011'H)
169 else {setverdict(fail);}
170 if (rotparh9 == '1100011000'H)
172 else {setverdict(fail);}
173 if ((rotparh10 == rotparh11)
174 and (rotparh10 == rotparh12))
176 else {setverdict(fail);}
177 if ((rotparh10 == rotparh13)
178 and (rotparh10 == rotparh14))
180 else {setverdict(fail);}
181 if (rotparh15 == rotparh3)
183 else {setverdict(fail);}
184 if (rotparh16 == rotparh2)
186 else {setverdict(fail);}
188 var hexstring h1 := '0000011111'H
189 for (j:=0; j<15; j:=j+1) {
190 if ((h1 <@ j) @> j == h1)
192 else {setverdict(fail);}
193 if ((h1 <@ -j) <@ j == h1)
195 else {setverdict(fail);}
196 if ((h1 @> -j) @> j == h1)
198 else {setverdict(fail);}
202 else {setverdict(fail);}
205 var hexstring h2 := '10101010101010101010'H
206 for (j:=1; j<30; j:=j+2) {
209 else {setverdict(fail);}
210 if ((h2 <@ j-1) == h2)
212 else {setverdict(fail);}
215 else {setverdict(fail);}
216 if ((h2 @> j-1) == h2)
218 else {setverdict(fail);}
224 /*--- ROTATE ON OCTETSTRING --------------------------------------------------*/
226 const octetstring rotcono := 'AA00AA00AA'O
227 modulepar octetstring rotparo1 := rotcono
228 modulepar octetstring rotparo2 := rotcono @> 1 // 'AAAA00AA00'O
229 modulepar octetstring rotparo3 := rotcono <@ 1 // '00AA00AAAA'O
230 modulepar octetstring rotparo4 := rotcono <@ 5 // 'AA00AA00AA'O
231 modulepar octetstring rotparo5 := rotcono @> 5 // 'AA00AA00AA'O
232 modulepar octetstring rotparo6 := rotcono <@ 0 // 'AA00AA00AA'O
233 modulepar octetstring rotparo7 := rotcono @> 0 // 'AA00AA00AA'O
234 modulepar octetstring rotparo8 := rotcono <@ 11 // '00AA00AAAA'O
235 modulepar octetstring rotparo9 := rotcono @> 11 // 'AAAA00AA00'O
236 modulepar octetstring rotparo10 := ''O
237 modulepar octetstring rotparo11 := ''O @> 2
238 modulepar octetstring rotparo12 := ''O <@ 2
239 modulepar octetstring rotparo13 := ''O @> 0
240 modulepar octetstring rotparo14 := ''O <@ 0
241 modulepar octetstring rotparo15 := rotcono @> -1 // '00AA00AAAA'O
242 modulepar octetstring rotparo16 := rotcono <@ -1 // 'AAAA00AA00'O
244 testcase rotate_octetstr() runs on PDTestComponent{
248 if (rotparo1 == rotparo1 <@ lengthof(rotparo1))
250 else {setverdict(fail);}
251 if (rotparo1 == rotparo1 @> lengthof(rotparo1))
253 else {setverdict(fail);}
254 if (rotparo1 == rotparo2 <@ 1)
256 else {setverdict(fail);}
257 if (rotparo1 == rotparo3 @> 1)
259 else {setverdict(fail);}
260 if (rotparo1 == rotparo4 @> 5)
262 else {setverdict(fail);}
263 if (rotparo1 == rotparo5 <@ 5)
265 else {setverdict(fail);}
266 if (rotparo1 == rotparo6)
268 else {setverdict(fail);}
269 if (rotparo1 == rotparo7)
271 else {setverdict(fail);}
272 if (rotparo8 == '00AA00AAAA'O)
274 else {setverdict(fail);}
275 if (rotparo9 == 'AAAA00AA00'O)
277 else {setverdict(fail);}
278 if ((rotparo10 == rotparo11)
279 and (rotparo10 == rotparo12))
281 else {setverdict(fail);}
282 if ((rotparo10 == rotparo13)
283 and (rotparo10 == rotparo14))
285 else {setverdict(fail);}
286 if (rotparo15 == rotparo3)
288 else {setverdict(fail);}
289 if (rotparo16 == rotparo2)
291 else {setverdict(fail);}
294 var octetstring o1 := '0000011111'O
295 for (j:=0; j<15; j:=j+1) {
296 if ((o1 <@ j) @> j == o1)
298 else {setverdict(fail);}
299 if ((o1 <@ -j) <@ j == o1)
301 else {setverdict(fail);}
302 if ((o1 @> -j) @> j == o1)
304 else {setverdict(fail);}
308 else {setverdict(fail);}
311 var octetstring o2 := '1100110011001100110011001100110011001100'O
312 for (j:=1; j<30; j:=j+2) {
315 else {setverdict(fail);}
316 if ((o2 <@ j-1) == o2)
318 else {setverdict(fail);}
321 else {setverdict(fail);}
322 if ((o2 @> j-1) == o2)
324 else {setverdict(fail);}
329 /*--- ROTATE ON CHARSTRING --------------------------------------------------*/
331 const charstring rotconc := "1000110001" // "0000000000"
332 modulepar charstring rotparc1 := rotconc
333 modulepar charstring rotparc2 := rotconc @> 2 // "0110001100"
334 modulepar charstring rotparc3 := rotconc <@ 2 // "0011000110"
335 modulepar charstring rotparc4 := rotconc <@ 5 // "1000110001"
336 modulepar charstring rotparc5 := rotconc @> 5 // "1000110001"
337 modulepar charstring rotparc6 := rotconc <@ 0 // "1000110001"
338 modulepar charstring rotparc7 := rotconc @> 0 // "1000110001"
339 modulepar charstring rotparc8 := rotconc <@ 11 // "0001100011"
340 modulepar charstring rotparc9 := rotconc @> 11 // "1100011000"
341 modulepar charstring rotparc10 := ""
342 modulepar charstring rotparc11 := "" @> 2
343 modulepar charstring rotparc12 := "" <@ 2
344 modulepar charstring rotparc13 := "" @> 0
345 modulepar charstring rotparc14 := "" <@ 0
346 modulepar charstring rotparc15 := rotconc @> -2 // "0011000110"
347 modulepar charstring rotparc16 := rotconc <@ -2 // "0110001100"
349 testcase rotate_char() runs on PDTestComponent{
353 if (rotparc1 == rotparc1 <@ lengthof(rotparc1))
355 else {setverdict(fail);}
356 if (rotparc1 == rotparc1 @> lengthof(rotparc1))
358 else {setverdict(fail);}
359 if (rotparc1 == rotparc2 <@ 2)
361 else {setverdict(fail);}
362 if (rotparc1 == rotparc3 @> 2)
364 else {setverdict(fail);}
365 if (rotparc1 == rotparc4 @> 5)
367 else {setverdict(fail);}
368 if (rotparc1 == rotparc5 <@ 5)
370 else {setverdict(fail);}
371 if (rotparc1 == rotparc6)
373 else {setverdict(fail);}
374 if (rotparc1 == rotparc7)
376 else {setverdict(fail);}
377 if (rotparc8 == "0001100011")
379 else {setverdict(fail);}
380 if (rotparc9 == "1100011000")
382 else {setverdict(fail);}
383 if ((rotparc10 == rotparc11)
384 and (rotparc10 == rotparc12))
386 else {setverdict(fail);}
387 if ((rotparc10 == rotparc13)
388 and (rotparc10 == rotparc14))
390 else {setverdict(fail);}
391 if (rotparc15 == rotparc3)
393 else {setverdict(fail);}
394 if (rotparc16 == rotparc2)
396 else {setverdict(fail);}
398 var charstring c1 := "0000011111"
399 for (j:=0; j<15; j:=j+1) {
401 if ((c1 <@ j) @> j == c1)
403 else {setverdict(fail);}
404 if ((c1 <@ -j) <@ j == c1)
406 else {setverdict(fail);}
407 if ((c1 @> -j) @> j == c1)
409 else {setverdict(fail);}
413 else {setverdict(fail);}
416 var charstring c2 := "10101010101010101010"
417 for (j:=1; j<30; j:=j+2) {
420 else {setverdict(fail);}
421 if ((c2 <@ j-1) == c2)
423 else {setverdict(fail);}
426 else {setverdict(fail);}
427 if ((c2 @> j-1) == c2)
429 else {setverdict(fail);}
436 /*--- ROTATE ON UNIVERSAL CHARSTRING --------------------------------------------------*/
438 //modulepar universal charstring rotconuc := "0000000000"
439 const universal charstring rotconuc := char(0,0,0,65) & "000" & char(0,0,0,65) & char(0,0,0,65) & "000" & char(0,0,0,65) //A000AA000A
440 modulepar universal charstring rotparuc1 := rotconuc
441 modulepar universal charstring rotparuc2 := rotconuc @> 2 // "0AA000AA00"
442 modulepar universal charstring rotparuc3 := rotconuc <@ 2 // "00AA000AA0"
443 modulepar universal charstring rotparuc4 := rotconuc <@ 5 // "A000AA000A"
444 modulepar universal charstring rotparuc5 := rotconuc @> 5 // "A000AA000A"
445 modulepar universal charstring rotparuc6 := rotconuc <@ 0 // "A000AA000A"
446 modulepar universal charstring rotparuc7 := rotconuc @> 0 // "A000AA000A"
447 modulepar universal charstring rotparuc8 := rotconuc <@ 11 // "000AA000AA"
448 modulepar universal charstring rotparuc9 := rotconuc @> 11 // "AA000AA000"
449 modulepar universal charstring rotparuc10 := ""
450 modulepar universal charstring rotparuc11 := "" @> 2
451 modulepar universal charstring rotparuc12 := "" <@ 2
452 modulepar universal charstring rotparuc13 := "" @> 0
453 modulepar universal charstring rotparuc14 := "" <@ 0
454 modulepar universal charstring rotparuc15 := rotconuc @> -2 // "00AA000AA0"
455 modulepar universal charstring rotparuc16 := rotconuc <@ -2 // "0AA000AA00"
457 testcase rotate_uchar() runs on PDTestComponent{
460 if (rotparuc1 == rotparuc1 <@ lengthof(rotparc1))
462 else {setverdict(fail);}
463 if (rotparuc1 == rotparuc1 @> lengthof(rotparc1))
465 else {setverdict(fail);}
466 if (rotparuc1 == rotparuc2 <@ 2)
468 else {setverdict(fail);}
469 if (rotparuc1 == rotparuc3 @> 2)
471 else {setverdict(fail);}
472 if (rotparuc1 == rotparuc4 @> 5)
474 else {setverdict(fail);}
475 if (rotparuc1 == rotparuc5 <@ 5)
477 else {setverdict(fail);}
478 if (rotparuc1 == rotparuc6)
480 else {setverdict(fail);}
481 if (rotparuc1 == rotparuc7)
483 else {setverdict(fail);}
484 if (rotparuc8 == "000AA000AA")
486 else {setverdict(fail);}
487 if (rotparuc9 == "AA000AA000")
489 else {setverdict(fail);}
490 if ((rotparuc10 == rotparuc11)
491 and (rotparuc10 == rotparuc12))
493 else {setverdict(fail);}
494 if ((rotparuc10 == rotparuc13)
495 and (rotparuc10 == rotparuc14))
497 else {setverdict(fail);}
498 if (rotparuc15 == rotparuc3)
500 else {setverdict(fail);}
501 if (rotparuc16 == rotparuc2)
503 else {setverdict(fail);}
505 var universal charstring c1 := "0000011111"
506 for (j:=0; j<15; j:=j+1) {
508 if ((c1 <@ j) @> j == c1)
510 else {setverdict(fail);}
511 if ((c1 <@ -j) <@ j == c1)
513 else {setverdict(fail);}
514 if ((c1 @> -j) @> j == c1)
516 else {setverdict(fail);}
520 else {setverdict(fail);}
523 var charstring c2 := "10101010101010101010"
524 for (j:=1; j<30; j:=j+2) {
527 else {setverdict(fail);}
528 if ((c2 <@ j-1) == c2)
530 else {setverdict(fail);}
533 else {setverdict(fail);}
534 if ((c2 @> j-1) == c2)
536 else {setverdict(fail);}
541 execute (rotate_bitstr());
542 execute (rotate_hexstr());
543 execute (rotate_octetstr());
544 execute (rotate_char());
545 execute (rotate_uchar());