Tests for module 'remainderf'.
authorBruno Haible <bruno@clisp.org>
Sat, 25 Feb 2012 18:42:45 +0000 (19:42 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 25 Feb 2012 18:42:45 +0000 (19:42 +0100)
* modules/remainderf-tests: New file.
* tests/test-remainderf.c: New file.
* tests/test-math-c++.cc: Check the declaration of remainderf.

ChangeLog
modules/remainderf-tests [new file with mode: 0644]
tests/test-math-c++.cc
tests/test-remainderf.c [new file with mode: 0644]

index 638e864..d65430d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-02-25  Bruno Haible  <bruno@clisp.org>
 
+       Tests for module 'remainderf'.
+       * modules/remainderf-tests: New file.
+       * tests/test-remainderf.c: New file.
+       * tests/test-math-c++.cc: Check the declaration of remainderf.
+
        New module 'remainderf'.
        * lib/math.in.h (remainderf): New declaration.
        * lib/remainderf.c: New file.
diff --git a/modules/remainderf-tests b/modules/remainderf-tests
new file mode 100644 (file)
index 0000000..6f392da
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-remainderf.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-remainderf
+check_PROGRAMS += test-remainderf
+test_remainderf_LDADD = $(LDADD) @REMAINDERF_LIBM@
index 758f352..e844c27 100644 (file)
@@ -205,6 +205,9 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
 #endif
 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
 
+#if GNULIB_TEST_REMAINDERF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
+#endif
 #if GNULIB_TEST_REMAINDER
 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
 #endif
diff --git a/tests/test-remainderf.c b/tests/test-remainderf.c
new file mode 100644 (file)
index 0000000..fc6be75
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test of remainderf() function.
+   Copyright (C) 2010-2012 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.  */
+
+#include <config.h>
+
+#include <math.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (remainderf, float, (float, float));
+
+#include "macros.h"
+
+volatile float x;
+volatile float y;
+float z;
+
+int
+main ()
+{
+  /* A particular value.  */
+  x = 9.245907126f;
+  y = 3.141592654f;
+  z = remainderf (x, y);
+  ASSERT (z >= -0.1788714f && z <= -0.1788708f);
+  return 0;
+}