X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-math-c%2B%2B.cc;h=8fee84320309bba890179ac48691a7bf88c9c5f4;hb=4e647944bd613bb7b419779881b5f3cb053f2869;hp=a26a86ffbf6317d61bea368d7bdfbea40beb3a4d;hpb=a365e1e5d3afa9a9f12d38eacaade8cd8fe0020e;p=gnulib.git diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc index a26a86ffb..8fee84320 100644 --- a/tests/test-math-c++.cc +++ b/tests/test-math-c++.cc @@ -23,6 +23,18 @@ #include "signature.h" +/* Signature check for a function that takes a real-floating argument. + Check that each overloaded function with the specified signature exists. */ +#define REAL_FLOATING_CHECK(func,\ + rettype1, parameters1,\ + rettype2, parameters2,\ + rettype3, parameters3) \ + OVERLOADED_CHECK (func, rettype1, parameters1, _1); \ + OVERLOADED_CHECK (func, rettype2, parameters2, _2); \ + OVERLOADED_CHECK (func, rettype3, parameters3, _3) +#define OVERLOADED_CHECK(func, rettype, parameters, suffix) \ + static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \ + = static_cast(func) #if GNULIB_TEST_ACOSF SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float)); @@ -41,11 +53,19 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double)); -//SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double)); +#if GNULIB_TEST_COPYSIGNF +SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float)); +#endif +#if GNULIB_TEST_COPYSIGN +SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double)); +#endif #if GNULIB_TEST_COSF SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double)); +#if GNULIB_TEST_COSHF +SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double)); @@ -68,6 +88,24 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *)); SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double)); +#if GNULIB_TEST_ISFINITE +# ifdef isfinite +# error "isfinite should not be a macro in C++" +# endif +REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double)); +#endif +#if GNULIB_TEST_ISINF +# ifdef isinf +# error "isinf should not be a macro in C++" +# endif +REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double)); +#endif +#if GNULIB_TEST_ISNAN +# ifdef isnan +# error "isnan should not be a macro in C++" +# endif +REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double)); @@ -96,11 +134,19 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double)); -//SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double)); +#if GNULIB_TEST_RINTF +SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float)); +#endif +#if GNULIB_TEST_RINT +SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double)); +#endif #if GNULIB_TEST_SINF SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double)); +#if GNULIB_TEST_SINHF +SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double)); #if GNULIB_TEST_SQRTF SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float)); @@ -110,6 +156,9 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float)); SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float)); #endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double)); +#if GNULIB_TEST_TANHF +SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double)); @@ -139,6 +188,11 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double)); SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double)); #endif +#if GNULIB_TEST_COPYSIGNL +SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double, + (long double, long double)); +#endif + #if GNULIB_TEST_COSL SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double)); #endif @@ -171,6 +225,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int)); SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double)); #endif +#if GNULIB_TEST_RINTL +SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double)); +#endif + #if GNULIB_TEST_ROUNDF SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float)); #endif @@ -183,6 +241,13 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double)); SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double)); #endif +#if GNULIB_TEST_SIGNBIT +# ifdef signbit +# error "signbit should not be a macro in C++" +# endif +REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double)); +#endif + #if GNULIB_TEST_SINL SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double)); #endif