]> Savannah Git Hosting - gnulib.git/commitdiff
frexp* tests: More tests.
authorBruno Haible <bruno@clisp.org>
Sat, 3 Mar 2012 13:28:03 +0000 (14:28 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 3 Mar 2012 15:18:01 +0000 (16:18 +0100)
* tests/test-frexp.h (test_function): Add some pseudo-randomized tests.
* tests/test-frexp.c (RANDOM): New macro.
* tests/test-frexpf.c (RANDOM): New macro.
* tests/test-frexpl.c (RANDOM): New macro.
* modules/frexp-tests (Files): Add tests/randomd.c.
(Makefile.am): Add randomd.c to test_frexp_SOURCES.
* modules/frexpf-tests (Files): Add tests/randomf.c.
(Makefile.am): Add randomf.c to test_frexpf_SOURCES.
* modules/frexpl-tests (Files): Add tests/randoml.c.
(Makefile.am): Add randoml.c to test_frexpl_SOURCES.

ChangeLog
modules/frexp-tests
modules/frexpf-tests
modules/frexpl-tests
tests/test-frexp.c
tests/test-frexp.h
tests/test-frexpf.c
tests/test-frexpl.c

index 1fc01f42601496f5f67ee541f47f4f8ffae3464c..ceef59be6e7b4479f1e32dc3b2d914b964aa532a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-03-03  Bruno Haible  <bruno@clisp.org>
+
+       frexp* tests: More tests.
+       * tests/test-frexp.h (test_function): Add some pseudo-randomized tests.
+       * tests/test-frexp.c (RANDOM): New macro.
+       * tests/test-frexpf.c (RANDOM): New macro.
+       * tests/test-frexpl.c (RANDOM): New macro.
+       * modules/frexp-tests (Files): Add tests/randomd.c.
+       (Makefile.am): Add randomd.c to test_frexp_SOURCES.
+       * modules/frexpf-tests (Files): Add tests/randomf.c.
+       (Makefile.am): Add randomf.c to test_frexpf_SOURCES.
+       * modules/frexpl-tests (Files): Add tests/randoml.c.
+       (Makefile.am): Add randoml.c to test_frexpl_SOURCES.
+
 2012-03-03  Bruno Haible  <bruno@clisp.org>
 
        Support for pseudo-random numbers in tests.
index 3b3b837c64abffa1c796011104043affb2681122..0d957f28c074d7772c9436050b7f0093806bc259 100644 (file)
@@ -6,6 +6,7 @@ tests/infinity.h
 tests/nan.h
 tests/signature.h
 tests/macros.h
+tests/randomd.c
 
 Depends-on:
 isnand-nolibm
@@ -16,4 +17,5 @@ configure.ac:
 Makefile.am:
 TESTS += test-frexp
 check_PROGRAMS += test-frexp
+test_frexp_SOURCES = test-frexp.c randomd.c
 test_frexp_LDADD = $(LDADD) @FREXP_LIBM@
index 2efb31a8f19daee898b01e9e293841ce4a4c0a05..c7bfbed6c15f5d87d6256929cd23f1497910168b 100644 (file)
@@ -6,6 +6,7 @@ tests/infinity.h
 tests/nan.h
 tests/signature.h
 tests/macros.h
+tests/randomf.c
 
 Depends-on:
 isnanf-nolibm
@@ -16,4 +17,5 @@ configure.ac:
 Makefile.am:
 TESTS += test-frexpf
 check_PROGRAMS += test-frexpf
+test_frexpf_SOURCES = test-frexpf.c randomf.c
 test_frexpf_LDADD = $(LDADD) @FREXPF_LIBM@
index ee9f4c5fb8d729e8263a60872581419e1a196171..2c0f99ed1b2b2746d2553a7fb993bc754161100b 100644 (file)
@@ -6,6 +6,7 @@ tests/infinity.h
 tests/nan.h
 tests/signature.h
 tests/macros.h
+tests/randoml.c
 
 Depends-on:
 fpucw
@@ -18,4 +19,5 @@ configure.ac:
 Makefile.am:
 TESTS += test-frexpl
 check_PROGRAMS += test-frexpl
+test_frexpl_SOURCES = test-frexpl.c randoml.c
 test_frexpl_LDADD = $(LDADD) @FREXPL_LIBM@
index 0065af358a37a5bbbcc32c481b4602bc62b8d050..2b6a9fbf1e58212faa7e0a28acf8767aa6dd9114 100644 (file)
@@ -55,6 +55,7 @@ SIGNATURE_CHECK (frexp, double, (double, int *));
 #define MIN_EXP DBL_MIN_EXP
 #define MIN_NORMAL_EXP DBL_MIN_EXP
 #define FREXP frexp
+#define RANDOM randomd
 #include "test-frexp.h"
 
 int
index 3ea52b974630ca553adf48015bee4169e53035cf..71001df4238beba79df4ace368a96f34b8ad9fe1 100644 (file)
@@ -165,4 +165,15 @@ test_function (void)
       ASSERT (mantissa < L_(1.0));
       ASSERT (mantissa == my_ldexp (x, - exp));
     }
+
+  /* Randomized tests.  */
+  for (i = 0; i < SIZEOF (RANDOM); i++)
+    {
+      x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (x == my_ldexp (mantissa, exp));
+      }
+    }
 }
index fa469284bb79c8adb654437307a17a8cf1f650e5..b879c00788cb58c5afed93dee26660cb8a9cdf93 100644 (file)
@@ -50,6 +50,7 @@ SIGNATURE_CHECK (frexpf, float, (float, int *));
 #define MIN_EXP FLT_MIN_EXP
 #define MIN_NORMAL_EXP FLT_MIN_EXP
 #define FREXP frexpf
+#define RANDOM randomf
 #include "test-frexp.h"
 
 int
index b46cb2ae1d2677bae52cb43d020a49a355c78623..c5e07b256a96d7c3d8255251874454a0f2f17f7c 100644 (file)
@@ -62,6 +62,7 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *));
 # define MIN_NORMAL_EXP LDBL_MIN_EXP
 #endif
 #define FREXP frexpl
+#define RANDOM randoml
 #include "test-frexp.h"
 
 int