complex.c 574 B

12345678910111213141516171819202122232425262728293031
  1. #if defined __STDC_VERSION__ && \
  2. (__STDC_VERSION__ == 199901L || \
  3. (201112L <= __STDC_VERSION__ && ! defined __STDC_NO_COMPLEX__))
  4. #include <complex.h>
  5. #include "test.h"
  6. void test_complex_h(void)
  7. {
  8. complex double cd;
  9. testing_header("complex.h");
  10. test_true(creal(I) == 0);
  11. test_true(cimag(I) == 1);
  12. test_true(creal(_Complex_I) == 0);
  13. test_true(cimag(_Complex_I) == 1);
  14. test_double(I * I, -1);
  15. #ifdef _Imaginary_I
  16. test_true(creal(_Imaginary_I) == 0);
  17. test_true(cimag(_Imaginary_I) == 1);
  18. #endif
  19. testing_end();
  20. }
  21. #else
  22. void test_complex_h(void)
  23. {
  24. }
  25. #endif