summaryrefslogtreecommitdiff
path: root/complex.c
blob: a760a7252e088d41c6030d5a71c8de9a9fcc007f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#if defined __STDC_VERSION__ && \
	(__STDC_VERSION__ == 199901L || \
	 (201112L <= __STDC_VERSION__ && ! defined __STDC_NO_COMPLEX__))
#include <complex.h>
#include "test.h"

void test_complex_h(void)
{
	complex double cd;
	testing_header("complex.h");

	test_true(creal(I) == 0);
	test_true(cimag(I) == 1);
	test_true(creal(_Complex_I) == 0);
	test_true(cimag(_Complex_I) == 1);
	test_double(I * I, -1);

	#ifdef _Imaginary_I
	test_true(creal(_Imaginary_I) == 0);
	test_true(cimag(_Imaginary_I) == 1);
	#endif

	testing_end();
}

#else
void test_complex_h(void)
{
}
#endif