|
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 #ifndef __TDOUBLE_BLR_H__ |
|
21 #define __TDOUBLE_BLR_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32math.h> |
|
25 #include <float.h> |
|
26 #include <math.h> |
|
27 #include <string.h> |
|
28 #include <test/testexecutestepbase.h> |
|
29 |
|
30 |
|
31 |
|
32 #define MAX_SIZE 50 |
|
33 |
|
34 #ifdef TESTING_FLOAT |
|
35 #define FUNC(function) function##f |
|
36 #define FLOAT float |
|
37 #define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cfloat |
|
38 #else |
|
39 #define FUNC(function) function |
|
40 #define FLOAT double |
|
41 #define CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat) Cdouble |
|
42 #endif //TESTING_FLOAT |
|
43 |
|
44 #define IGNORE_ZERO_INF_SIGN 0x10 |
|
45 |
|
46 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \ |
|
47 (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1)) |
|
48 |
|
49 _LIT(Kcbrt_test, "cbrt_test"); |
|
50 _LIT(Kceil_test, "ceil_test"); |
|
51 _LIT(Kerf_test, "erf_test"); |
|
52 _LIT(Kerfc_test, "erfc_test"); |
|
53 _LIT(Kexp_test, "exp_test"); |
|
54 _LIT(Kexp2_test, "exp2_test"); |
|
55 _LIT(Kexpm1_test, "expm1_test"); |
|
56 _LIT(Kfabs_test, "fabs_test"); |
|
57 _LIT(Kilogb_test, "ilogb_test"); |
|
58 _LIT(Kj0_test, "j0_test"); |
|
59 _LIT(Kj1_test, "j1_test"); |
|
60 _LIT(Klrint_test, "lrint_test"); |
|
61 _LIT(Kllrint_test, "llrint_test"); |
|
62 _LIT(Kfpclassify_test, "fpclassify_test"); |
|
63 _LIT(Klog_test, "log_test"); |
|
64 _LIT(Klog10_test, "log10_test"); |
|
65 _LIT(Klog1p_test, "log1p_test"); |
|
66 _LIT(Klogb_test, "logb_test"); |
|
67 _LIT(Kround_test, "round_test"); |
|
68 _LIT(Klround_test, "lround_test"); |
|
69 _LIT(Kllround_test, "llround_test"); |
|
70 _LIT(Krint_test, "rint_test"); |
|
71 _LIT(Ksqrt_test, "sqrt_test"); |
|
72 _LIT(Ktrunc_test, "trunc_test"); |
|
73 _LIT(Ky0_test, "y0_test"); |
|
74 _LIT(Ky1_test, "y1_test"); |
|
75 _LIT(Kfloor_test, "floor_test"); |
|
76 _LIT(Ksignificand_test, "significand_test"); |
|
77 _LIT(Knearbyint_test, "nearbyint_test"); |
|
78 _LIT(Kisinf_test, "isinf_test"); |
|
79 _LIT(Kisnan_test, "isnan_test"); |
|
80 _LIT(Kfdim_test, "fdim_test"); |
|
81 _LIT(Kfmax_test, "fmax_test"); |
|
82 _LIT(Kfmin_test, "fmin_test"); |
|
83 _LIT(Kfmod_test, "fmod_test"); |
|
84 _LIT(Khypot_test, "hypot_test"); |
|
85 _LIT(Kremainder_test, "remainder_test"); |
|
86 _LIT(Knexttoward_test, "nexttoward_test"); |
|
87 _LIT(Knextafter_test, "nextafter_test"); |
|
88 _LIT(Kcopysign_test, "copysign_test"); |
|
89 _LIT(Kfjn_test, "jn_test"); |
|
90 _LIT(Kfyn_test, "yn_test"); |
|
91 _LIT(Kscalb_test, "scalb_test"); |
|
92 _LIT(Kscalbn_test, "scalbn_test"); |
|
93 _LIT(Kpow_test, "pow_test"); |
|
94 _LIT(Kacos_test, "acos_test"); |
|
95 _LIT(Kacosh_test, "acosh_test"); |
|
96 _LIT(Kasin_test, "asin_test"); |
|
97 _LIT(Kasinh_test, "asinh_test"); |
|
98 _LIT(Katan_test, "atan_test"); |
|
99 _LIT(Katanh_test, "atanh_test"); |
|
100 _LIT(KCos_test, "Cos_test"); |
|
101 _LIT(Kcosh_test, "cosh_test"); |
|
102 _LIT(Ksin_test, "sin_test"); |
|
103 _LIT(Ksinh_test, "sinh_test"); |
|
104 _LIT(Ktan_test, "tan_test"); |
|
105 _LIT(Ktanh_test, "tanh_test"); |
|
106 _LIT(Katan2_test, "atan2_test"); |
|
107 _LIT(Kfma_test, "fma_test"); |
|
108 _LIT(Kisfinite_test, "isfinite_test"); |
|
109 _LIT(Kisnormal_test, "isnormal_test"); |
|
110 _LIT(Ksignbit_test, "signbit_test"); |
|
111 _LIT(Kscalbln_test, "scalbln_test"); |
|
112 _LIT(Kfinite_test, "finite_test"); |
|
113 _LIT(Kmodf_test, "modf_test"); |
|
114 _LIT(Kldexp_test, "ldexp_test"); |
|
115 _LIT(Kdrem_test, "drem_test"); |
|
116 _LIT(Kfrexp_test, "frexp_test"); |
|
117 _LIT(Kremquo_test, "remquo_test"); |
|
118 _LIT(Kremquo_remcheck_test, "remquo_remcheck_test"); |
|
119 _LIT(Kgamma_test, "gamma_test"); |
|
120 _LIT(Klgamma_test, "lgamma_test"); |
|
121 |
|
122 class CTestDouble_blr : public CTestStep |
|
123 { |
|
124 public: |
|
125 ~CTestDouble_blr (); |
|
126 CTestDouble_blr (const TDesC& aStepName); |
|
127 TInt iParamCnt; |
|
128 TVerdict doTestStepL(); |
|
129 TVerdict doTestStepPreambleL(); |
|
130 TVerdict doTestStepPostambleL(); |
|
131 private: |
|
132 |
|
133 /** |
|
134 * C++ default constructor. |
|
135 */ |
|
136 CTestDouble_blr(); |
|
137 |
|
138 // Utility functions for handling parameters etc. |
|
139 void ReadIntParam(TInt &aInt); |
|
140 void ReadStringParam(char* aString); |
|
141 void ReadFloatParam(FLOAT &aDbl); |
|
142 void ReadLIntParam(TInt32 &aLInt); |
|
143 void ReadLLIntParam(TInt64 &aLInt); |
|
144 |
|
145 //Test Functions |
|
146 int check_float (FLOAT computed, FLOAT expected, FLOAT max_ulp, FLOAT &gen_ulp); |
|
147 int check_longlong (TInt64 computed, TInt64 expected, FLOAT max_ulp, FLOAT &gen_ulp); |
|
148 int check_int (int computed, int expected, int max_ulp); |
|
149 int check_long (TInt32 computed, TInt32 expected, FLOAT max_ulp, FLOAT &gen_ulp); |
|
150 int check_bool (int computed, int expected); |
|
151 |
|
152 TInt cbrt_test(); |
|
153 TInt ceil_test(); |
|
154 TInt erf_test(); |
|
155 TInt erfc_test(); |
|
156 TInt exp_test(); |
|
157 TInt exp2_test(); |
|
158 TInt expm1_test(); |
|
159 TInt fabs_test(); |
|
160 TInt ilogb_test(); |
|
161 TInt j0_test(); |
|
162 TInt j1_test(); |
|
163 TInt lrint_test(); |
|
164 TInt llrint_test(); |
|
165 TInt fpclassify_test(); |
|
166 TInt log_test(); |
|
167 TInt log10_test(); |
|
168 TInt log1p_test(); |
|
169 TInt logb_test(); |
|
170 TInt round_test(); |
|
171 TInt lround_test(); |
|
172 TInt llround_test(); |
|
173 TInt rint_test(); |
|
174 TInt sqrt_test(); |
|
175 TInt trunc_test(); |
|
176 TInt y0_test(); |
|
177 TInt y1_test(); |
|
178 TInt floor_test(); |
|
179 TInt significand_test(); |
|
180 TInt nearbyint_test(); |
|
181 TInt isinf_test(); |
|
182 TInt isnan_test(); |
|
183 TInt acos_test(); |
|
184 TInt acosh_test(); |
|
185 TInt asin_test(); |
|
186 TInt asinh_test(); |
|
187 TInt Cos_test(); |
|
188 TInt atan_test(); |
|
189 TInt atanh_test(); |
|
190 TInt cosh_test(); |
|
191 TInt sin_test(); |
|
192 TInt sinh_test(); |
|
193 TInt tan_test(); |
|
194 TInt tanh_test(); |
|
195 TInt isfinite_test(); |
|
196 TInt isnormal_test(); |
|
197 TInt signbit_test(); |
|
198 TInt finite_test(); |
|
199 TInt modf_test(); |
|
200 // Apis which take two arguments |
|
201 TInt fdim_test(); |
|
202 TInt fmax_test(); |
|
203 TInt fmin_test(); |
|
204 TInt fmod_test(); |
|
205 TInt hypot_test(); |
|
206 TInt remainder_test(); |
|
207 TInt nexttoward_test(); |
|
208 TInt nextafter_test(); |
|
209 TInt copysign_test(); |
|
210 TInt jn_test(); |
|
211 TInt yn_test(); |
|
212 TInt scalb_test(); |
|
213 TInt scalbn_test(); |
|
214 TInt scalbln_test(); |
|
215 TInt pow_test(); |
|
216 TInt atan2_test(); |
|
217 TInt ldexp_test(); |
|
218 TInt drem_test(); |
|
219 TInt frexp_test(); |
|
220 TInt remquo_test(); |
|
221 TInt remquo_remcheck_test(); |
|
222 TInt fma_test(); |
|
223 TInt gamma_test(); |
|
224 TInt lgamma_test(); |
|
225 |
|
226 |
|
227 public: // Friend classes |
|
228 //?friend_class_declaration; |
|
229 protected: // Friend classes |
|
230 //?friend_class_declaration; |
|
231 private: // Friend classes |
|
232 //?friend_class_declaration; |
|
233 |
|
234 }; |
|
235 |
|
236 #endif // TDOUBLE_BLR_H |
|
237 |
|
238 // End of File |