diff options
author | Ulrich Drepper <drepper@gmail.com> | 2012-01-08 16:02:45 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2012-01-08 16:02:45 -0500 |
commit | 1d5a644a55c60ad1f1903e851255ec9b2f45879b (patch) | |
tree | 622ee7fb9089d40682125759aae09fa0621a4461 /math/tst-CMPLX.c | |
parent | 8784a6db9151da74c1ffab427d49014533cf865f (diff) | |
download | glibc-1d5a644a55c60ad1f1903e851255ec9b2f45879b.zip glibc-1d5a644a55c60ad1f1903e851255ec9b2f45879b.tar.gz glibc-1d5a644a55c60ad1f1903e851255ec9b2f45879b.tar.bz2 |
Add test for CMPLX macros
Diffstat (limited to 'math/tst-CMPLX.c')
-rw-r--r-- | math/tst-CMPLX.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/math/tst-CMPLX.c b/math/tst-CMPLX.c new file mode 100644 index 0000000..2c32438 --- /dev/null +++ b/math/tst-CMPLX.c @@ -0,0 +1,56 @@ +#include <complex.h> + + +static int +do_test (void) +{ + int result = 0; + +#ifdef CMPLX + size_t s; + +#define T(f, r, i, t) \ + do { \ + s = sizeof (f (r, i)); \ + if (s != sizeof (complex t)) \ + { \ + printf ("\ +CMPLX (" #r ", " #i ") does not produce complex " #t ": %zu\n", s); \ + result = 1; \ + } \ + } while (0) + +#define C(f, t) \ + do { \ + T (f, 0.0f, 0.0f, t); \ + T (f, 0.0f, 0.0, t); \ + T (f, 0.0f, 0.0L, t); \ + T (f, 0.0f, 0.0f, t); \ + T (f, 0.0, 0.0f, t); \ + T (f, 0.0L, 0.0f, t); \ + T (f, 0.0, 0.0f, t); \ + T (f, 0.0, 0.0, t); \ + T (f, 0.0, 0.0L, t); \ + T (f, 0.0f, 0.0, t); \ + T (f, 0.0, 0.0, t); \ + T (f, 0.0L, 0.0, t); \ + T (f, 0.0L, 0.0f, t); \ + T (f, 0.0L, 0.0, t); \ + T (f, 0.0L, 0.0L, t); \ + T (f, 0.0f, 0.0L, t); \ + T (f, 0.0, 0.0L, t); \ + T (f, 0.0L, 0.0L, t); \ + } while (0) + + C (CMPLXF, float); + C (CMPLX, double); +# ifndef NO_LONG_DOUBLE + C (CMPLXL, long double); +# endif +#endif + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |