|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32math.h> |
|
22 #include <stdlib.h> |
|
23 #include <math.h> |
|
24 #include "tdouble_blr.h" |
|
25 |
|
26 CTestDouble_blr::~CTestDouble_blr() |
|
27 { |
|
28 } |
|
29 |
|
30 CTestDouble_blr::CTestDouble_blr(const TDesC& aStepName) |
|
31 { |
|
32 // MANDATORY Call to base class method to set up the human readable name for logging. |
|
33 iParamCnt=0; |
|
34 SetTestStepName(aStepName); |
|
35 } |
|
36 |
|
37 TVerdict CTestDouble_blr::doTestStepPreambleL() |
|
38 { |
|
39 __UHEAP_MARK; |
|
40 SetTestStepResult(EPass); |
|
41 return TestStepResult(); |
|
42 } |
|
43 |
|
44 |
|
45 TVerdict CTestDouble_blr::doTestStepPostambleL() |
|
46 { |
|
47 __UHEAP_MARKEND; |
|
48 return TestStepResult(); |
|
49 } |
|
50 |
|
51 TVerdict CTestDouble_blr::doTestStepL() |
|
52 { |
|
53 int err; |
|
54 if(TestStepName() == Kcbrt_test) |
|
55 { |
|
56 INFO_PRINTF1(_L("cbrt_test():")); |
|
57 err = cbrt_test(); |
|
58 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
59 } |
|
60 else if(TestStepName() == Kceil_test) |
|
61 { |
|
62 INFO_PRINTF1(_L("ceil_test():")); |
|
63 err = ceil_test(); |
|
64 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
65 } |
|
66 else if(TestStepName() == Kerf_test) |
|
67 { |
|
68 INFO_PRINTF1(_L("erf_test():")); |
|
69 err = erf_test(); |
|
70 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
71 } |
|
72 else if(TestStepName() == Kerfc_test) |
|
73 { |
|
74 INFO_PRINTF1(_L("erfc_test():")); |
|
75 err = erfc_test(); |
|
76 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
77 } |
|
78 else if(TestStepName() == Kexp_test) |
|
79 { |
|
80 INFO_PRINTF1(_L("exp_test():")); |
|
81 err = exp_test(); |
|
82 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
83 } |
|
84 else if(TestStepName() == Kexp2_test) |
|
85 { |
|
86 INFO_PRINTF1(_L("exp2_test():")); |
|
87 err = exp2_test(); |
|
88 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
89 } |
|
90 else if(TestStepName() == Kexpm1_test) |
|
91 { |
|
92 INFO_PRINTF1(_L("expm1_test():")); |
|
93 err = expm1_test(); |
|
94 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
95 } |
|
96 else if(TestStepName() == Kfabs_test) |
|
97 { |
|
98 INFO_PRINTF1(_L("fabs_test():")); |
|
99 err = fabs_test(); |
|
100 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
101 } |
|
102 else if(TestStepName() == Kilogb_test) |
|
103 { |
|
104 INFO_PRINTF1(_L("ilogb_test():")); |
|
105 err = ilogb_test(); |
|
106 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
107 } |
|
108 else if(TestStepName() == Kj0_test) |
|
109 { |
|
110 INFO_PRINTF1(_L("j0_test():")); |
|
111 err = j0_test(); |
|
112 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
113 } |
|
114 else if(TestStepName() == Kj1_test) |
|
115 { |
|
116 INFO_PRINTF1(_L("j1_test():")); |
|
117 err = j1_test(); |
|
118 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
119 } |
|
120 else if(TestStepName() == Klrint_test) |
|
121 { |
|
122 INFO_PRINTF1(_L("lrint_test():")); |
|
123 err = lrint_test(); |
|
124 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
125 } |
|
126 else if(TestStepName() == Kllrint_test) |
|
127 { |
|
128 INFO_PRINTF1(_L("llrint_test():")); |
|
129 err = llrint_test(); |
|
130 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
131 } |
|
132 else if(TestStepName() == Klog_test) |
|
133 { |
|
134 INFO_PRINTF1(_L("log_test():")); |
|
135 err = log_test(); |
|
136 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
137 } |
|
138 else if(TestStepName() == Klog10_test) |
|
139 { |
|
140 INFO_PRINTF1(_L("log10_test():")); |
|
141 err = log10_test(); |
|
142 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
143 } |
|
144 else if(TestStepName() == Klog1p_test) |
|
145 { |
|
146 INFO_PRINTF1(_L("log1p_test():")); |
|
147 err = log1p_test(); |
|
148 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
149 } |
|
150 else if(TestStepName() == Klogb_test) |
|
151 { |
|
152 INFO_PRINTF1(_L("logb_test():")); |
|
153 err = logb_test(); |
|
154 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
155 } |
|
156 else if(TestStepName() == Klround_test) |
|
157 { |
|
158 INFO_PRINTF1(_L("lround_test():")); |
|
159 err = lround_test(); |
|
160 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
161 } |
|
162 else if(TestStepName() == Kllround_test) |
|
163 { |
|
164 INFO_PRINTF1(_L("llround_test():")); |
|
165 err = llround_test(); |
|
166 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
167 } |
|
168 else if(TestStepName() == Krint_test) |
|
169 { |
|
170 INFO_PRINTF1(_L("rint_test():")); |
|
171 err = rint_test(); |
|
172 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
173 } |
|
174 else if(TestStepName() == Ksqrt_test) |
|
175 { |
|
176 INFO_PRINTF1(_L("sqrt_test():")); |
|
177 err = sqrt_test(); |
|
178 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
179 } |
|
180 else if(TestStepName() == Ktrunc_test) |
|
181 { |
|
182 INFO_PRINTF1(_L("trunc_test():")); |
|
183 err = trunc_test(); |
|
184 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
185 } |
|
186 else if(TestStepName() == Ky0_test) |
|
187 { |
|
188 INFO_PRINTF1(_L("y0_test():")); |
|
189 err = y0_test(); |
|
190 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
191 } |
|
192 |
|
193 else if(TestStepName() == Ky1_test) |
|
194 { |
|
195 INFO_PRINTF1(_L("y1_test():")); |
|
196 err = y1_test(); |
|
197 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
198 } |
|
199 else if(TestStepName() == Kfloor_test) |
|
200 { |
|
201 INFO_PRINTF1(_L("floor_test():")); |
|
202 err = floor_test(); |
|
203 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
204 } |
|
205 else if(TestStepName() == Ksignificand_test) |
|
206 { |
|
207 INFO_PRINTF1(_L("significand_test():")); |
|
208 err = significand_test(); |
|
209 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
210 } |
|
211 else if(TestStepName() == Knearbyint_test) |
|
212 { |
|
213 INFO_PRINTF1(_L("nearbyint_test():")); |
|
214 err = nearbyint_test(); |
|
215 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
216 } |
|
217 else if(TestStepName() == Kisinf_test) |
|
218 { |
|
219 INFO_PRINTF1(_L("isinf_test():")); |
|
220 err = isinf_test(); |
|
221 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
222 } |
|
223 else if(TestStepName() == Kisnan_test) |
|
224 { |
|
225 INFO_PRINTF1(_L("isnan_test():")); |
|
226 err = isnan_test(); |
|
227 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
228 } |
|
229 else if(TestStepName() == Kfdim_test) |
|
230 { |
|
231 INFO_PRINTF1(_L("fdim_test():")); |
|
232 err = fdim_test(); |
|
233 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
234 } |
|
235 else if(TestStepName() == Kfmax_test) |
|
236 { |
|
237 INFO_PRINTF1(_L("fmax_test():")); |
|
238 err = fmax_test(); |
|
239 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
240 } |
|
241 else if(TestStepName() == Kfmin_test) |
|
242 { |
|
243 INFO_PRINTF1(_L("fmin_test():")); |
|
244 err = fmin_test(); |
|
245 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
246 } |
|
247 else if(TestStepName() == Kfma_test) |
|
248 { |
|
249 INFO_PRINTF1(_L("fma_test():")); |
|
250 err = fma_test(); |
|
251 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
252 } |
|
253 else if(TestStepName() == Kfmod_test) |
|
254 { |
|
255 INFO_PRINTF1(_L("fmod_test():")); |
|
256 err = fmod_test(); |
|
257 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
258 } |
|
259 else if(TestStepName() == Khypot_test) |
|
260 { |
|
261 INFO_PRINTF1(_L("hypot_test():")); |
|
262 err = hypot_test(); |
|
263 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
264 } |
|
265 else if(TestStepName() == Kremainder_test) |
|
266 { |
|
267 INFO_PRINTF1(_L("remainder_test():")); |
|
268 err = remainder_test(); |
|
269 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
270 } |
|
271 else if(TestStepName() == Knexttoward_test) |
|
272 { |
|
273 INFO_PRINTF1(_L("nexttoward_test():")); |
|
274 err = nexttoward_test(); |
|
275 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
276 } |
|
277 else if(TestStepName() == Knextafter_test) |
|
278 { |
|
279 INFO_PRINTF1(_L("nextafter_test():")); |
|
280 err = nextafter_test(); |
|
281 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
282 } |
|
283 else if(TestStepName() == Kcopysign_test) |
|
284 { |
|
285 INFO_PRINTF1(_L("copysign_test():")); |
|
286 err = copysign_test(); |
|
287 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
288 } |
|
289 else if(TestStepName() == Kfjn_test) |
|
290 { |
|
291 INFO_PRINTF1(_L("jn_test():")); |
|
292 err = jn_test(); |
|
293 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
294 } |
|
295 else if(TestStepName() == Kfyn_test) |
|
296 { |
|
297 INFO_PRINTF1(_L("yn_test():")); |
|
298 err = yn_test(); |
|
299 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
300 } |
|
301 else if(TestStepName() == Kscalb_test) |
|
302 { |
|
303 INFO_PRINTF1(_L("scalb_test():")); |
|
304 err = scalb_test(); |
|
305 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
306 } |
|
307 else if(TestStepName() == Kscalbn_test) |
|
308 { |
|
309 INFO_PRINTF1(_L("scalbn_test():")); |
|
310 err = scalbn_test(); |
|
311 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
312 } |
|
313 else if(TestStepName() == Kpow_test) |
|
314 { |
|
315 INFO_PRINTF1(_L("pow_test():")); |
|
316 err = pow_test(); |
|
317 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
318 } |
|
319 else if(TestStepName() == Kacos_test) |
|
320 { |
|
321 INFO_PRINTF1(_L("acos_test():")); |
|
322 err = acos_test(); |
|
323 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
324 } |
|
325 else if(TestStepName() == Kacosh_test) |
|
326 { |
|
327 INFO_PRINTF1(_L("acosh_test():")); |
|
328 err = acosh_test(); |
|
329 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
330 } |
|
331 else if(TestStepName() == Kasin_test) |
|
332 { |
|
333 INFO_PRINTF1(_L("asin_test():")); |
|
334 err = asin_test(); |
|
335 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
336 } |
|
337 else if(TestStepName() == Kasinh_test) |
|
338 { |
|
339 INFO_PRINTF1(_L("asinh_test():")); |
|
340 err = asinh_test(); |
|
341 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
342 } |
|
343 else if(TestStepName() == Katan_test) |
|
344 { |
|
345 INFO_PRINTF1(_L("atan_test():")); |
|
346 err = atan_test(); |
|
347 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
348 } |
|
349 else if(TestStepName() == Katanh_test) |
|
350 { |
|
351 INFO_PRINTF1(_L("atanh_test():")); |
|
352 err = atanh_test(); |
|
353 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
354 } |
|
355 else if(TestStepName() == KCos_test) |
|
356 { |
|
357 INFO_PRINTF1(_L("Cos_test():")); |
|
358 err = Cos_test(); |
|
359 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
360 } |
|
361 else if(TestStepName() == Kcosh_test) |
|
362 { |
|
363 INFO_PRINTF1(_L("cosh_test():")); |
|
364 err = cosh_test(); |
|
365 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
366 } |
|
367 else if(TestStepName() == Ksin_test) |
|
368 { |
|
369 INFO_PRINTF1(_L("sin_test():")); |
|
370 err = sin_test(); |
|
371 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
372 } |
|
373 else if(TestStepName() == Ksinh_test) |
|
374 { |
|
375 INFO_PRINTF1(_L("sinh_test():")); |
|
376 err = sinh_test(); |
|
377 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
378 } |
|
379 else if(TestStepName() == Ktan_test) |
|
380 { |
|
381 INFO_PRINTF1(_L("tan_test():")); |
|
382 err = tan_test(); |
|
383 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
384 } |
|
385 else if(TestStepName() == Ktanh_test) |
|
386 { |
|
387 INFO_PRINTF1(_L("tanh_test():")); |
|
388 err = tanh_test(); |
|
389 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
390 } |
|
391 else if(TestStepName() == Katan2_test) |
|
392 { |
|
393 INFO_PRINTF1(_L("atan2_test():")); |
|
394 err = atan2_test(); |
|
395 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
396 } |
|
397 else if(TestStepName() == Kisnormal_test) |
|
398 { |
|
399 INFO_PRINTF1(_L("isnormal_test():")); |
|
400 err = isnormal_test(); |
|
401 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
402 } |
|
403 else if(TestStepName() == Ksignbit_test) |
|
404 { |
|
405 INFO_PRINTF1(_L("signbit_test():")); |
|
406 err = signbit_test(); |
|
407 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
408 } |
|
409 else if(TestStepName() == Kscalbln_test) |
|
410 { |
|
411 INFO_PRINTF1(_L("scalbln_test():")); |
|
412 err = scalbln_test(); |
|
413 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
414 } |
|
415 else if(TestStepName() == Kfinite_test) |
|
416 { |
|
417 INFO_PRINTF1(_L("finite_test():")); |
|
418 err = finite_test(); |
|
419 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
420 } |
|
421 else if(TestStepName() == Kmodf_test) |
|
422 { |
|
423 INFO_PRINTF1(_L("modf_test():")); |
|
424 err = modf_test(); |
|
425 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
426 } |
|
427 else if(TestStepName() == Kldexp_test) |
|
428 { |
|
429 INFO_PRINTF1(_L("ldexp_test():")); |
|
430 err = ldexp_test(); |
|
431 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
432 } |
|
433 else if(TestStepName() == Kdrem_test) |
|
434 { |
|
435 INFO_PRINTF1(_L("drem_test():")); |
|
436 err = drem_test(); |
|
437 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
438 } |
|
439 else if(TestStepName() == Kfrexp_test) |
|
440 { |
|
441 INFO_PRINTF1(_L("frexp_test():")); |
|
442 err = frexp_test(); |
|
443 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
444 } |
|
445 else if(TestStepName() == Kremquo_test) |
|
446 { |
|
447 INFO_PRINTF1(_L("remquo_test():")); |
|
448 err = remquo_test(); |
|
449 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
450 } |
|
451 else if(TestStepName() == Kremquo_remcheck_test) |
|
452 { |
|
453 INFO_PRINTF1(_L("remquo_remcheck_test():")); |
|
454 err = remquo_remcheck_test(); |
|
455 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
456 } |
|
457 else if(TestStepName() == Kgamma_test) |
|
458 { |
|
459 INFO_PRINTF1(_L("gamma_test():")); |
|
460 err = gamma_test(); |
|
461 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
462 } |
|
463 else if(TestStepName() == Klgamma_test) |
|
464 { |
|
465 INFO_PRINTF1(_L("lgamma_test():")); |
|
466 err = lgamma_test(); |
|
467 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
468 } |
|
469 else if(TestStepName() == Kfpclassify_test) |
|
470 { |
|
471 INFO_PRINTF1(_L("fpclassify_test():")); |
|
472 err = fpclassify_test(); |
|
473 SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass); |
|
474 } |
|
475 return TestStepResult(); |
|
476 } |
|
477 |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // Utility functions for testing. |
|
481 // ----------------------------------------------------------------------------- |
|
482 |
|
483 void CTestDouble_blr::ReadIntParam(TInt &aInt) |
|
484 { |
|
485 _LIT( Kparam, "Param%d" ); |
|
486 TBuf<8> pNameBuf; |
|
487 TPtrC string; |
|
488 pNameBuf.Format(Kparam,++iParamCnt); |
|
489 TBool res = GetIntFromConfig(ConfigSection(), pNameBuf, aInt); |
|
490 } |
|
491 |
|
492 void CTestDouble_blr::ReadFloatParam(FLOAT &aDbl) |
|
493 { |
|
494 char Str[MAX_SIZE]; |
|
495 double d; |
|
496 ReadStringParam(Str); |
|
497 #ifdef TESTING_FLOAT |
|
498 d = strtod(Str,NULL); |
|
499 #else |
|
500 d = strtod(Str,NULL); |
|
501 #endif |
|
502 aDbl = d; |
|
503 } |
|
504 |
|
505 |
|
506 void CTestDouble_blr::ReadStringParam(char* aString) |
|
507 { |
|
508 _LIT( Kparam, "Param%d" ); |
|
509 TBuf<100> pNameBuf; |
|
510 TPtrC descriptor; |
|
511 TInt i; |
|
512 |
|
513 pNameBuf.Format(Kparam,++iParamCnt); |
|
514 TBool ret = GetStringFromConfig(ConfigSection(), pNameBuf, descriptor); |
|
515 |
|
516 if ( descriptor == _L("\"\"") ) |
|
517 { |
|
518 i = 0; |
|
519 } |
|
520 else |
|
521 { |
|
522 // If the string is quoted, take only the insides |
|
523 if ((descriptor[0] == '\"') && (descriptor[descriptor.Length()-1] == '\"')) |
|
524 { |
|
525 for ( i=0; i<descriptor.Length()-2; i++ ) |
|
526 { |
|
527 aString[i]=descriptor[i+1]; |
|
528 } |
|
529 } |
|
530 // Otherwise, take the whole string |
|
531 else |
|
532 { |
|
533 for ( i=0; i<descriptor.Length(); i++ ) |
|
534 { |
|
535 aString[i]=descriptor[i]; |
|
536 } |
|
537 } |
|
538 aString[i]='\0'; |
|
539 } |
|
540 |
|
541 |
|
542 } |
|
543 |
|
544 void CTestDouble_blr::ReadLIntParam(TInt32 &aLInt) |
|
545 { |
|
546 char Str[MAX_SIZE]; |
|
547 TInt32 d; |
|
548 ReadStringParam( Str); |
|
549 /* Strtol converts the initial part of the |
|
550 string into long integer value according to the |
|
551 give base [Third arg]*/ |
|
552 |
|
553 d = strtol(Str,NULL, 10); |
|
554 aLInt = d; |
|
555 } |
|
556 |
|
557 void CTestDouble_blr::ReadLLIntParam(TInt64 &aLInt) |
|
558 { |
|
559 char Str[MAX_SIZE]; |
|
560 TInt64 d; /*long long int*/ |
|
561 ReadStringParam( Str); |
|
562 /* Strtoll converts the initial part of the |
|
563 string into long long integer value according to the |
|
564 give base [Third arg]*/ |
|
565 |
|
566 d = strtoll(Str,NULL, 10); |
|
567 aLInt = d; |
|
568 } |
|
569 // ----------------------------------------------------------------------------- |
|
570 // Test methods |
|
571 // ----------------------------------------------------------------------------- |
|
572 // |
|
573 int CTestDouble_blr::check_bool (int computed, int expected) |
|
574 { |
|
575 int ok = 0; |
|
576 |
|
577 if ((computed == 0) == (expected == 0)) |
|
578 { |
|
579 ok = 1; |
|
580 } |
|
581 return ok; |
|
582 } |
|
583 |
|
584 int CTestDouble_blr::check_int (int computed, int expected, int max_ulp) |
|
585 { |
|
586 int diff = computed - expected; |
|
587 int ok = 0; |
|
588 |
|
589 if (abs (diff) <= max_ulp) |
|
590 { |
|
591 ok = 1; |
|
592 } |
|
593 return ok; |
|
594 } |
|
595 |
|
596 int CTestDouble_blr::check_float (FLOAT computed, FLOAT expected,FLOAT max_ulp, FLOAT &gen_ulp) |
|
597 { |
|
598 int ok = 0; |
|
599 FLOAT diff = 0; |
|
600 FLOAT ulp = 0; |
|
601 |
|
602 if (isnan (computed) && isnan (expected)) |
|
603 { |
|
604 ok = 1; |
|
605 } |
|
606 else if (isinf (computed) && isinf (expected)) |
|
607 { |
|
608 // Test for sign of infinities. |
|
609 if ((IGNORE_ZERO_INF_SIGN) == 0 |
|
610 && signbit (computed) != signbit (expected)) |
|
611 { |
|
612 ok = 0; |
|
613 } |
|
614 else |
|
615 { |
|
616 ok = 1; |
|
617 } |
|
618 } |
|
619 // Don't calc ulp for NaNs or infinities. |
|
620 else if (isinf (computed) || isnan (computed) || isinf (expected) || isnan (expected)) |
|
621 { |
|
622 ok = 0; |
|
623 } |
|
624 else |
|
625 { |
|
626 diff = FUNC(fabs) (computed - expected); |
|
627 // ilogb (0) isn't allowed. |
|
628 if (expected == 0.0) |
|
629 { |
|
630 ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG); |
|
631 } |
|
632 else |
|
633 { |
|
634 ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG); |
|
635 } |
|
636 |
|
637 if ((IGNORE_ZERO_INF_SIGN) == 0 |
|
638 && computed == 0.0 && expected == 0.0 |
|
639 && signbit(computed) != signbit (expected)) |
|
640 { |
|
641 ok = 0; |
|
642 } |
|
643 else if (ulp == 0.0 || (ulp <= max_ulp )) |
|
644 { |
|
645 ok = 1; |
|
646 } |
|
647 else |
|
648 { |
|
649 ok = 0; |
|
650 } |
|
651 |
|
652 } |
|
653 gen_ulp = ulp ; |
|
654 |
|
655 return ok; |
|
656 } |
|
657 |
|
658 int CTestDouble_blr::check_longlong (TInt64 computed, TInt64 expected, FLOAT max_ulp, FLOAT &gen_ulp) |
|
659 { |
|
660 long long int diff = computed - expected; |
|
661 int ok = 0; |
|
662 |
|
663 |
|
664 if ( (gen_ulp = llabs (diff)) <= max_ulp) |
|
665 { |
|
666 ok = 1; |
|
667 } |
|
668 return ok; |
|
669 } |
|
670 |
|
671 int CTestDouble_blr::check_long (TInt32 computed, TInt32 expected, FLOAT max_ulp, FLOAT &gen_ulp) |
|
672 { |
|
673 long int diff = computed - expected; |
|
674 int ok = 0; |
|
675 |
|
676 if ((gen_ulp =labs (diff)) <= max_ulp) |
|
677 { |
|
678 ok = 1; |
|
679 } |
|
680 |
|
681 return ok; |
|
682 } |
|
683 |
|
684 TInt CTestDouble_blr::cbrt_test() |
|
685 { |
|
686 // Create temporary variables in stack |
|
687 char chParam[MAX_SIZE]; |
|
688 FLOAT input; |
|
689 FLOAT expected; |
|
690 FLOAT max_ulp; |
|
691 FLOAT gen_ulp; |
|
692 |
|
693 // Read parameters |
|
694 |
|
695 ReadStringParam (chParam); |
|
696 ReadFloatParam (input); |
|
697 ReadFloatParam (expected); |
|
698 ReadFloatParam (max_ulp); |
|
699 |
|
700 // |
|
701 TBuf<MAX_SIZE> buf; |
|
702 TInt len = strlen(chParam); |
|
703 |
|
704 for (TInt j =0; j<len;j++) |
|
705 { |
|
706 buf.Append(chParam[j]); |
|
707 } |
|
708 |
|
709 // Do some testing |
|
710 FLOAT res = FUNC(cbrt) (input); |
|
711 |
|
712 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
713 { |
|
714 INFO_PRINTF1(_L("Test passed.")); |
|
715 } |
|
716 else |
|
717 { |
|
718 ERR_PRINTF1(_L("Test Failed.")); |
|
719 return KErrGeneral; |
|
720 } |
|
721 |
|
722 INFO_PRINTF1(_L("_________________________________________\n")); |
|
723 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
724 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
725 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
726 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
727 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
728 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
729 INFO_PRINTF1(_L("_________________________________________\n")); |
|
730 |
|
731 return KErrNone; |
|
732 } |
|
733 |
|
734 |
|
735 |
|
736 TInt CTestDouble_blr::ceil_test() |
|
737 { |
|
738 // Create temporary variables in stack |
|
739 char chParam[MAX_SIZE]; |
|
740 FLOAT input; |
|
741 FLOAT expected; |
|
742 FLOAT max_ulp; |
|
743 FLOAT gen_ulp; |
|
744 |
|
745 // Read parameters |
|
746 |
|
747 ReadStringParam (chParam); |
|
748 ReadFloatParam (input); |
|
749 ReadFloatParam (expected); |
|
750 ReadFloatParam (max_ulp); |
|
751 // |
|
752 TBuf<MAX_SIZE> buf; |
|
753 TInt len = strlen(chParam); |
|
754 |
|
755 for (TInt j =0; j<len;j++) |
|
756 { |
|
757 buf.Append(chParam[j]); |
|
758 } |
|
759 |
|
760 // Do some testing |
|
761 FLOAT res = FUNC(ceil) (input); |
|
762 |
|
763 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
764 { |
|
765 INFO_PRINTF1(_L("Test passed.")); |
|
766 } |
|
767 else |
|
768 { |
|
769 ERR_PRINTF1(_L("Test Failed.")); |
|
770 return KErrGeneral; |
|
771 } |
|
772 |
|
773 INFO_PRINTF1(_L("_________________________________________\n")); |
|
774 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
775 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
776 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
777 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
778 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
779 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
780 INFO_PRINTF1(_L("_________________________________________\n")); |
|
781 |
|
782 return KErrNone; |
|
783 } |
|
784 |
|
785 |
|
786 TInt CTestDouble_blr::erf_test() |
|
787 { |
|
788 // Create temporary variables in stack |
|
789 char chParam[MAX_SIZE]; |
|
790 FLOAT input; |
|
791 FLOAT expected; |
|
792 FLOAT max_ulp; |
|
793 FLOAT gen_ulp; |
|
794 |
|
795 // Read parameters |
|
796 |
|
797 ReadStringParam (chParam); |
|
798 ReadFloatParam (input); |
|
799 ReadFloatParam (expected); |
|
800 ReadFloatParam (max_ulp); |
|
801 // |
|
802 TBuf<MAX_SIZE> buf; |
|
803 TInt len = strlen(chParam); |
|
804 |
|
805 for (TInt j =0; j<len;j++) |
|
806 buf.Append(chParam[j]); |
|
807 // Do some testing |
|
808 FLOAT res = FUNC(erf) (input); |
|
809 |
|
810 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
811 { |
|
812 INFO_PRINTF1(_L("Test passed.")); |
|
813 } |
|
814 else |
|
815 { |
|
816 ERR_PRINTF1(_L("Test Failed.")); |
|
817 return KErrGeneral; |
|
818 } |
|
819 |
|
820 |
|
821 INFO_PRINTF1(_L("_________________________________________\n")); |
|
822 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
823 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
824 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
825 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
826 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
827 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
828 INFO_PRINTF1(_L("_________________________________________\n")); |
|
829 |
|
830 return KErrNone; |
|
831 } |
|
832 |
|
833 TInt CTestDouble_blr::erfc_test() |
|
834 { |
|
835 // Create temporary variables in stack |
|
836 char chParam[MAX_SIZE]; |
|
837 FLOAT input; |
|
838 FLOAT expected; |
|
839 FLOAT max_ulp; |
|
840 FLOAT gen_ulp; |
|
841 |
|
842 // Read parameters |
|
843 ReadStringParam (chParam); |
|
844 ReadFloatParam (input); |
|
845 ReadFloatParam (expected); |
|
846 ReadFloatParam (max_ulp); |
|
847 // |
|
848 TBuf<MAX_SIZE> buf; |
|
849 TInt len = strlen(chParam); |
|
850 |
|
851 for (TInt j =0; j<len;j++) |
|
852 { |
|
853 buf.Append(chParam[j]); |
|
854 } |
|
855 |
|
856 // Do some testing |
|
857 FLOAT res = FUNC(erfc) (input); |
|
858 |
|
859 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
860 { |
|
861 INFO_PRINTF1(_L("Test passed.")); |
|
862 } |
|
863 else |
|
864 { |
|
865 ERR_PRINTF1(_L("Test Failed.")); |
|
866 return KErrGeneral; |
|
867 } |
|
868 |
|
869 INFO_PRINTF1(_L("_________________________________________\n")); |
|
870 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
871 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
872 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
873 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
874 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
875 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
876 INFO_PRINTF1(_L("_________________________________________\n")); |
|
877 |
|
878 return KErrNone; |
|
879 } |
|
880 |
|
881 TInt CTestDouble_blr::exp_test() |
|
882 { |
|
883 // Create temporary variables in stack |
|
884 char chParam[MAX_SIZE]; |
|
885 FLOAT input; |
|
886 FLOAT expected; |
|
887 FLOAT max_ulp; |
|
888 FLOAT gen_ulp; |
|
889 |
|
890 // Read parameters |
|
891 |
|
892 ReadStringParam (chParam); |
|
893 ReadFloatParam (input); |
|
894 ReadFloatParam (expected); |
|
895 ReadFloatParam (max_ulp); |
|
896 // |
|
897 TBuf<MAX_SIZE> buf; |
|
898 TInt len = strlen(chParam); |
|
899 |
|
900 for (TInt j =0; j<len;j++) |
|
901 { |
|
902 buf.Append(chParam[j]); |
|
903 } |
|
904 |
|
905 // Do some testing |
|
906 FLOAT res = FUNC(exp) (input); |
|
907 |
|
908 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
909 { |
|
910 INFO_PRINTF1(_L("Test passed.")); |
|
911 } |
|
912 else |
|
913 { |
|
914 ERR_PRINTF1(_L("Test Failed.")); |
|
915 return KErrGeneral; |
|
916 } |
|
917 |
|
918 INFO_PRINTF1(_L("_________________________________________\n")); |
|
919 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
920 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
921 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
922 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
923 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
924 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
925 INFO_PRINTF1(_L("_________________________________________\n")); |
|
926 |
|
927 return KErrNone; |
|
928 } |
|
929 |
|
930 |
|
931 TInt CTestDouble_blr::exp2_test() |
|
932 { |
|
933 // Create temporary variables in stack |
|
934 char chParam[MAX_SIZE]; |
|
935 FLOAT input; |
|
936 FLOAT expected; |
|
937 FLOAT max_ulp; |
|
938 FLOAT gen_ulp; |
|
939 |
|
940 // Read parameters |
|
941 |
|
942 ReadStringParam (chParam); |
|
943 ReadFloatParam (input); |
|
944 ReadFloatParam (expected); |
|
945 ReadFloatParam (max_ulp); |
|
946 // |
|
947 TBuf<MAX_SIZE> buf; |
|
948 TInt len = strlen(chParam); |
|
949 |
|
950 for (TInt j =0; j<len;j++) |
|
951 { |
|
952 buf.Append(chParam[j]); |
|
953 } |
|
954 // Do some testing |
|
955 FLOAT res = FUNC(exp2) (input); |
|
956 |
|
957 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
958 { |
|
959 INFO_PRINTF1(_L("Test passed.")); |
|
960 } |
|
961 else |
|
962 { |
|
963 ERR_PRINTF1(_L("Test Failed.")); |
|
964 return KErrGeneral; |
|
965 } |
|
966 |
|
967 INFO_PRINTF1(_L("_________________________________________\n")); |
|
968 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
969 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
970 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
971 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
972 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
973 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
974 INFO_PRINTF1(_L("_________________________________________\n")); |
|
975 |
|
976 return KErrNone; |
|
977 } |
|
978 |
|
979 TInt CTestDouble_blr::expm1_test() |
|
980 { |
|
981 // Create temporary variables in stack |
|
982 char chParam[MAX_SIZE]; |
|
983 FLOAT input; |
|
984 FLOAT expected; |
|
985 FLOAT max_ulp; |
|
986 FLOAT gen_ulp; |
|
987 |
|
988 // Read parameters |
|
989 |
|
990 ReadStringParam (chParam); |
|
991 ReadFloatParam (input); |
|
992 ReadFloatParam (expected); |
|
993 ReadFloatParam (max_ulp); |
|
994 // |
|
995 TBuf<MAX_SIZE> buf; |
|
996 TInt len = strlen(chParam); |
|
997 |
|
998 for (TInt j =0; j<len;j++) |
|
999 { |
|
1000 buf.Append(chParam[j]); |
|
1001 } |
|
1002 // Do some testing |
|
1003 FLOAT res = FUNC(expm1) (input); |
|
1004 |
|
1005 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1006 { |
|
1007 INFO_PRINTF1(_L("Test passed.")); |
|
1008 } |
|
1009 else |
|
1010 { |
|
1011 ERR_PRINTF1(_L("Test Failed.")); |
|
1012 return KErrGeneral; |
|
1013 } |
|
1014 |
|
1015 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1016 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1017 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1018 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1019 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1020 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1021 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1022 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1023 |
|
1024 return KErrNone; |
|
1025 } |
|
1026 |
|
1027 TInt CTestDouble_blr::fabs_test() |
|
1028 { |
|
1029 // Create temporary variables in stack |
|
1030 char chParam[MAX_SIZE]; |
|
1031 FLOAT input; |
|
1032 FLOAT expected; |
|
1033 FLOAT max_ulp; |
|
1034 FLOAT gen_ulp; |
|
1035 |
|
1036 |
|
1037 // Read parameters |
|
1038 |
|
1039 ReadStringParam (chParam); |
|
1040 ReadFloatParam (input); |
|
1041 ReadFloatParam (expected); |
|
1042 ReadFloatParam (max_ulp); |
|
1043 // |
|
1044 TBuf<MAX_SIZE> buf; |
|
1045 TInt len = strlen(chParam); |
|
1046 |
|
1047 for (TInt j =0; j<len;j++) |
|
1048 { |
|
1049 buf.Append(chParam[j]); |
|
1050 } |
|
1051 // Do some testing |
|
1052 FLOAT res = FUNC(fabs) (input); |
|
1053 |
|
1054 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1055 { |
|
1056 INFO_PRINTF1(_L("Test passed.")); |
|
1057 } |
|
1058 else |
|
1059 { |
|
1060 ERR_PRINTF1(_L("Test Failed.")); |
|
1061 return KErrGeneral; |
|
1062 } |
|
1063 |
|
1064 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1065 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1066 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1067 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1068 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1069 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1070 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1071 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1072 |
|
1073 return KErrNone; |
|
1074 } |
|
1075 |
|
1076 |
|
1077 TInt CTestDouble_blr::ilogb_test() |
|
1078 { |
|
1079 // Create temporary variables in stack |
|
1080 char chParam[MAX_SIZE]; |
|
1081 FLOAT input; |
|
1082 FLOAT expected; |
|
1083 FLOAT max_ulp; |
|
1084 FLOAT gen_ulp; |
|
1085 // Read parameters |
|
1086 ReadStringParam (chParam); |
|
1087 ReadFloatParam (input); |
|
1088 ReadFloatParam (expected); |
|
1089 ReadFloatParam (max_ulp); |
|
1090 // |
|
1091 TBuf<MAX_SIZE> buf; |
|
1092 TInt len = strlen(chParam); |
|
1093 |
|
1094 for (TInt j =0; j<len;j++) |
|
1095 { |
|
1096 buf.Append(chParam[j]); |
|
1097 } |
|
1098 // Do some testing |
|
1099 FLOAT res = FUNC(ilogb) (input); |
|
1100 |
|
1101 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1102 { |
|
1103 INFO_PRINTF1(_L("Test passed.")); |
|
1104 } |
|
1105 else |
|
1106 { |
|
1107 ERR_PRINTF1(_L("Test Failed.")); |
|
1108 return KErrGeneral; |
|
1109 } |
|
1110 |
|
1111 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1112 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
1113 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1114 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1115 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1116 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1117 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1118 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1119 return KErrNone; |
|
1120 } |
|
1121 |
|
1122 |
|
1123 TInt CTestDouble_blr::j0_test() |
|
1124 { |
|
1125 // Create temporary variables in stack |
|
1126 char chParam[MAX_SIZE]; |
|
1127 FLOAT input; |
|
1128 FLOAT expected; |
|
1129 FLOAT max_ulp; |
|
1130 FLOAT gen_ulp; |
|
1131 |
|
1132 // Read parameters |
|
1133 |
|
1134 ReadStringParam (chParam); |
|
1135 ReadFloatParam (input); |
|
1136 ReadFloatParam (expected); |
|
1137 ReadFloatParam (max_ulp); |
|
1138 // |
|
1139 TBuf<MAX_SIZE> buf; |
|
1140 TInt len = strlen(chParam); |
|
1141 |
|
1142 for (TInt j =0; j<len;j++) |
|
1143 { |
|
1144 buf.Append(chParam[j]); |
|
1145 } |
|
1146 // Do some testing |
|
1147 FLOAT res = FUNC(j0) (input); |
|
1148 |
|
1149 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1150 { |
|
1151 INFO_PRINTF1(_L("Test passed.")); |
|
1152 } |
|
1153 else |
|
1154 { |
|
1155 ERR_PRINTF1(_L("Test Failed.")); |
|
1156 return KErrGeneral; |
|
1157 } |
|
1158 |
|
1159 |
|
1160 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1161 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1162 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1163 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1164 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1165 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1166 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1167 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1168 |
|
1169 return KErrNone; |
|
1170 } |
|
1171 |
|
1172 |
|
1173 TInt CTestDouble_blr::j1_test() |
|
1174 { |
|
1175 // Create temporary variables in stack |
|
1176 char chParam[MAX_SIZE]; |
|
1177 FLOAT input; |
|
1178 FLOAT expected; |
|
1179 FLOAT max_ulp; |
|
1180 FLOAT gen_ulp; |
|
1181 |
|
1182 |
|
1183 // Read parameters |
|
1184 |
|
1185 ReadStringParam (chParam); |
|
1186 ReadFloatParam (input); |
|
1187 ReadFloatParam (expected); |
|
1188 ReadFloatParam (max_ulp); |
|
1189 // |
|
1190 TBuf<MAX_SIZE> buf; |
|
1191 TInt len = strlen(chParam); |
|
1192 |
|
1193 for (TInt j =0; j<len;j++) |
|
1194 { |
|
1195 buf.Append(chParam[j]); |
|
1196 } |
|
1197 // Do some testing |
|
1198 FLOAT res = FUNC(j1) (input); |
|
1199 |
|
1200 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1201 { |
|
1202 INFO_PRINTF1(_L("Test passed.")); |
|
1203 } |
|
1204 else |
|
1205 { |
|
1206 ERR_PRINTF1(_L("Test Failed.")); |
|
1207 return KErrGeneral; |
|
1208 } |
|
1209 |
|
1210 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1211 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1212 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1213 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1214 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1215 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1216 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1217 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1218 return KErrNone; |
|
1219 } |
|
1220 |
|
1221 TInt CTestDouble_blr::fpclassify_test() |
|
1222 { |
|
1223 // Create temporary variables in stack |
|
1224 char chParam[MAX_SIZE]; |
|
1225 FLOAT input; |
|
1226 int expected; |
|
1227 FLOAT max_ulp; |
|
1228 |
|
1229 // Read parameters |
|
1230 ReadStringParam (chParam ) ; |
|
1231 ReadFloatParam (input ); |
|
1232 ReadIntParam (expected ); |
|
1233 ReadFloatParam (max_ulp ); |
|
1234 // |
|
1235 TBuf<MAX_SIZE> buf; |
|
1236 TInt len = strlen(chParam); |
|
1237 |
|
1238 for (TInt j =0; j<len;j++) |
|
1239 { |
|
1240 buf.Append(chParam[j]); |
|
1241 } |
|
1242 // Do some testing |
|
1243 |
|
1244 // Set test result |
|
1245 int res = __fpclassifyd(input); |
|
1246 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1247 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1248 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1249 INFO_PRINTF2(_L("Expected Value: %d\n"), expected ); |
|
1250 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1251 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1252 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1253 |
|
1254 if(check_int(res, expected, max_ulp)) |
|
1255 { |
|
1256 INFO_PRINTF1(_L("Test passed.")); |
|
1257 } |
|
1258 else |
|
1259 { |
|
1260 ERR_PRINTF1(_L("Test Failed.")); |
|
1261 return KErrGeneral; |
|
1262 } |
|
1263 return KErrNone; |
|
1264 } |
|
1265 |
|
1266 TInt CTestDouble_blr::lrint_test() |
|
1267 { |
|
1268 char chParam[MAX_SIZE]; |
|
1269 FLOAT input; |
|
1270 long int expected; |
|
1271 FLOAT max_ulp; |
|
1272 FLOAT gen_ulp; |
|
1273 // Read parameters |
|
1274 ReadStringParam (chParam); |
|
1275 ReadFloatParam (input); |
|
1276 ReadLIntParam (expected); |
|
1277 ReadFloatParam (max_ulp); |
|
1278 // |
|
1279 TBuf<MAX_SIZE> buf; |
|
1280 buf.Append(chParam[0]) ; |
|
1281 buf.Append(chParam[1]) ; |
|
1282 buf.Append(chParam[2]) ; |
|
1283 buf.Append(chParam[3]) ; |
|
1284 buf.Append(chParam[4]) ; |
|
1285 buf.Append(chParam[5]) ; |
|
1286 buf.Append(chParam[6]) ; |
|
1287 // Do some testing |
|
1288 TInt32 res = FUNC(lrint) (input); |
|
1289 |
|
1290 if(check_long(res, expected, max_ulp, gen_ulp)) |
|
1291 { |
|
1292 INFO_PRINTF1(_L("Test passed.")); |
|
1293 } |
|
1294 else |
|
1295 { |
|
1296 ERR_PRINTF1(_L("Test Failed.")); |
|
1297 return KErrGeneral; |
|
1298 } |
|
1299 |
|
1300 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1301 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1302 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1303 INFO_PRINTF2(_L("Expected Value : %d\n"), expected ); |
|
1304 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1305 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
1306 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1307 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1308 |
|
1309 return KErrNone; |
|
1310 } |
|
1311 |
|
1312 TInt CTestDouble_blr::llrint_test() |
|
1313 { |
|
1314 char chParam[MAX_SIZE]; |
|
1315 FLOAT input; |
|
1316 TInt64 expected; |
|
1317 FLOAT max_ulp; |
|
1318 FLOAT gen_ulp; |
|
1319 |
|
1320 // Read parameters |
|
1321 |
|
1322 ReadStringParam (chParam); |
|
1323 ReadFloatParam (input); |
|
1324 ReadLLIntParam (expected); |
|
1325 ReadFloatParam (max_ulp); |
|
1326 // |
|
1327 TBuf<MAX_SIZE> buf; |
|
1328 TInt len = strlen(chParam); |
|
1329 |
|
1330 for (TInt j =0; j<len;j++) |
|
1331 { |
|
1332 buf.Append(chParam[j]); |
|
1333 } |
|
1334 // Do some testing |
|
1335 TInt64 res = FUNC(llrint) (input); |
|
1336 |
|
1337 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1338 { |
|
1339 INFO_PRINTF1(_L("Test passed.")); |
|
1340 } |
|
1341 else |
|
1342 { |
|
1343 ERR_PRINTF1(_L("Test Failed.")); |
|
1344 return KErrGeneral; |
|
1345 } |
|
1346 |
|
1347 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1348 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1349 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1350 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1351 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1352 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1353 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1354 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1355 return KErrNone; |
|
1356 } |
|
1357 |
|
1358 TInt CTestDouble_blr::log_test() |
|
1359 { |
|
1360 char chParam[MAX_SIZE]; |
|
1361 FLOAT input; |
|
1362 FLOAT expected; |
|
1363 FLOAT max_ulp; |
|
1364 FLOAT gen_ulp; |
|
1365 |
|
1366 // Read parameters |
|
1367 |
|
1368 ReadStringParam (chParam); |
|
1369 ReadFloatParam (input); |
|
1370 ReadFloatParam (expected); |
|
1371 ReadFloatParam (max_ulp); |
|
1372 // |
|
1373 TBuf<MAX_SIZE> buf; |
|
1374 TInt len = strlen(chParam); |
|
1375 |
|
1376 for (TInt j =0; j<len;j++) |
|
1377 { |
|
1378 buf.Append(chParam[j]); |
|
1379 } |
|
1380 // Do some testing |
|
1381 FLOAT res = FUNC(log) (input); |
|
1382 |
|
1383 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1384 { |
|
1385 INFO_PRINTF1(_L("Test passed.")); |
|
1386 } |
|
1387 else |
|
1388 { |
|
1389 ERR_PRINTF1(_L("Test Failed.")); |
|
1390 return KErrGeneral; |
|
1391 } |
|
1392 |
|
1393 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1394 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1395 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1396 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1397 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1398 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1399 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1400 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1401 |
|
1402 return KErrNone; |
|
1403 } |
|
1404 |
|
1405 |
|
1406 TInt CTestDouble_blr::log10_test() |
|
1407 { |
|
1408 char chParam[MAX_SIZE]; |
|
1409 FLOAT input; |
|
1410 FLOAT expected; |
|
1411 FLOAT max_ulp; |
|
1412 FLOAT gen_ulp; |
|
1413 // Read parameters |
|
1414 |
|
1415 ReadStringParam (chParam); |
|
1416 ReadFloatParam (input); |
|
1417 ReadFloatParam (expected); |
|
1418 ReadFloatParam (max_ulp); |
|
1419 // |
|
1420 TBuf<MAX_SIZE> buf; |
|
1421 TInt len = strlen(chParam); |
|
1422 |
|
1423 for (TInt j =0; j<len;j++) |
|
1424 { |
|
1425 buf.Append(chParam[j]); |
|
1426 } |
|
1427 // Do some testing |
|
1428 FLOAT res = FUNC(log10) (input); |
|
1429 |
|
1430 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1431 { |
|
1432 INFO_PRINTF1(_L("Test passed.")); |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 ERR_PRINTF1(_L("Test Failed.")); |
|
1437 return KErrGeneral; |
|
1438 } |
|
1439 |
|
1440 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1441 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1442 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1443 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1444 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1445 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1446 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1447 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1448 |
|
1449 return KErrNone; |
|
1450 } |
|
1451 |
|
1452 TInt CTestDouble_blr::log1p_test() |
|
1453 { |
|
1454 char chParam[MAX_SIZE]; |
|
1455 FLOAT input; |
|
1456 FLOAT expected; |
|
1457 FLOAT max_ulp; |
|
1458 FLOAT gen_ulp; |
|
1459 |
|
1460 // Read parameters |
|
1461 |
|
1462 ReadStringParam (chParam); |
|
1463 ReadFloatParam (input); |
|
1464 ReadFloatParam (expected); |
|
1465 ReadFloatParam (max_ulp); |
|
1466 // |
|
1467 TBuf<MAX_SIZE> buf; |
|
1468 TInt len = strlen(chParam); |
|
1469 |
|
1470 for (TInt j =0; j<len;j++) |
|
1471 { |
|
1472 buf.Append(chParam[j]); |
|
1473 } |
|
1474 // Do some testing |
|
1475 FLOAT res = FUNC(log1p) (input); |
|
1476 |
|
1477 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1478 { |
|
1479 INFO_PRINTF1(_L("Test passed.")); |
|
1480 } |
|
1481 else |
|
1482 { |
|
1483 ERR_PRINTF1(_L("Test Failed.")); |
|
1484 return KErrGeneral; |
|
1485 } |
|
1486 |
|
1487 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1488 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
1489 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1490 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1491 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1492 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1493 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1494 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1495 |
|
1496 return KErrNone; |
|
1497 } |
|
1498 |
|
1499 TInt CTestDouble_blr::logb_test() |
|
1500 { |
|
1501 char chParam[MAX_SIZE]; |
|
1502 FLOAT input; |
|
1503 FLOAT expected; |
|
1504 FLOAT max_ulp; |
|
1505 FLOAT gen_ulp; |
|
1506 // Read parameters |
|
1507 |
|
1508 ReadStringParam (chParam); |
|
1509 ReadFloatParam (input); |
|
1510 ReadFloatParam (expected); |
|
1511 ReadFloatParam (max_ulp); |
|
1512 // |
|
1513 TBuf<MAX_SIZE> buf; |
|
1514 TInt len = strlen(chParam); |
|
1515 |
|
1516 for (TInt j =0; j<len;j++) |
|
1517 { |
|
1518 buf.Append(chParam[j]); |
|
1519 } |
|
1520 // Do some testing |
|
1521 FLOAT res = FUNC(logb) (input); |
|
1522 |
|
1523 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1524 { |
|
1525 INFO_PRINTF1(_L("Test passed.")); |
|
1526 } |
|
1527 else |
|
1528 { |
|
1529 ERR_PRINTF1(_L("Test Failed.")); |
|
1530 return KErrGeneral; |
|
1531 } |
|
1532 |
|
1533 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1534 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1535 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1536 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1537 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1538 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1539 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1540 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1541 |
|
1542 return KErrNone; |
|
1543 } |
|
1544 |
|
1545 |
|
1546 TInt CTestDouble_blr::round_test() |
|
1547 { |
|
1548 char chParam[MAX_SIZE]; |
|
1549 FLOAT input; |
|
1550 long int expected; |
|
1551 FLOAT max_ulp; |
|
1552 FLOAT gen_ulp; |
|
1553 |
|
1554 // Read parameters |
|
1555 ReadStringParam (chParam); |
|
1556 ReadFloatParam (input); |
|
1557 ReadLIntParam (expected); |
|
1558 ReadFloatParam (max_ulp); |
|
1559 // |
|
1560 TBuf<MAX_SIZE> buf; |
|
1561 TInt len = strlen(chParam); |
|
1562 |
|
1563 for (TInt j =0; j<len;j++) |
|
1564 { |
|
1565 buf.Append(chParam[j]); |
|
1566 } |
|
1567 // Do some testing |
|
1568 TInt32 res = FUNC(round) (input); |
|
1569 |
|
1570 if(check_long(res, expected, max_ulp, gen_ulp)) |
|
1571 { |
|
1572 INFO_PRINTF1(_L("Test passed.")); |
|
1573 } |
|
1574 else |
|
1575 { |
|
1576 ERR_PRINTF1(_L("Test Failed.")); |
|
1577 return KErrGeneral; |
|
1578 } |
|
1579 |
|
1580 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1581 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1582 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1583 INFO_PRINTF2(_L("Expected Value : %d\n"), expected ); |
|
1584 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1585 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
1586 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1587 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1588 |
|
1589 return KErrNone; |
|
1590 } |
|
1591 |
|
1592 TInt CTestDouble_blr::lround_test() |
|
1593 { |
|
1594 char chParam[MAX_SIZE]; |
|
1595 FLOAT input; |
|
1596 long int expected; |
|
1597 FLOAT max_ulp; |
|
1598 FLOAT gen_ulp; |
|
1599 |
|
1600 |
|
1601 // Read parameters |
|
1602 |
|
1603 ReadStringParam (chParam); |
|
1604 ReadFloatParam (input); |
|
1605 ReadLIntParam (expected); |
|
1606 ReadFloatParam (max_ulp); |
|
1607 // |
|
1608 TBuf<MAX_SIZE> buf; |
|
1609 TInt len = strlen(chParam); |
|
1610 |
|
1611 for (TInt j =0; j<len;j++) |
|
1612 { |
|
1613 buf.Append(chParam[j]); |
|
1614 } |
|
1615 // Do some testing |
|
1616 TInt32 res = FUNC(lround) (input); |
|
1617 |
|
1618 if(check_long(res, expected, max_ulp, gen_ulp)) |
|
1619 { |
|
1620 INFO_PRINTF1(_L("Test passed.")); |
|
1621 } |
|
1622 else |
|
1623 { |
|
1624 ERR_PRINTF1(_L("Test Failed.")); |
|
1625 return KErrGeneral; |
|
1626 } |
|
1627 |
|
1628 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1629 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
1630 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1631 INFO_PRINTF2(_L("Expected Value : %d\n"), expected ); |
|
1632 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1633 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
1634 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1635 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1636 |
|
1637 return KErrNone; |
|
1638 } |
|
1639 |
|
1640 |
|
1641 TInt CTestDouble_blr::llround_test() |
|
1642 { |
|
1643 char chParam[MAX_SIZE]; |
|
1644 FLOAT input; |
|
1645 TInt64 expected; |
|
1646 FLOAT max_ulp; |
|
1647 FLOAT gen_ulp; |
|
1648 |
|
1649 // Read parameters |
|
1650 |
|
1651 ReadStringParam (chParam); |
|
1652 ReadFloatParam (input); |
|
1653 ReadLLIntParam (expected); |
|
1654 ReadFloatParam (max_ulp); |
|
1655 // |
|
1656 TBuf<MAX_SIZE> buf; |
|
1657 TInt len = strlen(chParam); |
|
1658 |
|
1659 for (TInt j =0; j<len;j++) |
|
1660 { |
|
1661 buf.Append(chParam[j]); |
|
1662 } |
|
1663 |
|
1664 // Do some testing |
|
1665 TInt64 res = FUNC(llround) (input); |
|
1666 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1667 { |
|
1668 INFO_PRINTF1(_L("Test passed.")); |
|
1669 } |
|
1670 else |
|
1671 { |
|
1672 ERR_PRINTF1(_L("Test Failed.")); |
|
1673 return KErrGeneral; |
|
1674 } |
|
1675 |
|
1676 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1677 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1678 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1679 INFO_PRINTF2(_L("Expected Value : %d\n"), expected ); |
|
1680 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1681 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
1682 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1683 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1684 return KErrNone; |
|
1685 } |
|
1686 |
|
1687 TInt CTestDouble_blr::rint_test() |
|
1688 { |
|
1689 char chParam[MAX_SIZE]; |
|
1690 FLOAT input; |
|
1691 FLOAT expected; |
|
1692 FLOAT max_ulp; |
|
1693 FLOAT gen_ulp; |
|
1694 // Read parameters |
|
1695 ReadStringParam (chParam); |
|
1696 ReadFloatParam (input); |
|
1697 ReadFloatParam (expected); |
|
1698 ReadFloatParam (max_ulp); |
|
1699 // |
|
1700 TBuf<MAX_SIZE> buf; |
|
1701 TInt len = strlen(chParam); |
|
1702 |
|
1703 for (TInt j =0; j<len;j++) |
|
1704 { |
|
1705 buf.Append(chParam[j]); |
|
1706 } |
|
1707 |
|
1708 // Do some testing |
|
1709 FLOAT res = FUNC(rint) (input); |
|
1710 |
|
1711 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1712 { |
|
1713 INFO_PRINTF1(_L("Test passed.")); |
|
1714 } |
|
1715 else |
|
1716 { |
|
1717 ERR_PRINTF1(_L("Test Failed.")); |
|
1718 return KErrGeneral; |
|
1719 } |
|
1720 |
|
1721 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1722 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1723 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1724 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1725 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1726 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1727 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1728 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1729 return KErrNone; |
|
1730 } |
|
1731 |
|
1732 TInt CTestDouble_blr::sqrt_test() |
|
1733 { |
|
1734 char chParam[MAX_SIZE]; |
|
1735 FLOAT input; |
|
1736 FLOAT expected; |
|
1737 FLOAT max_ulp; |
|
1738 FLOAT gen_ulp; |
|
1739 |
|
1740 // Read parameters |
|
1741 |
|
1742 ReadStringParam (chParam); |
|
1743 ReadFloatParam (input); |
|
1744 ReadFloatParam (expected); |
|
1745 ReadFloatParam (max_ulp); |
|
1746 // |
|
1747 TBuf<MAX_SIZE> buf; |
|
1748 TInt len = strlen(chParam); |
|
1749 |
|
1750 for (TInt j =0; j<len;j++) |
|
1751 { |
|
1752 buf.Append(chParam[j]); |
|
1753 } |
|
1754 |
|
1755 // Do some testing |
|
1756 FLOAT res = FUNC(sqrt)(input); |
|
1757 |
|
1758 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1759 { |
|
1760 INFO_PRINTF1(_L("Test passed.")); |
|
1761 } |
|
1762 else |
|
1763 { |
|
1764 ERR_PRINTF1(_L("Test Failed.")); |
|
1765 return KErrGeneral; |
|
1766 } |
|
1767 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1768 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1769 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1770 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1771 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1772 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1773 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1774 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1775 return KErrNone; |
|
1776 } |
|
1777 |
|
1778 TInt CTestDouble_blr::trunc_test() |
|
1779 { |
|
1780 char chParam[MAX_SIZE]; |
|
1781 FLOAT input; |
|
1782 FLOAT expected; |
|
1783 FLOAT max_ulp; |
|
1784 FLOAT gen_ulp; |
|
1785 |
|
1786 // Read parameters |
|
1787 |
|
1788 ReadStringParam (chParam); |
|
1789 ReadFloatParam (input); |
|
1790 ReadFloatParam (expected); |
|
1791 ReadFloatParam (max_ulp); |
|
1792 // |
|
1793 TBuf<MAX_SIZE> buf; |
|
1794 TInt len = strlen(chParam); |
|
1795 |
|
1796 for (TInt j =0; j<len;j++) |
|
1797 { |
|
1798 buf.Append(chParam[j]); |
|
1799 } |
|
1800 |
|
1801 // Do some testing |
|
1802 FLOAT res = FUNC(trunc) (input); |
|
1803 if(check_longlong(res, expected, max_ulp, gen_ulp)) |
|
1804 { |
|
1805 INFO_PRINTF1(_L("Test passed.")); |
|
1806 } |
|
1807 else |
|
1808 { |
|
1809 ERR_PRINTF1(_L("Test Failed.")); |
|
1810 return KErrGeneral; |
|
1811 } |
|
1812 |
|
1813 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1814 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
1815 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1816 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1817 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1818 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1819 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1820 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1821 |
|
1822 return KErrNone; |
|
1823 } |
|
1824 |
|
1825 TInt CTestDouble_blr::y0_test() |
|
1826 { |
|
1827 // Create temporary variables in stack |
|
1828 char chParam[MAX_SIZE]; |
|
1829 FLOAT input; |
|
1830 FLOAT expected; |
|
1831 FLOAT max_ulp; |
|
1832 FLOAT gen_ulp; |
|
1833 // Read parameters |
|
1834 ReadStringParam (chParam); |
|
1835 ReadFloatParam (input); |
|
1836 ReadFloatParam (expected); |
|
1837 ReadFloatParam (max_ulp); |
|
1838 // |
|
1839 TBuf<MAX_SIZE> buf; |
|
1840 TInt len = strlen(chParam); |
|
1841 |
|
1842 for (TInt j =0; j<len;j++) |
|
1843 { |
|
1844 buf.Append(chParam[j]); |
|
1845 } |
|
1846 |
|
1847 // Do some testing |
|
1848 FLOAT res = FUNC(y0) (input); |
|
1849 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1850 { |
|
1851 INFO_PRINTF1(_L("Test passed.")); |
|
1852 } |
|
1853 else |
|
1854 { |
|
1855 ERR_PRINTF1(_L("Test Failed.")); |
|
1856 return KErrGeneral; |
|
1857 } |
|
1858 |
|
1859 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1860 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
1861 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1862 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1863 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1864 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1865 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1866 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1867 |
|
1868 return KErrNone; |
|
1869 } |
|
1870 |
|
1871 TInt CTestDouble_blr::y1_test() |
|
1872 { |
|
1873 // Create temporary variables in stack |
|
1874 char chParam[MAX_SIZE]; |
|
1875 FLOAT input; |
|
1876 FLOAT expected; |
|
1877 FLOAT max_ulp; |
|
1878 FLOAT gen_ulp; |
|
1879 |
|
1880 // Read parameters |
|
1881 ReadStringParam (chParam); |
|
1882 ReadFloatParam (input); |
|
1883 ReadFloatParam (expected); |
|
1884 ReadFloatParam (max_ulp); |
|
1885 // |
|
1886 TBuf<MAX_SIZE> buf; |
|
1887 TInt len = strlen(chParam); |
|
1888 |
|
1889 for (TInt j =0; j<len;j++) |
|
1890 { |
|
1891 buf.Append(chParam[j]); |
|
1892 } |
|
1893 // Do some testing |
|
1894 FLOAT res = FUNC(y1) (input); |
|
1895 |
|
1896 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1897 { |
|
1898 INFO_PRINTF1(_L("Test passed.")); |
|
1899 } |
|
1900 else |
|
1901 { |
|
1902 ERR_PRINTF1(_L("Test Failed.")); |
|
1903 return KErrGeneral; |
|
1904 } |
|
1905 |
|
1906 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1907 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1908 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1909 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1910 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1911 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1912 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1913 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1914 return KErrNone; |
|
1915 } |
|
1916 |
|
1917 TInt CTestDouble_blr::significand_test() |
|
1918 { |
|
1919 // Create temporary variables in stack |
|
1920 char chParam[MAX_SIZE]; |
|
1921 FLOAT input; |
|
1922 FLOAT expected; |
|
1923 FLOAT max_ulp; |
|
1924 FLOAT gen_ulp; |
|
1925 |
|
1926 // Read parameters |
|
1927 ReadStringParam (chParam); |
|
1928 ReadFloatParam (input); |
|
1929 ReadFloatParam (expected); |
|
1930 ReadFloatParam (max_ulp); |
|
1931 // |
|
1932 TBuf<MAX_SIZE> buf; |
|
1933 TInt len = strlen(chParam); |
|
1934 |
|
1935 for (TInt j =0; j<len;j++) |
|
1936 { |
|
1937 buf.Append(chParam[j]); |
|
1938 } |
|
1939 // Do some testing |
|
1940 FLOAT res = FUNC(significand) (input); |
|
1941 |
|
1942 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1943 { |
|
1944 INFO_PRINTF1(_L("Test passed.")); |
|
1945 } |
|
1946 else |
|
1947 { |
|
1948 ERR_PRINTF1(_L("Test Failed.")); |
|
1949 return KErrGeneral; |
|
1950 } |
|
1951 |
|
1952 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1953 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
1954 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
1955 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
1956 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
1957 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
1958 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
1959 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1960 |
|
1961 return KErrNone; |
|
1962 } |
|
1963 |
|
1964 TInt CTestDouble_blr::floor_test() |
|
1965 { |
|
1966 // Create temporary variables in stack |
|
1967 char chParam[MAX_SIZE]; |
|
1968 FLOAT input; |
|
1969 FLOAT expected; |
|
1970 FLOAT max_ulp; |
|
1971 FLOAT gen_ulp; |
|
1972 // Read parameters |
|
1973 ReadStringParam (chParam); |
|
1974 ReadFloatParam (input); |
|
1975 ReadFloatParam (expected); |
|
1976 ReadFloatParam (max_ulp); |
|
1977 // |
|
1978 TBuf<MAX_SIZE> buf; |
|
1979 TInt len = strlen(chParam); |
|
1980 |
|
1981 for (TInt j =0; j<len;j++) |
|
1982 { |
|
1983 buf.Append(chParam[j]); |
|
1984 } |
|
1985 // Do some testing |
|
1986 FLOAT res = FUNC(floor) (input); |
|
1987 |
|
1988 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
1989 { |
|
1990 INFO_PRINTF1(_L("Test passed.")); |
|
1991 } |
|
1992 else |
|
1993 { |
|
1994 ERR_PRINTF1(_L("Test Failed.")); |
|
1995 return KErrGeneral; |
|
1996 } |
|
1997 |
|
1998 INFO_PRINTF1(_L("_________________________________________\n")); |
|
1999 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
2000 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2001 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2002 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
2003 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
2004 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
2005 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2006 |
|
2007 return KErrNone; |
|
2008 } |
|
2009 |
|
2010 TInt CTestDouble_blr::nearbyint_test() |
|
2011 { |
|
2012 // Create temporary variables in stack |
|
2013 char chParam[MAX_SIZE]; |
|
2014 FLOAT input; |
|
2015 FLOAT expected; |
|
2016 FLOAT max_ulp; |
|
2017 FLOAT gen_ulp; |
|
2018 |
|
2019 // Read parameters |
|
2020 ReadStringParam (chParam); |
|
2021 ReadFloatParam (input); |
|
2022 ReadFloatParam (expected); |
|
2023 ReadFloatParam (max_ulp); |
|
2024 // |
|
2025 TBuf<MAX_SIZE> buf; |
|
2026 TInt len = strlen(chParam); |
|
2027 |
|
2028 for (TInt j =0; j<len;j++) |
|
2029 { |
|
2030 buf.Append(chParam[j]); |
|
2031 } |
|
2032 // Do some testing |
|
2033 FLOAT res = FUNC(nearbyint) (input); |
|
2034 |
|
2035 if(check_float(res, expected, max_ulp, gen_ulp)) |
|
2036 { |
|
2037 INFO_PRINTF1(_L("Test passed.")); |
|
2038 } |
|
2039 else |
|
2040 { |
|
2041 ERR_PRINTF1(_L("Test Failed.")); |
|
2042 return KErrGeneral; |
|
2043 } |
|
2044 |
|
2045 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2046 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
2047 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2048 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2049 INFO_PRINTF2(_L("Max ULP value : %f\n"), max_ulp ); |
|
2050 INFO_PRINTF2(_L("Result : %f\n"), res ); |
|
2051 INFO_PRINTF2(_L("Generated Ulp : %f\n"), gen_ulp ); |
|
2052 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2053 return KErrNone; |
|
2054 } |
|
2055 |
|
2056 TInt CTestDouble_blr::isinf_test() |
|
2057 { |
|
2058 // Create temporary variables in stack |
|
2059 char chParam[MAX_SIZE]; |
|
2060 FLOAT input; |
|
2061 FLOAT expected; |
|
2062 FLOAT max_ulp; |
|
2063 // Read parameters |
|
2064 ReadStringParam (chParam); |
|
2065 ReadFloatParam (input); |
|
2066 ReadFloatParam (expected); |
|
2067 ReadFloatParam (max_ulp); |
|
2068 // |
|
2069 TBuf<MAX_SIZE> buf; |
|
2070 TInt len = strlen(chParam); |
|
2071 |
|
2072 for (TInt j =0; j<len;j++) |
|
2073 { |
|
2074 buf.Append(chParam[j]); |
|
2075 } |
|
2076 // Do some testing |
|
2077 int res = isinf (input); |
|
2078 |
|
2079 if(check_bool(res, expected)) |
|
2080 { |
|
2081 INFO_PRINTF1(_L("Test passed.")); |
|
2082 } |
|
2083 else |
|
2084 { |
|
2085 ERR_PRINTF1(_L("Test Failed.")); |
|
2086 return KErrGeneral; |
|
2087 } |
|
2088 |
|
2089 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2090 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
2091 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2092 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2093 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2094 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2095 |
|
2096 return KErrNone; |
|
2097 } |
|
2098 |
|
2099 TInt CTestDouble_blr::isnan_test() |
|
2100 { |
|
2101 // Create temporary variables in stack |
|
2102 char chParam[MAX_SIZE]; |
|
2103 FLOAT input; |
|
2104 FLOAT expected; |
|
2105 FLOAT max_ulp; |
|
2106 // Read parameters |
|
2107 ReadStringParam (chParam); |
|
2108 ReadFloatParam (input); |
|
2109 ReadFloatParam (expected); |
|
2110 ReadFloatParam (max_ulp); |
|
2111 // |
|
2112 TBuf<MAX_SIZE> buf; |
|
2113 TInt len = strlen(chParam); |
|
2114 |
|
2115 for (TInt j =0; j<len;j++) |
|
2116 { |
|
2117 buf.Append(chParam[j]); |
|
2118 } |
|
2119 // Do some testing |
|
2120 int res = isnan (input); |
|
2121 |
|
2122 if(check_bool(res, expected)) |
|
2123 { |
|
2124 INFO_PRINTF1(_L("Test passed.")); |
|
2125 } |
|
2126 else |
|
2127 { |
|
2128 ERR_PRINTF1(_L("Test Failed.")); |
|
2129 return KErrGeneral; |
|
2130 } |
|
2131 |
|
2132 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2133 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
2134 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2135 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2136 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2137 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2138 |
|
2139 return KErrNone; |
|
2140 } |
|
2141 |
|
2142 TInt CTestDouble_blr::finite_test() |
|
2143 { |
|
2144 // Create temporary variables in stack |
|
2145 char chParam[MAX_SIZE]; |
|
2146 FLOAT input; |
|
2147 FLOAT expected; |
|
2148 // Read parameters |
|
2149 ReadStringParam (chParam); |
|
2150 ReadFloatParam (input); |
|
2151 ReadFloatParam (expected); |
|
2152 // |
|
2153 TBuf<MAX_SIZE> buf; |
|
2154 TInt len = strlen(chParam); |
|
2155 |
|
2156 for (TInt j =0; j<len;j++) |
|
2157 { |
|
2158 buf.Append(chParam[j]); |
|
2159 } |
|
2160 // Do some testing |
|
2161 int res = FUNC(finite) (input); |
|
2162 |
|
2163 if(check_bool(res, expected)) |
|
2164 { |
|
2165 INFO_PRINTF1(_L("Test passed.")); |
|
2166 } |
|
2167 else |
|
2168 { |
|
2169 ERR_PRINTF1(_L("Test Failed.")); |
|
2170 return KErrGeneral; |
|
2171 } |
|
2172 |
|
2173 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2174 INFO_PRINTF2(_L("TestCase : %S\n"), &buf ); |
|
2175 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2176 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2177 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2178 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2179 return KErrNone; |
|
2180 } |
|
2181 |
|
2182 TInt CTestDouble_blr::isfinite_test() |
|
2183 { |
|
2184 // Create temporary variables in stack |
|
2185 char chParam[MAX_SIZE]; |
|
2186 FLOAT input; |
|
2187 FLOAT expected; |
|
2188 FLOAT max_ulp; |
|
2189 // Read parameters |
|
2190 ReadStringParam (chParam); |
|
2191 ReadFloatParam (input); |
|
2192 ReadFloatParam (expected); |
|
2193 ReadFloatParam (max_ulp); |
|
2194 // |
|
2195 TBuf<MAX_SIZE> buf; |
|
2196 TInt len = strlen(chParam); |
|
2197 |
|
2198 for (TInt j =0; j<len;j++) |
|
2199 { |
|
2200 buf.Append(chParam[j]); |
|
2201 } |
|
2202 // Do some testing |
|
2203 int res = isfinite (input); |
|
2204 |
|
2205 if(check_bool(res, expected)) |
|
2206 { |
|
2207 INFO_PRINTF1(_L("Test passed.")); |
|
2208 } |
|
2209 else |
|
2210 { |
|
2211 ERR_PRINTF1(_L("Test Failed.")); |
|
2212 return KErrGeneral; |
|
2213 } |
|
2214 |
|
2215 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2216 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
2217 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2218 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2219 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2220 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2221 |
|
2222 return KErrNone; |
|
2223 } |
|
2224 |
|
2225 |
|
2226 TInt CTestDouble_blr::isnormal_test() |
|
2227 { |
|
2228 // Create temporary variables in stack |
|
2229 char chParam[MAX_SIZE]; |
|
2230 FLOAT input; |
|
2231 FLOAT expected; |
|
2232 FLOAT max_ulp; |
|
2233 // Read parameters |
|
2234 ReadStringParam (chParam); |
|
2235 ReadFloatParam (input); |
|
2236 ReadFloatParam (expected); |
|
2237 ReadFloatParam (max_ulp); |
|
2238 // |
|
2239 TBuf<MAX_SIZE> buf; |
|
2240 TInt len = strlen(chParam); |
|
2241 |
|
2242 for (TInt j =0; j<len;j++) |
|
2243 { |
|
2244 buf.Append(chParam[j]); |
|
2245 } |
|
2246 // Do some testing |
|
2247 int res = isnormal (input); |
|
2248 |
|
2249 if(check_bool(res, expected)) |
|
2250 { |
|
2251 INFO_PRINTF1(_L("Test passed.")); |
|
2252 } |
|
2253 else |
|
2254 { |
|
2255 ERR_PRINTF1(_L("Test Failed.")); |
|
2256 return KErrGeneral; |
|
2257 } |
|
2258 |
|
2259 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2260 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
2261 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2262 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2263 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2264 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2265 |
|
2266 return KErrNone; |
|
2267 } |
|
2268 |
|
2269 |
|
2270 TInt CTestDouble_blr::signbit_test() |
|
2271 { |
|
2272 // Create temporary variables in stack |
|
2273 char chParam[MAX_SIZE]; |
|
2274 FLOAT input; |
|
2275 FLOAT expected; |
|
2276 FLOAT max_ulp; |
|
2277 // Read parameters |
|
2278 |
|
2279 ReadStringParam (chParam); |
|
2280 ReadFloatParam (input); |
|
2281 ReadFloatParam (expected); |
|
2282 ReadFloatParam (max_ulp); |
|
2283 // |
|
2284 TBuf<MAX_SIZE> buf; |
|
2285 TInt len = strlen(chParam); |
|
2286 |
|
2287 for (TInt j =0; j<len;j++) |
|
2288 { |
|
2289 buf.Append(chParam[j]); |
|
2290 } |
|
2291 // Do some testing |
|
2292 int res = signbit (input); |
|
2293 |
|
2294 if(check_bool(res, expected)) |
|
2295 { |
|
2296 INFO_PRINTF1(_L("Test passed.")); |
|
2297 } |
|
2298 else |
|
2299 { |
|
2300 ERR_PRINTF1(_L("Test Failed.")); |
|
2301 return KErrGeneral; |
|
2302 } |
|
2303 |
|
2304 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2305 INFO_PRINTF2(_L("TestCase : %S\n"), &buf); |
|
2306 INFO_PRINTF2(_L("Input Value : %f\n"), input ); |
|
2307 INFO_PRINTF2(_L("Expected Value : %f\n"), expected ); |
|
2308 INFO_PRINTF2(_L("Result : %d\n"), res ); |
|
2309 INFO_PRINTF1(_L("_________________________________________\n")); |
|
2310 |
|
2311 return KErrNone; |
|
2312 } |