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 shifty_SW { //^In TTCN-3 module `shifty_SW':// | |
9 | ||
10 | type component PDTestComponent {}; | |
11 | ||
12 | ||
13 | /*--- SHIFT ON BITSTRING --------------------------------------------------*/ | |
14 | ||
15 | const bitstring shiconb := '0000000000'B | |
16 | const bitstring shiconb1 := '0000110000'B | |
17 | const bitstring shiconb2 := shiconb1 >> 2 // '0000001100'B | |
18 | const bitstring shiconb3 := shiconb1 << 2 // '0011000000'B | |
19 | const bitstring shiconb4 := shiconb1 << 5 // '1000000000'B | |
20 | const bitstring shiconb5 := shiconb1 >> 5 // '0000000001'B | |
21 | const bitstring shiconb6 := shiconb1 << 0 // '0000110000'B | |
22 | const bitstring shiconb7 := shiconb1 >> 0 // '0000110000'B | |
23 | const bitstring shiconb8 := shiconb1 << 11 // '0000000000'B | |
24 | const bitstring shiconb9 := shiconb1 >> 11 // '0000000000'B | |
25 | const bitstring shiconb10 := ''B | |
26 | const bitstring shiconb11 := ''B >> 2 | |
27 | const bitstring shiconb12 := ''B << 2 | |
28 | const bitstring shiconb13 := ''B >> 0 | |
29 | const bitstring shiconb14 := ''B << 0 | |
30 | const bitstring shiconb15 := shiconb1 >> -2 // '0011000000'B | |
31 | const bitstring shiconb16 := shiconb1 << -2 // '0000001100'B | |
32 | ||
33 | testcase shift_bitstr() runs on PDTestComponent{ //In testcase definition// | |
34 | ||
35 | if (shiconb1 == shiconb2 << 2) | |
36 | {setverdict(pass);} | |
37 | else {setverdict(fail);} //^In else statement// \ | |
38 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
39 | if (shiconb1 == shiconb3 >> 2) | |
40 | {setverdict(pass);} | |
41 | else {setverdict(fail);} //^In else statement// \ | |
42 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
43 | if (shiconb1 != shiconb4 >> 5) | |
44 | {setverdict(pass);} | |
45 | else {setverdict(fail);} //^In else statement// \ | |
46 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
47 | if (shiconb1 != shiconb5 << 5) | |
48 | {setverdict(pass);} | |
49 | else {setverdict(fail);} //^In else statement// \ | |
50 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
51 | if (shiconb1 == shiconb6) | |
52 | {setverdict(pass);} | |
53 | else {setverdict(fail);} //^In else statement// \ | |
54 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
55 | if (shiconb1 == shiconb7) | |
56 | {setverdict(pass);} | |
57 | else {setverdict(fail);} //^In else statement// \ | |
58 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
59 | if (shiconb == shiconb8) | |
60 | {setverdict(pass);} | |
61 | else {setverdict(fail);} //^In else statement// \ | |
62 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
63 | if (shiconb == shiconb9) | |
64 | {setverdict(pass);} | |
65 | else {setverdict(fail);} //^In else statement// \ | |
66 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
67 | if ((shiconb10 == shiconb11) | |
68 | and (shiconb10 == shiconb12)) | |
69 | {setverdict(pass);} | |
70 | else {setverdict(fail);} //^In else statement// \ | |
71 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
72 | if ((shiconb10 == shiconb13) | |
73 | and (shiconb10 == shiconb14)) | |
74 | {setverdict(pass);} | |
75 | else {setverdict(fail);} //^In else statement// \ | |
76 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
77 | if (shiconb15 == shiconb3) | |
78 | {setverdict(pass);} | |
79 | else {setverdict(fail);} //^In else statement// \ | |
80 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
81 | if (shiconb16 == shiconb2) | |
82 | {setverdict(pass);} | |
83 | else {setverdict(fail);} //^In else statement// \ | |
84 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
85 | } | |
86 | ||
87 | /*--- SHIFT ON HEXSTRING --------------------------------------------------*/ | |
88 | ||
89 | const hexstring shiconh := '0000000000'H | |
90 | const hexstring shiconh1 := '0000110000'H | |
91 | const hexstring shiconh2 := shiconh1 >> 2 // '0000001100'H | |
92 | const hexstring shiconh3 := shiconh1 << 2 // '0011000000'H | |
93 | const hexstring shiconh4 := shiconh1 << 5 // '1000000000'H | |
94 | const hexstring shiconh5 := shiconh1 >> 5 // '0000000001'H | |
95 | const hexstring shiconh6 := shiconh1 << 0 // '0000110000'H | |
96 | const hexstring shiconh7 := shiconh1 >> 0 // '0000110000'H | |
97 | const hexstring shiconh8 := shiconh1 << 11 // '0000000000'H | |
98 | const hexstring shiconh9 := shiconh1 >> 11 // '0000000000'H | |
99 | const hexstring shiconh10 := ''H | |
100 | const hexstring shiconh11 := ''H >> 2 | |
101 | const hexstring shiconh12 := ''H << 2 | |
102 | const hexstring shiconh13 := ''H >> 0 | |
103 | const hexstring shiconh14 := ''H << 0 | |
104 | const hexstring shiconh15 := shiconh1 >> -2 // '0011000000'H | |
105 | const hexstring shiconh16 := shiconh1 << -2 // '0000001100'H | |
106 | ||
107 | testcase shift_hexstr() runs on PDTestComponent{ //In testcase definition// | |
108 | ||
109 | if (shiconh1 == shiconh2 << 2) | |
110 | {setverdict(pass);} | |
111 | else {setverdict(fail);} //^In else statement// \ | |
112 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
113 | if (shiconh1 == shiconh3 >> 2) | |
114 | {setverdict(pass);} | |
115 | else {setverdict(fail);} //^In else statement// \ | |
116 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
117 | if (shiconh1 != shiconh4 >> 5) | |
118 | {setverdict(pass);} | |
119 | else {setverdict(fail);} //^In else statement// \ | |
120 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
121 | if (shiconh1 != shiconh5 << 5) | |
122 | {setverdict(pass);} | |
123 | else {setverdict(fail);} //^In else statement// \ | |
124 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
125 | if (shiconh1 == shiconh6) | |
126 | {setverdict(pass);} | |
127 | else {setverdict(fail);} //^In else statement// \ | |
128 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
129 | if (shiconh1 == shiconh7) | |
130 | {setverdict(pass);} | |
131 | else {setverdict(fail);} //^In else statement// \ | |
132 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
133 | if (shiconh == shiconh8) | |
134 | {setverdict(pass);} | |
135 | else {setverdict(fail);} //^In else statement// \ | |
136 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
137 | if (shiconh == shiconh9) | |
138 | {setverdict(pass);} | |
139 | else {setverdict(fail);} //^In else statement// \ | |
140 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
141 | if ((shiconh10 == shiconh11) | |
142 | and (shiconh10 == shiconh12)) | |
143 | {setverdict(pass);} | |
144 | else {setverdict(fail);} //^In else statement// \ | |
145 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
146 | if ((shiconh10 == shiconh13) | |
147 | and (shiconh10 == shiconh14)) | |
148 | {setverdict(pass);} | |
149 | else {setverdict(fail);} //^In else statement// \ | |
150 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
151 | if (shiconh15 == shiconh3) | |
152 | {setverdict(pass);} | |
153 | else {setverdict(fail);} //^In else statement// \ | |
154 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
155 | if (shiconh16 == shiconh2) | |
156 | {setverdict(pass);} | |
157 | else {setverdict(fail);} //^In else statement// \ | |
158 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
159 | } | |
160 | ||
161 | /*--- SHIFT ON OCTETSTRING --------------------------------------------------*/ | |
162 | ||
163 | const octetstring shicono := '0000000000'O | |
164 | const octetstring shicono1 := '0000AA0000'O | |
165 | const octetstring shicono2 := shicono1 >> 2 // '00000000AA'O | |
166 | const octetstring shicono3 := shicono1 << 2 // 'AA00000000'O | |
167 | const octetstring shicono4 := shicono1 << 5 // '0000000000'O | |
168 | const octetstring shicono5 := shicono1 >> 5 // '0000000000'O | |
169 | const octetstring shicono6 := shicono1 << 0 // '0000AA0000'O | |
170 | const octetstring shicono7 := shicono1 >> 0 // '0000AA0000'O | |
171 | const octetstring shicono8 := shicono1 << 11 // '0000000000'O | |
172 | const octetstring shicono9 := shicono1 >> 11 // '0000000000'O | |
173 | const octetstring shicono10 := ''O | |
174 | const octetstring shicono11 := ''O >> 2 | |
175 | const octetstring shicono12 := ''O << 2 | |
176 | const octetstring shicono13 := ''O >> 0 | |
177 | const octetstring shicono14 := ''O << 0 | |
178 | const octetstring shicono15 := shicono1 >> -2 // 'AA00000000'O | |
179 | const octetstring shicono16 := shicono1 << -2 // '00000000AA'O | |
180 | ||
181 | testcase shift_octetstr() runs on PDTestComponent{ //In testcase definition// | |
182 | ||
183 | if (shicono1 == shicono2 << 2) | |
184 | {setverdict(pass);} | |
185 | else {setverdict(fail);} //^In else statement// \ | |
186 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
187 | if (shicono1 == shicono3 >> 2) | |
188 | {setverdict(pass);} | |
189 | else {setverdict(fail);} //^In else statement// \ | |
190 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
191 | if (shicono1 != shicono4 >> 5) | |
192 | {setverdict(pass);} | |
193 | else {setverdict(fail);} //^In else statement// \ | |
194 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
195 | if (shicono1 != shicono5 << 5) | |
196 | {setverdict(pass);} | |
197 | else {setverdict(fail);} //^In else statement// \ | |
198 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
199 | if (shicono1 == shicono6) | |
200 | {setverdict(pass);} | |
201 | else {setverdict(fail);} //^In else statement// \ | |
202 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
203 | if (shicono1 == shicono7) | |
204 | {setverdict(pass);} | |
205 | else {setverdict(fail);} //^In else statement// \ | |
206 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
207 | if (shicono == shicono8) | |
208 | {setverdict(pass);} | |
209 | else {setverdict(fail);} //^In else statement// \ | |
210 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
211 | if (shicono == shicono9) | |
212 | {setverdict(pass);} | |
213 | else {setverdict(fail);} //^In else statement// \ | |
214 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
215 | if ((shicono10 == shicono11) | |
216 | and (shicono10 == shicono12)) | |
217 | {setverdict(pass);} | |
218 | else {setverdict(fail);} //^In else statement// \ | |
219 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
220 | if ((shicono10 == shicono13) | |
221 | and (shicono10 == shicono14)) | |
222 | {setverdict(pass);} | |
223 | else {setverdict(fail);} //^In else statement// \ | |
224 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
225 | if (shicono15 == shicono3) | |
226 | {setverdict(pass);} | |
227 | else {setverdict(fail);} //^In else statement// \ | |
228 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
229 | if (shicono16 == shicono2) | |
230 | {setverdict(pass);} | |
231 | else {setverdict(fail);} //^In else statement// \ | |
232 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
233 | } | |
234 | ||
235 | control { | |
236 | execute (shift_bitstr()); | |
237 | execute (shift_hexstr()); | |
238 | execute (shift_octetstr()); | |
239 | } | |
240 | ||
241 | } |