2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / complex-6.c
blobbbb8c8d40aa15cd36dee5f27b3420679c225c222
1 /* This test tests complex conjugate and passing/returning of
2 complex parameter. */
4 #include <stdlib.h>
5 #include <stdio.h>
7 int err;
9 #define TEST(TYPE, FUNC) \
10 __complex__ TYPE \
11 ctest_ ## FUNC (__complex__ TYPE x) \
12 { \
13 __complex__ TYPE res; \
15 res = ~x; \
17 return res; \
18 } \
20 void \
21 test_ ## FUNC (void) \
22 { \
23 __complex__ TYPE res, x; \
25 x = 1.0 + 2.0i; \
27 res = ctest_ ## FUNC (x); \
29 if (res != 1.0 - 2.0i) \
30 { \
31 printf ("test_" #FUNC " failed\n"); \
32 ++err; \
33 } \
37 TEST(float, float)
38 TEST(double, double)
39 TEST(long double, long_double)
40 TEST(int, int)
41 TEST(long int, long_int)
43 int
44 main (void)
47 err = 0;
49 test_float ();
50 test_double ();
51 test_long_double ();
52 test_int ();
53 test_long_int ();
55 if (err != 0)
56 abort ();
58 return 0;