Tests for module 'log10l'.
[gnulib.git] / tests / test-math-c++.cc
1 /* Test of <math.h> substitute in C++ mode.
2    Copyright (C) 2010-2012 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
18
19 #define GNULIB_NAMESPACE gnulib
20 #include <config.h>
21
22 #include <math.h>
23
24 #include "signature.h"
25
26 /* Signature check for a function that takes a real-floating argument.
27    Check that each overloaded function with the specified signature exists.  */
28 #define REAL_FLOATING_CHECK(func,\
29                             rettype1, parameters1,\
30                             rettype2, parameters2,\
31                             rettype3, parameters3) \
32   OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
33   OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
34   OVERLOADED_CHECK (func, rettype3, parameters3, _3)
35 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
36   static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
37     = static_cast<rettype(*)parameters>(func)
38
39
40 /* Keep these checks in the same order as math.in.h!  */
41
42 #if GNULIB_TEST_ACOSF
43 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float));
44 #endif
45 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
46 #if GNULIB_TEST_ACOSL
47 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
48 #endif
49
50 #if GNULIB_TEST_ASINF
51 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
52 #endif
53 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
54 #if GNULIB_TEST_ASINL
55 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
56 #endif
57
58 #if GNULIB_TEST_ATANF
59 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf, float, (float));
60 #endif
61 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
62 #if GNULIB_TEST_ATANL
63 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
64 #endif
65
66 #if GNULIB_TEST_ATAN2F
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float));
68 #endif
69 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
70
71 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
72
73 #if GNULIB_TEST_CEILF
74 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
75 #endif
76 #if GNULIB_TEST_CEIL
77 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
78 #endif
79 #if GNULIB_TEST_CEILL
80 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
81 #endif
82
83 #if GNULIB_TEST_COPYSIGNF
84 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
85 #endif
86 #if GNULIB_TEST_COPYSIGN
87 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
88 #endif
89 #if GNULIB_TEST_COPYSIGNL
90 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
91                  (long double, long double));
92 #endif
93
94 #if GNULIB_TEST_COSF
95 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
96 #endif
97 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
98 #if GNULIB_TEST_COSL
99 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
100 #endif
101
102 #if GNULIB_TEST_COSHF
103 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
104 #endif
105 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
106
107 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
108
109 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
110
111 #if GNULIB_TEST_EXPF
112 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
113 #endif
114 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
115 #if GNULIB_TEST_EXPL
116 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
117 #endif
118
119 #if GNULIB_TEST_FABSF
120 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
121 #endif
122 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
123 #if GNULIB_TEST_FABSL
124 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl, long double, (long double));
125 #endif
126
127 #if GNULIB_TEST_FLOORF
128 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
129 #endif
130 #if GNULIB_TEST_FLOOR
131 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
132 #endif
133 #if GNULIB_TEST_FLOORL
134 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
135 #endif
136
137 #if GNULIB_TEST_FMODF
138 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
139 #endif
140 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
141 #if GNULIB_TEST_FMODL
142 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
143                  (long double, long double));
144 #endif
145
146 #if GNULIB_TEST_FREXPF
147 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
148 #endif
149 #if GNULIB_TEST_FREXP
150 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
151 #endif
152 #if GNULIB_TEST_FREXPL
153 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
154 #endif
155
156 //SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
157
158 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
159
160 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
161
162 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
163
164 #if GNULIB_TEST_LDEXPF
165 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
166 #endif
167 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
168 #if GNULIB_TEST_LDEXPL
169 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
170 #endif
171
172 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
173
174 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
175 #if GNULIB_TEST_LOG10L
176 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
177 #endif
178
179 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
180
181 //SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
182
183 #if GNULIB_TEST_LOGF
184 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
185 #endif
186 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
187 #if GNULIB_TEST_LOGL
188 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
189 #endif
190
191 #if GNULIB_TEST_LOG10F
192 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
193 #endif
194
195 #if GNULIB_TEST_MODFF
196 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
197 #endif
198 //SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
199 #if GNULIB_TEST_MODFL
200 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
201                  (long double, long double *));
202 #endif
203
204 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
205
206 #if GNULIB_TEST_POWF
207 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
208 #endif
209 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
210
211 #if GNULIB_TEST_REMAINDERF
212 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
213 #endif
214 #if GNULIB_TEST_REMAINDER
215 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
216 #endif
217 #if GNULIB_TEST_REMAINDERL
218 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
219                  (long double, long double));
220 #endif
221
222 #if GNULIB_TEST_RINTF
223 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
224 #endif
225 #if GNULIB_TEST_RINT
226 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
227 #endif
228 #if GNULIB_TEST_RINTL
229 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
230 #endif
231
232 #if GNULIB_TEST_ROUNDF
233 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
234 #endif
235 #if GNULIB_TEST_ROUND
236 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
237 #endif
238 #if GNULIB_TEST_ROUNDL
239 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
240 #endif
241
242 #if GNULIB_TEST_SINF
243 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
244 #endif
245 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
246 #if GNULIB_TEST_SINL
247 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
248 #endif
249
250 #if GNULIB_TEST_SINHF
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
252 #endif
253 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
254
255 #if GNULIB_TEST_SQRTF
256 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
257 #endif
258 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
259 #if GNULIB_TEST_SQRTL
260 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
261 #endif
262
263 #if GNULIB_TEST_TANF
264 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
265 #endif
266 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
267 #if GNULIB_TEST_TANL
268 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
269 #endif
270
271 #if GNULIB_TEST_TANHF
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
273 #endif
274 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
275
276 #if GNULIB_TEST_TRUNCF
277 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
278 #endif
279 #if GNULIB_TEST_TRUNC
280 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
281 #endif
282 #if GNULIB_TEST_TRUNCL
283 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
284 #endif
285
286 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
287
288 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
289
290 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
291
292 #if GNULIB_TEST_ISFINITE
293 # ifdef isfinite
294 #  error "isfinite should not be a macro in C++"
295 # endif
296 REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
297 #endif
298
299 #if GNULIB_TEST_ISINF
300 # ifdef isinf
301 #  error "isinf should not be a macro in C++"
302 # endif
303 REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
304 #endif
305
306 #if GNULIB_TEST_ISNAN
307 # ifdef isnan
308 #  error "isnan should not be a macro in C++"
309 # endif
310 REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
311 #endif
312
313 #if GNULIB_TEST_SIGNBIT
314 # ifdef signbit
315 #  error "signbit should not be a macro in C++"
316 # endif
317 REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));
318 #endif
319
320
321 int
322 main ()
323 {
324 }