From: Bruno Haible Date: Sat, 25 Feb 2012 12:13:10 +0000 (+0100) Subject: fabsf tests: More tests. X-Git-Tag: v0.1~1123 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=50d22400ccb7fb2104b697216a3f4ac0f1991f46;p=gnulib.git fabsf tests: More tests. * tests/test-fabsf.c: Include , minus-zero.h. (zero): New variable. (main): Add tests for signed zero. * modules/fabsf-tests (Files): Add tests/minus-zero.h. --- diff --git a/ChangeLog b/ChangeLog index caf179d83..5c2590d3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-02-25 Bruno Haible + + fabsf tests: More tests. + * tests/test-fabsf.c: Include , 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 atanl: Provide function definition on MSVC. diff --git a/modules/fabsf-tests b/modules/fabsf-tests index 2b8a10de1..74ba72311 100644 --- 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: diff --git a/tests/test-fabsf.c b/tests/test-fabsf.c index d08625e0c..b78b801cf 100644 --- a/tests/test-fabsf.c +++ b/tests/test-fabsf.c @@ -23,10 +23,14 @@ #include "signature.h" SIGNATURE_CHECK (fabsf, float, (float)); +#include + #include "macros.h" +#include "minus-zero.h" volatile float x; float y; +float zero = 0.0f; int main () @@ -41,5 +45,16 @@ main () 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; }