* 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>
+
+ 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.
tests/nan.h
tests/signature.h
tests/macros.h
+tests/randomd.c
Depends-on:
isnand-nolibm
Makefile.am:
TESTS += test-frexp
check_PROGRAMS += test-frexp
+test_frexp_SOURCES = test-frexp.c randomd.c
test_frexp_LDADD = $(LDADD) @FREXP_LIBM@
tests/nan.h
tests/signature.h
tests/macros.h
+tests/randomf.c
Depends-on:
isnanf-nolibm
Makefile.am:
TESTS += test-frexpf
check_PROGRAMS += test-frexpf
+test_frexpf_SOURCES = test-frexpf.c randomf.c
test_frexpf_LDADD = $(LDADD) @FREXPF_LIBM@
tests/nan.h
tests/signature.h
tests/macros.h
+tests/randoml.c
Depends-on:
fpucw
Makefile.am:
TESTS += test-frexpl
check_PROGRAMS += test-frexpl
+test_frexpl_SOURCES = test-frexpl.c randoml.c
test_frexpl_LDADD = $(LDADD) @FREXPL_LIBM@
#define MIN_EXP DBL_MIN_EXP
#define MIN_NORMAL_EXP DBL_MIN_EXP
#define FREXP frexp
+#define RANDOM randomd
#include "test-frexp.h"
int
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));
+ }
+ }
}
#define MIN_EXP FLT_MIN_EXP
#define MIN_NORMAL_EXP FLT_MIN_EXP
#define FREXP frexpf
+#define RANDOM randomf
#include "test-frexp.h"
int
# define MIN_NORMAL_EXP LDBL_MIN_EXP
#endif
#define FREXP frexpl
+#define RANDOM randoml
#include "test-frexp.h"
int