From c022f617aaf9b31970c0497686db74e510e38c2a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 6 Oct 2011 00:16:53 +0200 Subject: [PATCH] Tests for module 'fabsf'. * modules/fabsf-tests: New file. * tests/test-fabsf.c: New file. --- ChangeLog | 4 ++++ modules/fabsf-tests | 13 +++++++++++++ tests/test-fabsf.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 modules/fabsf-tests create mode 100644 tests/test-fabsf.c diff --git a/ChangeLog b/ChangeLog index 8c5b96eb2..5f0d563d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-10-05 Bruno Haible + 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 000000000..2b8a10de1 --- /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 000000000..d9dfa84f5 --- /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 . */ + +/* Written by Bruno Haible , 2010-2011. */ + +#include + +#include + +#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; +} -- 2.11.0