Commit | Line | Data |
---|---|---|
970ed795 EL |
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 | ******************************************************************************/ | |
8 | module str_to_SW { //^In TTCN-3 module `str_to_SW':// | |
9 | ||
10 | type component PDTestComponent {}; | |
11 | ||
12 | ||
13 | /*--- STR2BIT --------------------------------------------------*/ | |
14 | ||
15 | const bitstring s2bcon := str2bit("") | |
16 | const bitstring s2bcon1 := str2bit("000000" & "" & "111111") | |
17 | const bitstring s2bcon2 := str2bit(substr("000000111111",0,6) & "" & substr("000000111111",6,6)) | |
18 | const bitstring s2bcon3 := str2bit(("000000" <@ lengthof(s2bcon2)/2) & "" & ("111111" @> lengthof(s2bcon2)/2)) | |
19 | ||
20 | testcase str_to_bit() runs on PDTestComponent{ //In testcase definition// | |
21 | ||
22 | ||
23 | if ((s2bcon == str2bit("")) | |
24 | and (s2bcon == ''B)) | |
25 | {setverdict(pass);} | |
26 | else {setverdict(fail);} //^In else statement// \ | |
27 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
28 | ||
29 | if ((s2bcon1 == str2bit("000000" & "" & "111111")) | |
30 | and (s2bcon1 == '000000111111'B)) | |
31 | {setverdict(pass);} | |
32 | else {setverdict(fail);} //^In else statement// \ | |
33 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
34 | ||
35 | if ((s2bcon2 == str2bit(substr("000000111111",0,6) & "" & substr("000000111111",6,6))) | |
36 | and (s2bcon2 == '000000111111'B)) | |
37 | {setverdict(pass);} | |
38 | else {setverdict(fail);} //^In else statement// \ | |
39 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
40 | ||
41 | if ((s2bcon3 == str2bit(("000000" <@ lengthof(s2bcon2)/2) & "" & ("111111" @> lengthof(s2bcon2)/2))) | |
42 | and (s2bcon3 == '000000111111'B)) | |
43 | {setverdict(pass);} | |
44 | else {setverdict(fail);} //^In else statement// \ | |
45 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
46 | } | |
47 | ||
48 | /*--- STR2FLOAT --------------------------------------------------*/ | |
49 | ||
50 | //const float s2fcon := str2float("") | |
51 | const float s2fcon := str2float("0.0") | |
52 | const float s2fcon1 := str2float("12345678901.0") | |
53 | const float s2fcon2 := str2float("000000000000" & "12345678901.0") //^In constant definition// \ | |
54 | //^In the operand of operation `str2float\(\)'// \ | |
55 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation \`str2float\(\)\'// | |
56 | const float s2fcon3 := str2float("-12" & "345678901.0") | |
57 | const float s2fcon4 := str2float("1.234E3") | |
58 | //const float s2fcon5 := str2float("1.234-3") | |
59 | const float s2fcon5 := str2float("1.234") | |
60 | //const float s2fcon6 := str2float("1,234E3") | |
61 | const float s2fcon6 := str2float("1.0") | |
62 | //const float s2fcon7 := str2float("--234") | |
63 | ||
64 | // HL67862 | |
65 | const float s2fcon7 := str2float("1"); | |
66 | const float s2fcon7m:= str2float("-1"); | |
67 | const float s2fcon8m:= str2float("-1."); | |
68 | const float s2fcon8 := str2float("1."); | |
69 | const float s2fcon9 := str2float("+001"); //^In constant definition// \ | |
70 | //^In the operand of operation `str2float\(\)'// \ | |
71 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation \`str2float\(\)\'// | |
72 | const float s2fcon10:= str2float("+001."); //^In constant definition// \ | |
73 | //^In the operand of operation `str2float\(\)'// \ | |
74 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation \`str2float\(\)\'// | |
75 | const float s2fcon11:= str2float("-0"); | |
76 | const float s2fcon12:= str2float("-0."); | |
77 | const float s2fcon13:= str2float("-0.0"); | |
78 | ||
79 | ||
80 | // HL67862 | |
81 | const charstring s2fmp7_str := "1"; | |
82 | const charstring s2fmp7m_str:= "-1"; | |
83 | const charstring s2fmp8m_str:= "-1."; | |
84 | const charstring s2fmp8_str := "1."; | |
85 | const charstring s2fmp9_str := "+001"; | |
86 | const charstring s2fmp10_str:= "+001."; | |
87 | const charstring s2fmp11_str:= "-0"; | |
88 | const charstring s2fmp12_str:= "-0."; | |
89 | const charstring s2fmp13_str:= "-0.0"; | |
90 | ||
91 | ||
92 | ||
93 | ||
94 | testcase str_to_float() runs on PDTestComponent{ //In testcase definition// | |
95 | ||
96 | // compile-time | |
97 | if ((s2fcon == str2float("0.0")) | |
98 | and (s2fcon == 0.0)) | |
99 | {setverdict(pass);} | |
100 | else {setverdict(fail);} //^In else statement// \ | |
101 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
102 | if ((s2fcon1 == str2float("12345678901.0")) | |
103 | and (s2fcon1 == 12345678901.0)) | |
104 | {setverdict(pass);} | |
105 | else {setverdict(fail);} //^In else statement// \ | |
106 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
107 | if ((s2fcon2 == str2float("000000000000" & "12345678901.0")) //^In if statement// \ | |
108 | //In the left operand of operation `and'// \ | |
109 | //In the right operand of operation `=='// \ | |
110 | //In the operand of operation \`str2float\(\)\'// \ | |
111 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation `str2float\(\)'// | |
112 | and (s2fcon2 == 12345678901.0)) | |
113 | {setverdict(pass);} | |
114 | else {setverdict(fail);} //^In else statement// \ | |
115 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
116 | if ((s2fcon3 == str2float("-12" & "345678901.0")) | |
117 | and (s2fcon3 == -12345678901.0)) | |
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 ((s2fcon4 == str2float("1.234E3")) | |
122 | and (s2fcon4 == 1234.0)) | |
123 | {setverdict(pass);} | |
124 | else {setverdict(fail);} //^In else statement// \ | |
125 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
126 | if ((s2fcon5 == str2float("1.234")) | |
127 | and (s2fcon5 == 1.234)) | |
128 | {setverdict(pass);} | |
129 | else {setverdict(fail);} //^In else statement// \ | |
130 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
131 | if ((s2fcon6 == str2float("1.0")) | |
132 | and (s2fcon6 == 1.0)) | |
133 | {setverdict(pass);} | |
134 | else {setverdict(fail);} //^In else statement// \ | |
135 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
136 | ||
137 | if ((s2fcon7 == str2float("1" )) and (s2fcon7 == 1.0)) | |
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 ((s2fcon7m== str2float("-1" )) and (s2fcon7m==-1.0)) | |
142 | {setverdict(pass);} | |
143 | else {setverdict(fail);} //^In else statement// \ | |
144 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
145 | if ((s2fcon8m== str2float("-1." )) and (s2fcon8m==-1.0)) | |
146 | {setverdict(pass);} | |
147 | else {setverdict(fail);} //^In else statement// \ | |
148 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
149 | if ((s2fcon8 == str2float("1." )) and (s2fcon8 == 1.0)) | |
150 | {setverdict(pass);} | |
151 | else {setverdict(fail);} //^In else statement// \ | |
152 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
153 | if ((s2fcon9 == str2float("+001" )) and (s2fcon9 == 1.0)) //^In if statement// \ | |
154 | //In the left operand of operation `and'// \ | |
155 | //In the right operand of operation `=='// \ | |
156 | //In the operand of operation \`str2float\(\)\'// \ | |
157 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation `str2float\(\)'// | |
158 | {setverdict(pass);} | |
159 | else {setverdict(fail);} //^In else statement// \ | |
160 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
161 | if ((s2fcon10== str2float("+001.")) and (s2fcon10== 1.0)) //^In if statement// \ | |
162 | //In the left operand of operation `and'// \ | |
163 | //In the right operand of operation `=='// \ | |
164 | //In the operand of operation \`str2float\(\)\'// \ | |
165 | //^warning: Leading zero digit was detected and ignored in the mantissa of the operand of operation `str2float\(\)'// | |
166 | {setverdict(pass);} | |
167 | else {setverdict(fail);} //^In else statement// \ | |
168 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
169 | if ((s2fcon11== str2float("-0" )) and (s2fcon11== -0.0)) | |
170 | {setverdict(pass);} | |
171 | else {setverdict(fail);} //^In else statement// \ | |
172 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
173 | if ((s2fcon12== str2float("-0." )) and (s2fcon12== -0.0)) | |
174 | {setverdict(pass);} | |
175 | else {setverdict(fail);} //^In else statement// \ | |
176 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
177 | if ((s2fcon13== str2float("-0.0" )) and (s2fcon13== -0.0)) | |
178 | {setverdict(pass);} | |
179 | else {setverdict(fail);} //^In else statement// \ | |
180 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
181 | /* run-time | |
182 | if ((s2fmp == str2float(s2fmp_str)) | |
183 | and (s2fmp == 0.0)) | |
184 | {setverdict(pass);} | |
185 | else {setverdict(fail);} | |
186 | if ((s2fmp1 == str2float(s2fmp1_str)) | |
187 | and (s2fmp1 == 12345678901.0)) | |
188 | {setverdict(pass);} | |
189 | else {setverdict(fail);} | |
190 | if ((s2fmp2 == str2float("000000000000" & "12345678901.0")) | |
191 | and (s2fmp2 == 12345678901.0)) | |
192 | {setverdict(pass);} | |
193 | else {setverdict(fail);} | |
194 | if ((s2fmp3 == str2float("-12" & "345678901.0")) | |
195 | and (s2fmp3 == -12345678901.0)) | |
196 | {setverdict(pass);} | |
197 | else {setverdict(fail);} | |
198 | if ((s2fmp4 == str2float(s2fmp4_str)) | |
199 | and (s2fmp4 == 1234.0)) | |
200 | {setverdict(pass);} | |
201 | else {setverdict(fail);} | |
202 | if ((s2fmp5 == str2float(s2fmp5_str)) | |
203 | and (s2fmp5 == 1.234)) | |
204 | {setverdict(pass);} | |
205 | else {setverdict(fail);} | |
206 | if ((s2fmp6 == str2float(s2fmp6_str)) | |
207 | and (s2fmp6 == 1.0)) | |
208 | {setverdict(pass);} | |
209 | else {setverdict(fail);} | |
210 | ||
211 | if ((s2fmp7 == str2float(s2fmp7_str)) and (s2fmp7 == 1.0)) | |
212 | {setverdict(pass);} | |
213 | else {setverdict(fail);} | |
214 | if ((s2fmp7m == str2float(s2fmp7m_str)) and (s2fmp7m==-1.0)) | |
215 | {setverdict(pass);} | |
216 | else {setverdict(fail);} | |
217 | if ((s2fmp8m == str2float(s2fmp8m_str)) and (s2fmp8m==-1.0)) | |
218 | {setverdict(pass);} | |
219 | else {setverdict(fail);} | |
220 | if ((s2fmp8 == str2float(s2fmp8_str)) and (s2fmp8 == 1.0)) | |
221 | {setverdict(pass);} | |
222 | else {setverdict(fail);} | |
223 | if ((s2fmp9 == str2float(s2fmp9_str)) and (s2fmp9 == 1.0)) | |
224 | {setverdict(pass);} | |
225 | else {setverdict(fail);} | |
226 | if ((s2fmp10 == str2float(s2fmp10_str)) and (s2fmp10== 1.0)) | |
227 | {setverdict(pass);} | |
228 | else {setverdict(fail);} | |
229 | if ((s2fmp11 == str2float(s2fmp11_str)) and (s2fmp11==-0.0)) | |
230 | {setverdict(pass);} | |
231 | else {setverdict(fail);} | |
232 | if ((s2fmp12 == str2float(s2fmp12_str)) and (s2fmp12== 0.0)) | |
233 | {setverdict(pass);} | |
234 | else {setverdict(fail);} | |
235 | if ((s2fmp13 == str2float(s2fmp13_str)) and (s2fmp13== 0.0)) | |
236 | {setverdict(pass);} | |
237 | else {setverdict(fail);} | |
238 | */ | |
239 | } | |
240 | ||
241 | ||
242 | /*--- STR2HEX --------------------------------------------------*/ | |
243 | ||
244 | const hexstring s2hcon := str2hex("") | |
245 | const hexstring s2hcon1 := str2hex("000000" & "" & "111111") | |
246 | const hexstring s2hcon2 := str2hex(substr("000000111111",0,6) & "" & substr("000000111111",6,6)) | |
247 | const hexstring s2hcon3 := str2hex(("000000" <@ lengthof(s2hcon2)/2) & "" & ("111111" @> lengthof(s2hcon2)/2)) | |
248 | ||
249 | testcase str_to_hex() runs on PDTestComponent{ //In testcase definition// | |
250 | ||
251 | ||
252 | if ((s2hcon == str2hex("")) | |
253 | and (s2hcon == ''H)) | |
254 | {setverdict(pass);} | |
255 | else {setverdict(fail);} //^In else statement// \ | |
256 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
257 | ||
258 | if ((s2hcon1 == str2hex("000000" & "" & "111111")) | |
259 | and (s2hcon1 == '000000111111'H)) | |
260 | {setverdict(pass);} | |
261 | else {setverdict(fail);} //^In else statement// \ | |
262 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
263 | ||
264 | if ((s2hcon2 == str2hex(substr("000000111111",0,6) & "" & substr("000000111111",6,6))) | |
265 | and (s2hcon2 == '000000111111'H)) | |
266 | {setverdict(pass);} | |
267 | else {setverdict(fail);} //^In else statement// \ | |
268 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
269 | ||
270 | if ((s2hcon3 == str2hex(("000000" <@ lengthof(s2hcon2)/2) & "" & ("111111" @> lengthof(s2hcon2)/2))) | |
271 | and (s2hcon3 == '000000111111'H)) | |
272 | {setverdict(pass);} | |
273 | else {setverdict(fail);} //^In else statement// \ | |
274 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
275 | } | |
276 | ||
277 | /*--- STR2INT --------------------------------------------------*/ | |
278 | ||
279 | const integer s2icon := str2int("0") | |
280 | const integer s2icon1 := str2int("" & "1234567890") | |
281 | const integer s2icon2 := str2int("12" & "34567890") | |
282 | const integer s2icon3 := str2int("0000000000000000000000" & "1234567890") //^In constant definition// \ | |
283 | //^In the operand of operation `str2int\(\)'// \ | |
284 | //^warning: Leading zero digit was detected and ignored in the operand of operation \`str2int\(\)\'// | |
285 | const integer s2icon4 := str2int("-12" & "34567890") | |
286 | //const integer s2icon5 := str2int("12ap") | |
287 | const integer s2icon5 := str2int("12") | |
288 | //const integer s2icon6 := str2int("ap") | |
289 | const integer s2icon6 := str2int("1234567891011121314151617181920") | |
290 | const integer s2icon7 := str2int("-1234567891011121314151617181920") | |
291 | const integer s2icon8 := str2int("+1"); | |
292 | const integer s2icon9 := str2int("01"); //^In constant definition// \ | |
293 | //^In the operand of operation `str2int\(\)'// \ | |
294 | //^warning: Leading zero digit was detected and ignored in the operand of operation \`str2int\(\)\'// | |
295 | const integer s2icon10 := str2int("+01"); //^In constant definition// \ | |
296 | //^In the operand of operation `str2int\(\)'// \ | |
297 | //^warning: Leading zero digit was detected and ignored in the operand of operation \`str2int\(\)\'// | |
298 | const integer s2icon11 := str2int("-01"); //^In constant definition// \ | |
299 | //^In the operand of operation `str2int\(\)'// \ | |
300 | //^warning: Leading zero digit was detected and ignored in the operand of operation \`str2int\(\)\'// | |
301 | ||
302 | testcase str_to_int() runs on PDTestComponent{ //In testcase definition// | |
303 | if ((s2icon == str2int("0")) | |
304 | and (s2icon == 0)) | |
305 | {setverdict(pass);} | |
306 | else {setverdict(fail);} //^In else statement// \ | |
307 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
308 | if ((s2icon8 == str2int("+1")) | |
309 | and (s2icon8 == 1)) | |
310 | {setverdict(pass);} | |
311 | else {setverdict(fail);} //^In else statement// \ | |
312 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
313 | if ((s2icon9 == str2int("01")) //^In if statement// \ | |
314 | //In the left operand of operation `and'// \ | |
315 | //In the right operand of operation `=='// \ | |
316 | //In the operand of operation \`str2int\(\)\'// \ | |
317 | //^warning: Leading zero digit was detected and ignored in the operand of operation `str2int\(\)'// | |
318 | and (s2icon9 == 1)) | |
319 | {setverdict(pass);} | |
320 | else {setverdict(fail);} //^In else statement// \ | |
321 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
322 | if ((s2icon10 == str2int("+01")) //^In if statement// \ | |
323 | //In the left operand of operation `and'// \ | |
324 | //In the right operand of operation `=='// \ | |
325 | //In the operand of operation \`str2int\(\)\'// \ | |
326 | //^warning: Leading zero digit was detected and ignored in the operand of operation `str2int\(\)'// | |
327 | and (s2icon10 == 1)) | |
328 | {setverdict(pass);} | |
329 | else {setverdict(fail);} //^In else statement// \ | |
330 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
331 | if ((s2icon11 == str2int("-01")) //^In if statement// \ | |
332 | //In the left operand of operation `and'// \ | |
333 | //In the right operand of operation `=='// \ | |
334 | //In the operand of operation \`str2int\(\)\'// \ | |
335 | //^warning: Leading zero digit was detected and ignored in the operand of operation `str2int\(\)'// | |
336 | and (s2icon11 == -1)) | |
337 | {setverdict(pass);} | |
338 | else {setverdict(fail);} //^In else statement// \ | |
339 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
340 | if ((s2icon1 == str2int("" & "1234567890")) | |
341 | and (s2icon1 == 1234567890)) | |
342 | {setverdict(pass);} | |
343 | else {setverdict(fail);} //^In else statement// \ | |
344 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
345 | if ((s2icon2 == str2int("12" & "34567890")) | |
346 | and (s2icon2 == 1234567890)) | |
347 | {setverdict(pass);} | |
348 | else {setverdict(fail);} //^In else statement// \ | |
349 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
350 | if ((s2icon3 == str2int("00000000000000000000000" & "1234567890")) //^In if statement// \ | |
351 | //In the left operand of operation `and'// \ | |
352 | //In the right operand of operation `=='// \ | |
353 | //In the operand of operation \`str2int\(\)\'// \ | |
354 | //^warning: Leading zero digit was detected and ignored in the operand of operation `str2int\(\)'// | |
355 | and (s2icon3 == 1234567890)) | |
356 | {setverdict(pass);} | |
357 | else {setverdict(fail);} //^In else statement// \ | |
358 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
359 | if ((s2icon4 == str2int("-12" & "34567890")) | |
360 | and (s2icon4 == -1234567890)) | |
361 | {setverdict(pass);} | |
362 | else {setverdict(fail);} //^In else statement// \ | |
363 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
364 | if ((s2icon5 == str2int("12")) | |
365 | and (s2icon5 == 12)) | |
366 | {setverdict(pass);} | |
367 | else {setverdict(fail);} //^In else statement// \ | |
368 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
369 | /* TODO move to error ttcn | |
370 | if ((s2icon6 == str2int("ap")) | |
371 | and (s2icon6 == 0)) | |
372 | {setverdict(pass);} | |
373 | else {setverdict(fail);} | |
374 | */ | |
375 | // Compile time evaluation. (Positive/negative.) | |
376 | if ((str2int("1234567891011121314151617181920") == s2icon6) | |
377 | and (s2icon6 == str2int("1234567891011121314151617181920"))) | |
378 | {setverdict(pass);} | |
379 | else {setverdict(fail);} //^In else statement// \ | |
380 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
381 | if ((str2int("-1234567891011121314151617181920") == s2icon7) | |
382 | and (s2icon7 == str2int("-1234567891011121314151617181920"))) | |
383 | {setverdict(pass);} | |
384 | else {setverdict(fail);} //^In else statement// \ | |
385 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
386 | if ((int2str(str2int("1234567891011121314151617181920")) == "1234567891011121314151617181920") | |
387 | and ("1234567891011121314151617181920" == int2str(str2int("1234567891011121314151617181920")))) | |
388 | {setverdict(pass);} | |
389 | else {setverdict(fail);} //^In else statement// \ | |
390 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
391 | if ((int2str(str2int("-1234567891011121314151617181920")) == "-1234567891011121314151617181920") | |
392 | and ("-1234567891011121314151617181920" == int2str(str2int("-1234567891011121314151617181920")))) | |
393 | {setverdict(pass);} | |
394 | else {setverdict(fail);} //^In else statement// \ | |
395 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
396 | if ((str2int("1234567891011121314151617181920") - 10 == s2icon6 - 10) | |
397 | and (s2icon6 + 10 == str2int("1234567891011121314151617181920") + 10)) | |
398 | {setverdict(pass);} | |
399 | else {setverdict(fail);} //^In else statement// \ | |
400 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
401 | if ((str2int("-1234567891011121314151617181920") + 10 == s2icon7 + 10) | |
402 | and (s2icon7 - 10 == str2int("-1234567891011121314151617181920") - 10)) | |
403 | {setverdict(pass);} | |
404 | else {setverdict(fail);} //^In else statement// \ | |
405 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
406 | } | |
407 | ||
408 | ||
409 | /*--- STR2OCT --------------------------------------------------*/ | |
410 | ||
411 | const octetstring s2ocon := str2oct("") | |
412 | const octetstring s2ocon1 := str2oct("000000" & "" & "111111") | |
413 | const octetstring s2ocon2 := str2oct(substr("000000111111",0,6) & "" & substr("000000111111",6,6)) | |
414 | const octetstring s2ocon3 := str2oct(("000000" <@ lengthof(s2ocon2)/2) & "" & ("111111" @> lengthof(s2ocon2)/2)) | |
415 | ||
416 | testcase str_to_oct() runs on PDTestComponent{ //In testcase definition// | |
417 | ||
418 | ||
419 | if ((s2ocon == str2oct("")) | |
420 | and (s2ocon == ''O)) | |
421 | {setverdict(pass);} | |
422 | else {setverdict(fail);} //^In else statement// \ | |
423 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
424 | ||
425 | if ((s2ocon1 == str2oct("000000" & "" & "111111")) | |
426 | and (s2ocon1 == '000000111111'O)) | |
427 | {setverdict(pass);} | |
428 | else {setverdict(fail);} //^In else statement// \ | |
429 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
430 | ||
431 | if ((s2ocon2 == str2oct(substr("000000111111",0,6) & "" & substr("000000111111",6,6))) | |
432 | and (s2ocon2 == '000000111111'O)) | |
433 | {setverdict(pass);} | |
434 | else {setverdict(fail);} //^In else statement// \ | |
435 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
436 | ||
437 | if ((s2ocon3 == str2oct(("000000" <@ lengthof(s2ocon2)/2) & "" & ("111111" @> lengthof(s2ocon2)/2))) | |
438 | and (s2ocon3 == '000000111111'O)) | |
439 | {setverdict(pass);} | |
440 | else {setverdict(fail);} //^In else statement// \ | |
441 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
442 | } | |
443 | ||
444 | ||
445 | control { | |
446 | execute (str_to_bit()); | |
447 | execute (str_to_float()); | |
448 | execute (str_to_hex()); | |
449 | execute (str_to_int()); | |
450 | execute (str_to_oct()); | |
451 | } | |
452 | ||
453 | } |