1 #include <complex.h>
2 #include <stdio.h>
3
4
5 static int
do_test(void)6 do_test (void)
7 {
8 int result = 0;
9
10 #ifdef CMPLX
11 size_t s;
12
13 #define T(f, r, i, t) \
14 do { \
15 s = sizeof (f (r, i)); \
16 if (s != sizeof (complex t)) \
17 { \
18 printf ("\
19 CMPLX (" #r ", " #i ") does not produce complex " #t ": %zu\n", s); \
20 result = 1; \
21 } \
22 } while (0)
23
24 #define C(f, t) \
25 do { \
26 T (f, 0.0f, 0.0f, t); \
27 T (f, 0.0f, 0.0, t); \
28 T (f, 0.0f, 0.0L, t); \
29 T (f, 0.0f, 0.0f, t); \
30 T (f, 0.0, 0.0f, t); \
31 T (f, 0.0L, 0.0f, t); \
32 T (f, 0.0, 0.0f, t); \
33 T (f, 0.0, 0.0, t); \
34 T (f, 0.0, 0.0L, t); \
35 T (f, 0.0f, 0.0, t); \
36 T (f, 0.0, 0.0, t); \
37 T (f, 0.0L, 0.0, t); \
38 T (f, 0.0L, 0.0f, t); \
39 T (f, 0.0L, 0.0, t); \
40 T (f, 0.0L, 0.0L, t); \
41 T (f, 0.0f, 0.0L, t); \
42 T (f, 0.0, 0.0L, t); \
43 T (f, 0.0L, 0.0L, t); \
44 } while (0)
45
46 C (CMPLXF, float);
47 C (CMPLX, double);
48 C (CMPLXL, long double);
49 #endif
50
51 return result;
52 }
53
54 #define TEST_FUNCTION do_test ()
55 #include "../test-skeleton.c"
56