1/* This test tests complex conjugate and passing/returning of 2 complex parameter. */ 3 4#include <stdlib.h> 5#include <stdio.h> 6 7int err; 8 9#define TEST(TYPE, FUNC) \ 10__complex__ TYPE \ 11ctest_ ## FUNC (__complex__ TYPE x) \ 12{ \ 13 __complex__ TYPE res; \ 14 \ 15 res = ~x; \ 16 \ 17 return res; \ 18} \ 19 \ 20void \ 21test_ ## FUNC (void) \ 22{ \ 23 __complex__ TYPE res, x; \ 24 \ 25 x = 1.0 + 2.0i; \ 26 \ 27 res = ctest_ ## FUNC (x); \ 28 \ 29 if (res != 1.0 - 2.0i) \ 30 { \ 31 printf ("test_" #FUNC " failed\n"); \ 32 ++err; \ 33 } \ 34} 35 36 37TEST(float, float) 38TEST(double, double) 39TEST(long double, long_double) 40TEST(int, int) 41TEST(long int, long_int) 42 43int 44main (void) 45{ 46 47 err = 0; 48 49 test_float (); 50 test_double (); 51 test_long_double (); 52 test_int (); 53 test_long_int (); 54 55 if (err != 0) 56 abort (); 57 58 return 0; 59} 60