changeset 16414:8dacc3b05ad8

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.
author Bruno Haible <bruno@clisp.org>
date Sat, 25 Feb 2012 19:42:45 +0100
parents 3a9564d7a3a5
children 7dac4948337f
files ChangeLog modules/remainderf-tests tests/test-math-c++.cc tests/test-remainderf.c
diffstat 4 files changed, 62 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.
new file mode 100644
--- /dev/null
+++ b/modules/remainderf-tests
@@ -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@
--- a/tests/test-math-c++.cc
+++ b/tests/test-math-c++.cc
@@ -205,6 +205,9 @@
 #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
new file mode 100644
--- /dev/null
+++ b/tests/test-remainderf.c
@@ -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;
+}