diff options
author | Bruno Haible <bruno@clisp.org> | 2012-03-01 03:02:24 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2012-03-01 03:37:11 +0100 |
commit | ef2fae88a2c4c3bf8389133a27003b45be018b2c (patch) | |
tree | 7ef187ddae90334624157e92c03ab068c4099c9d /tests/test-cbrt-ieee.h | |
parent | b71ef8c3aa6b74f6189a594b5d172623b53b2d00 (diff) | |
download | gnulib-ef2fae88a2c4c3bf8389133a27003b45be018b2c.tar.gz |
Tests for module 'cbrtf-ieee'.
* modules/cbrtf-ieee-tests: New file.
* tests/test-cbrtf-ieee.c: New file.
* tests/test-cbrt-ieee.h: New file.
Diffstat (limited to 'tests/test-cbrt-ieee.h')
-rw-r--r-- | tests/test-cbrt-ieee.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test-cbrt-ieee.h b/tests/test-cbrt-ieee.h new file mode 100644 index 0000000000..b29d930d66 --- /dev/null +++ b/tests/test-cbrt-ieee.h @@ -0,0 +1,40 @@ +/* Test of cbrt*() function family. + Copyright (C) 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/>. */ + +static void +test_function (void) +{ + /* [MX] shaded specification in POSIX. */ + + /* NaN. */ + ASSERT (ISNAN (CBRT (NAN))); + + /* Signed zero. */ + { + DOUBLE y = CBRT (L_(0.0)); + ASSERT (y == L_(0.0)); + ASSERT (!signbit (y)); + } + { + DOUBLE y = CBRT (MINUS_ZERO); + ASSERT (y == L_(0.0)); + ASSERT (!!signbit (y) == !!signbit (MINUS_ZERO)); + } + + /* Infinity. */ + ASSERT (CBRT (INFINITY) == INFINITY); + ASSERT (CBRT (- INFINITY) == - INFINITY); +} |