Mercurial > hg > octave-shane > gnulib-hg
changeset 16403:580de3212c9d
fabsf tests: More tests.
* tests/test-fabsf.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabsf-tests (Files): Add tests/minus-zero.h.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 25 Feb 2012 13:13:10 +0100 |
parents | 2c3775efa261 |
children | fc64dbadc964 |
files | ChangeLog modules/fabsf-tests tests/test-fabsf.c |
diffstat | 3 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-02-25 Bruno Haible <bruno@clisp.org> + + fabsf tests: More tests. + * tests/test-fabsf.c: Include <string.h>, minus-zero.h. + (zero): New variable. + (main): Add tests for signed zero. + * modules/fabsf-tests (Files): Add tests/minus-zero.h. + 2012-02-24 Bruno Haible <bruno@clisp.org> atanl: Provide function definition on MSVC.
--- a/modules/fabsf-tests +++ b/modules/fabsf-tests @@ -1,6 +1,7 @@ Files: tests/test-fabsf.c tests/signature.h +tests/minus-zero.h tests/macros.h Depends-on:
--- a/tests/test-fabsf.c +++ b/tests/test-fabsf.c @@ -23,10 +23,14 @@ #include "signature.h" SIGNATURE_CHECK (fabsf, float, (float)); +#include <string.h> + #include "macros.h" +#include "minus-zero.h" volatile float x; float y; +float zero = 0.0f; int main () @@ -41,5 +45,16 @@ y = fabsf (x); ASSERT (y == 0.6f); + /* Signed zero. */ + x = 0.0f; + y = fabsf (x); + ASSERT (y == 0.0f); + ASSERT (memcmp (&y, &zero, sizeof y) == 0); + + x = minus_zerof; + y = fabsf (x); + ASSERT (y == 0.0f); + ASSERT (memcmp (&y, &zero, sizeof y) == 0); + return 0; }