summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-03-08 02:37:37 +0100
committerBruno Haible <bruno@clisp.org>2010-03-08 03:11:17 +0100
commit2cc1a61febc6da966ffb5f3ddb6425aadf8a3a6c (patch)
treec4ecf38d57587d81999e4381334eb62db24583c3
parent96687b16a22a4e07331bdeb5c3bdd534484f5b77 (diff)
downloadgnulib-2cc1a61febc6da966ffb5f3ddb6425aadf8a3a6c.tar.gz
Tests of module 'math' in C++ mode.
-rw-r--r--ChangeLog7
-rw-r--r--m4/math_h.m44
-rw-r--r--modules/math-tests8
-rw-r--r--tests/test-math-c++.cc155
4 files changed, 173 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fe3009c274..04709622be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-03-07 Bruno Haible <bruno@clisp.org>
+ Tests of module 'math' in C++ mode.
+ * tests/test-math-c++.cc: New file.
+ * modules/math-tests (Files): Add it and tests/signature.h.
+ (Depends-on): Add ansi-c++-opt.
+ (Makefile.am): Arrange to compile and run test-math-c++.
+ * m4/math_h.m4 (gl_MATH_MODULE_INDICATOR): Invoke gl_MODULE_INDICATOR.
+
Tests of module 'locale' in C++ mode.
* tests/test-locale-c++.cc: New file.
* modules/locale-tests (Files): Add it and tests/signature.h.
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index e4ad02e9d2..4cf403ee1f 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,4 +1,4 @@
-# math_h.m4 serial 18
+# math_h.m4 serial 19
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -48,6 +48,8 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_MATH_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+ dnl Define it also as a C macro, for the benefit of the unit tests.
+ gl_MODULE_INDICATOR([$1])
])
AC_DEFUN([gl_MATH_H_DEFAULTS],
diff --git a/modules/math-tests b/modules/math-tests
index ebab1579ce..71f6d685bd 100644
--- a/modules/math-tests
+++ b/modules/math-tests
@@ -1,10 +1,18 @@
Files:
tests/test-math.c
+tests/test-math-c++.cc
+tests/signature.h
Depends-on:
+ansi-c++-opt
configure.ac:
Makefile.am:
TESTS += test-math
check_PROGRAMS += test-math
+if ANSICXX
+TESTS += test-math-c++
+check_PROGRAMS += test-math-c++
+test_math_c___SOURCES = test-math-c++.cc
+endif
diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc
new file mode 100644
index 0000000000..9772a16389
--- /dev/null
+++ b/tests/test-math-c++.cc
@@ -0,0 +1,155 @@
+/* Test of <math.h> substitute in C++ mode.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010. */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+
+
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
+#if GNULIB_FREXP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
+#endif
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
+//SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
+
+#if GNULIB_ACOSL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
+#endif
+
+#if GNULIB_ASINL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
+#endif
+
+#if GNULIB_ATANL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
+#endif
+
+#if GNULIB_CEILF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
+#endif
+
+#if GNULIB_CEILL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
+#endif
+
+#if GNULIB_COSL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
+#endif
+
+#if GNULIB_EXPL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
+#endif
+
+#if GNULIB_FLOORF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
+#endif
+
+#if GNULIB_FLOORL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
+#endif
+
+#if GNULIB_FREXPL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
+#endif
+
+#if GNULIB_LDEXPL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
+#endif
+
+#if GNULIB_LOGL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
+#endif
+
+#if GNULIB_ROUNDF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
+#endif
+
+#if GNULIB_ROUND
+SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
+#endif
+
+#if GNULIB_ROUNDL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
+#endif
+
+#if GNULIB_SINL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
+#endif
+
+#if GNULIB_SQRTL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
+#endif
+
+#if GNULIB_TANL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
+#endif
+
+#if GNULIB_TRUNCF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
+#endif
+
+#if GNULIB_TRUNC
+SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
+#endif
+
+#if GNULIB_TRUNCL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
+#endif
+
+
+int
+main ()
+{
+}