diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 1 | ||||
| -rw-r--r-- | test/math/Makefile | 10 | ||||
| -rw-r--r-- | test/math/basic-test.c | 1 | ||||
| -rw-r--r-- | test/math/compile_test.c | 140 | ||||
| -rw-r--r-- | test/math/libm-test.inc | 56 |
5 files changed, 182 insertions, 26 deletions
diff --git a/test/Makefile b/test/Makefile index f38427e41..b8c3969e8 100644 --- a/test/Makefile +++ b/test/Makefile @@ -38,7 +38,6 @@ endif ifeq ($(HAS_NO_THREADS),y) DIRS := $(filter-out pthread,$(DIRS)) endif -DIRS := $(filter-out math,$(DIRS)) test check all: run diff --git a/test/math/Makefile b/test/math/Makefile index 09f5425a5..8553e2a4c 100644 --- a/test/math/Makefile +++ b/test/math/Makefile @@ -1,9 +1,13 @@ # uClibc math tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +include ../../.config + TESTS := basic-test rint tst-definitions test-fpucw test-float test-ifloat test-double test-idouble -ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y) -TESTS += test-ldouble test-ildouble +ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),y) +TESTS += test-ldouble test-ildoubl compile_test +else +CFLAGS_basic-test := -DNO_LONG_DOUBLE endif include ../Test.mak @@ -13,7 +17,7 @@ DODIFF_rint := 1 # NOTE: For basic-test we must disable the floating point optimization. # Only for sh architecture because in the other architecture are disabled. ifeq ($(TARGET_ARCH),sh) -CFLAGS_basic-test := -mieee +CFLAGS_basic-test += -mieee endif EXTRA_CFLAGS := -fno-builtin EXTRA_LDFLAGS := -lm diff --git a/test/math/basic-test.c b/test/math/basic-test.c index e42c01457..477b274e0 100644 --- a/test/math/basic-test.c +++ b/test/math/basic-test.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#define _ISOC99_SOURCE #include <math.h> #include <float.h> #include <stdio.h> diff --git a/test/math/compile_test.c b/test/math/compile_test.c new file mode 100644 index 000000000..99905201e --- /dev/null +++ b/test/math/compile_test.c @@ -0,0 +1,140 @@ +#include <math.h> + +static int testf(float float_x, long double long_double_x, /*float complex float_complex_x,*/ int int_x, long long_x) +{ +int r = 0; +r += acosf(float_x); +r += acoshf(float_x); +r += asinf(float_x); +r += asinhf(float_x); +r += atan2f(float_x, float_x); +r += atanf(float_x); +r += atanhf(float_x); +/*r += cargf(float_complex_x); - will fight with complex numbers later */ +r += cbrtf(float_x); +r += ceilf(float_x); +r += copysignf(float_x, float_x); +r += cosf(float_x); +r += coshf(float_x); +r += erfcf(float_x); +r += erff(float_x); +/*r += exp2f(float_x); - uclibc does not have it (yet?) */ +r += expf(float_x); +r += expm1f(float_x); +r += fabsf(float_x); +/*r += fdimf(float_x, float_x); - uclibc does not have it (yet?) */ +r += floorf(float_x); +/*r += fmaf(float_x, float_x, float_x); - uclibc does not have it (yet?) */ +/*r += fmaxf(float_x, float_x); - uclibc does not have it (yet?) */ +/*r += fminf(float_x, float_x); - uclibc does not have it (yet?) */ +r += fmodf(float_x, float_x); +r += frexpf(float_x, &int_x); +/* r += gammaf(float_x); fux0red API; use tgamma */ +r += hypotf(float_x, float_x); +r += ilogbf(float_x); +r += ldexpf(float_x, int_x); +r += lgammaf(float_x); +r += llrintf(float_x); +r += llroundf(float_x); +r += log10f(float_x); +r += log1pf(float_x); +/*r += log2f(float_x); - uclibc does not have it (yet?) */ +r += logbf(float_x); +r += logf(float_x); +r += lrintf(float_x); +r += lroundf(float_x); +r += modff(float_x, &float_x); +/*r += nearbyintf(float_x); - uclibc does not have it (yet?) */ +r += nextafterf(float_x, float_x); +/*r += nexttowardf(float_x, long_double_x); - uclibc does not have it (yet?) */ +r += powf(float_x, float_x); +r += remainderf(float_x, float_x); +/*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */ +r += rintf(float_x); +r += roundf(float_x); +/* r += scalbf(float_x, float_x); */ +r += scalblnf(float_x, long_x); +r += scalbnf(float_x, int_x); +/* r += significandf(float_x); Remove support for significand or only for OBSCURE_754_TESTS. */ +r += sinf(float_x); +r += sinhf(float_x); +r += sqrtf(float_x); +r += tanf(float_x); +r += tanhf(float_x); +r += tgammaf(float_x); +r += truncf(float_x); +return r; +} + +static int testl(long double long_double_x, int int_x, long long_x) +{ +int r = 0; +r += __finitel(long_double_x); +r += __fpclassifyl(long_double_x); +r += __isinfl(long_double_x); +r += __isnanl(long_double_x); +r += __signbitl(long_double_x); +r += acoshl(long_double_x); +r += acosl(long_double_x); +r += asinhl(long_double_x); +r += asinl(long_double_x); +r += atan2l(long_double_x, long_double_x); +r += atanhl(long_double_x); +r += atanl(long_double_x); +r += cbrtl(long_double_x); +r += ceill(long_double_x); +r += copysignl(long_double_x, long_double_x); +r += coshl(long_double_x); +r += cosl(long_double_x); +r += erfcl(long_double_x); +r += erfl(long_double_x); +r += exp2l(long_double_x); +r += expl(long_double_x); +r += expm1l(long_double_x); +r += fabsl(long_double_x); +r += fdiml(long_double_x, long_double_x); +r += floorl(long_double_x); +r += fmal(long_double_x, long_double_x, long_double_x); +r += fmaxl(long_double_x, long_double_x); +r += fminl(long_double_x, long_double_x); +r += fmodl(long_double_x, long_double_x); +r += frexpl(long_double_x, &int_x); +r += hypotl(long_double_x, long_double_x); +r += ilogbl(long_double_x); +r += ldexpl(long_double_x, int_x); +r += lgammal(long_double_x); +r += llrintl(long_double_x); +r += llroundl(long_double_x); +r += log10l(long_double_x); +r += log1pl(long_double_x); +/* r += log2l(long_double_x); uclibc does not have it (yet?) */ +r += logbl(long_double_x); +r += logl(long_double_x); +r += lrintl(long_double_x); +r += lroundl(long_double_x); +r += modfl(long_double_x, &long_double_x); +r += nearbyintl(long_double_x); +r += nextafterl(long_double_x, long_double_x); +/* r += nexttowardl(long_double_x, long_double_x); - uclibc doesn't provide this [yet?] */ +r += powl(long_double_x, long_double_x); +r += remainderl(long_double_x, long_double_x); +r += remquol(long_double_x, long_double_x, &int_x); +r += rintl(long_double_x); +r += roundl(long_double_x); +r += scalblnl(long_double_x, long_x); +r += scalbnl(long_double_x, int_x); +r += sinhl(long_double_x); +r += sinl(long_double_x); +r += sqrtl(long_double_x); +r += tanhl(long_double_x); +r += tanl(long_double_x); +r += tgammal(long_double_x); +r += truncl(long_double_x); +return r; +} + +int main(int argc, char **argv) +{ + /* Always 0 but gcc hopefully won't be able to notice */ + return 5 & ((long)&testf) & ((long)&testl) & 2; +} diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc index c9c2c8b41..0309e5a42 100644 --- a/test/math/libm-test.inc +++ b/test/math/libm-test.inc @@ -2883,6 +2883,7 @@ frexp_test (void) static void gamma_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; FUNC(gamma) (1); @@ -2906,8 +2907,10 @@ gamma_test (void) TEST_f_f1 (gamma, -0.5, M_LOG_2_SQRT_PIl, -1); END (gamma); +#endif } + static void hypot_test (void) { @@ -3006,14 +3009,15 @@ isnormal_test (void) static void j0_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(j0) (0); if (errno == ENOSYS) /* Function not implemented. */ @@ -3037,20 +3041,22 @@ j0_test (void) TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L); END (j0); +#endif } static void j1_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(j1) (0); if (errno == ENOSYS) /* Function not implemented. */ @@ -3074,19 +3080,21 @@ j1_test (void) TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L); END (j1); +#endif } static void jn_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(jn) (1, 1); if (errno == ENOSYS) /* Function not implemented. */ @@ -3148,6 +3156,7 @@ jn_test (void) TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L); END (jn); +#endif } @@ -4231,8 +4240,9 @@ round_test (void) static void scalb_test (void) { - +#ifdef __UCLIBC_SUSV3_LEGACY__ START (scalb); +#ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */ TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION); @@ -4283,8 +4293,9 @@ scalb_test (void) TEST_ff_f (scalb, 0.8L, 4, 12.8L); TEST_ff_f (scalb, -0.854375L, 5, -27.34L); - +#endif END (scalb); +#endif } @@ -4310,7 +4321,6 @@ scalbn_test (void) } -#if 0 static void scalbln_test (void) { @@ -4331,7 +4341,6 @@ scalbln_test (void) END (scalbn); } -#endif static void @@ -4535,7 +4544,6 @@ tanh_test (void) END (tanh); } -#if 0 static void tgamma_test (void) { @@ -4567,7 +4575,6 @@ tgamma_test (void) END (tgamma); } -#endif #if 0 @@ -4650,14 +4657,15 @@ trunc_test (void) static void y0_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(y0) (1); if (errno == ENOSYS) /* Function not implemented. */ @@ -4680,20 +4688,22 @@ y0_test (void) TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L); END (y0); +#endif } static void y1_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(y1) (1); if (errno == ENOSYS) /* Function not implemented. */ @@ -4716,20 +4726,22 @@ y1_test (void) TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L); END (y1); +#endif } static void yn_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE errno = 0; -#if 0 +# if 0 FLOAT s, c; FUNC (sincos) (0, &s, &c); if (errno == ENOSYS) /* Required function not implemented. */ return; -#endif +# endif FUNC(yn) (1, 1); if (errno == ENOSYS) /* Function not implemented. */ @@ -4787,13 +4799,14 @@ yn_test (void) TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L); END (yn); - +#endif } - +/* FIXME: Remove support for significand or only for OBSCURE_754_TESTS. */ static void significand_test (void) { +#if !defined TEST_DOUBLE && !defined TEST_FLOAT && !defined TEST_LDOUBLE /* significand returns the mantissa of the exponential representation. */ START (significand); @@ -4802,6 +4815,7 @@ significand_test (void) TEST_f_f (significand, 8.0, 1.0); END (significand); +#endif } @@ -5066,14 +5080,12 @@ main (int argc, char **argv) #endif /* Bessel functions: */ -#if 0 j0_test (); j1_test (); jn_test (); y0_test (); y1_test (); yn_test (); -#endif if (output_ulps) fclose (ulps_file); |
