diff options
author | Bruno Haible <bruno@clisp.org> | 2011-10-06 00:16:53 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-10-06 00:16:53 +0200 |
commit | c022f617aaf9b31970c0497686db74e510e38c2a (patch) | |
tree | 3fd47f6f41f431f8699a2fe9644b4783c4c2ed44 | |
parent | 7f26f4f75fc3aee7a5e351ecdf05278d9890ff3e (diff) | |
download | gnulib-c022f617aaf9b31970c0497686db74e510e38c2a.tar.gz |
Tests for module 'fabsf'.
* modules/fabsf-tests: New file.
* tests/test-fabsf.c: New file.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | modules/fabsf-tests | 13 | ||||
-rw-r--r-- | tests/test-fabsf.c | 45 |
3 files changed, 62 insertions, 0 deletions
@@ -1,5 +1,9 @@ 2011-10-05 Bruno Haible <bruno@clisp.org> + Tests for module 'fabsf'. + * modules/fabsf-tests: New file. + * tests/test-fabsf.c: New file. + New module 'fabsf'. * lib/math.in.h (fabsf): New declaration. * lib/fabsf.c: New file. diff --git a/modules/fabsf-tests b/modules/fabsf-tests new file mode 100644 index 0000000000..2b8a10de1f --- /dev/null +++ b/modules/fabsf-tests @@ -0,0 +1,13 @@ +Files: +tests/test-fabsf.c +tests/signature.h +tests/macros.h + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fabsf +check_PROGRAMS += test-fabsf +test_fabsf_LDADD = $(LDADD) @FABSF_LIBM@ diff --git a/tests/test-fabsf.c b/tests/test-fabsf.c new file mode 100644 index 0000000000..d9dfa84f58 --- /dev/null +++ b/tests/test-fabsf.c @@ -0,0 +1,45 @@ +/* Test of fabsf() function. + Copyright (C) 2010-2011 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-2011. */ + +#include <config.h> + +#include <math.h> + +#include "signature.h" +SIGNATURE_CHECK (fabsf, float, (float)); + +#include "macros.h" + +volatile float x; +float y; + +int +main () +{ + /* A particular positive value. */ + x = 0.6f; + y = fabsf (x); + ASSERT (y == 0.6f); + + /* A particular negative value. */ + x = -0.6f; + y = fabsf (x); + ASSERT (y == 0.6f); + + return 0; +} |