From 2b8f48e1bf5e73dea3c579e8dc1b404dcdecf0ea Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 25 Feb 2012 19:42:45 +0100 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ modules/remainderf-tests | 13 +++++++++++++ tests/test-math-c++.cc | 3 +++ tests/test-remainderf.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 modules/remainderf-tests create mode 100644 tests/test-remainderf.c diff --git a/ChangeLog b/ChangeLog index 638e8640a..d65430d99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2012-02-25 Bruno Haible + 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 index 000000000..6f392da43 --- /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@ diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc index 758f352ec..e844c2736 100644 --- a/tests/test-math-c++.cc +++ b/tests/test-math-c++.cc @@ -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 index 000000000..fc6be7568 --- /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 . */ + +/* Written by Bruno Haible , 2010. */ + +#include + +#include + +#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; +} -- 2.11.0