Changeset View
Changeset View
Standalone View
Standalone View
lib/msun/tests/test-utils.h
Show All 26 Lines | |||||
*/ | */ | ||||
#ifndef _TEST_UTILS_H_ | #ifndef _TEST_UTILS_H_ | ||||
#define _TEST_UTILS_H_ | #define _TEST_UTILS_H_ | ||||
#include <complex.h> | #include <complex.h> | ||||
#include <fenv.h> | #include <fenv.h> | ||||
#include <atf-c.h> | |||||
/* | /* | ||||
* Implementations are permitted to define additional exception flags | * Implementations are permitted to define additional exception flags | ||||
* not specified in the standard, so it is not necessarily true that | * not specified in the standard, so it is not necessarily true that | ||||
* FE_ALL_EXCEPT == ALL_STD_EXCEPT. | * FE_ALL_EXCEPT == ALL_STD_EXCEPT. | ||||
*/ | */ | ||||
#define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ | #define ALL_STD_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ | ||||
FE_OVERFLOW | FE_UNDERFLOW) | FE_OVERFLOW | FE_UNDERFLOW) | ||||
#define OPT_INVALID (ALL_STD_EXCEPT & ~FE_INVALID) | #define OPT_INVALID (ALL_STD_EXCEPT & ~FE_INVALID) | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
cfpequal_tol(long double complex x, long double complex y, long double tol, | cfpequal_tol(long double complex x, long double complex y, long double tol, | ||||
unsigned int flags) | unsigned int flags) | ||||
{ | { | ||||
return (fpequal_tol(creal(x), creal(y), tol, flags) | return (fpequal_tol(creal(x), creal(y), tol, flags) | ||||
&& fpequal_tol(cimag(x), cimag(y), tol, flags)); | && fpequal_tol(cimag(x), cimag(y), tol, flags)); | ||||
} | } | ||||
#define CHECK_FP_EXCEPTIONS(excepts, exceptmask) \ | |||||
ATF_CHECK_EQ_MSG((excepts), fetestexcept(exceptmask), \ | |||||
"unexpected exception flags: %#x not %#x", \ | |||||
fetestexcept(exceptmask), (excepts)) | |||||
#define CHECK_FP_EXCEPTIONS_MSG(excepts, exceptmask, fmt, ...) \ | |||||
ATF_CHECK_EQ_MSG((excepts), fetestexcept(exceptmask), \ | |||||
"unexpected exception flags: got %#x not %#x " fmt, \ | |||||
fetestexcept(exceptmask), (excepts), __VA_ARGS__) | |||||
#endif /* _TEST_UTILS_H_ */ | #endif /* _TEST_UTILS_H_ */ |