From d2751ebcd56f368bae71b6b824fb62b9768a7131 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 26 Mar 2015 11:32:05 +0100 Subject: [PATCH] msvcp90/tests: Use NAN and INFINITY definitions from port.h in Ctraits::_Isnan tests. --- dlls/msvcp90/tests/misc.c | 46 +++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c index a4e07d7dabf..d4e1f5a7cbe 100644 --- a/dlls/msvcp90/tests/misc.c +++ b/dlls/msvcp90/tests/misc.c @@ -27,6 +27,27 @@ #include #include "wine/test.h" +static inline float __port_infinity(void) +{ + static const unsigned __inf_bytes = 0x7f800000; + return *(const float *)&__inf_bytes; +} +#define INFINITY __port_infinity() + +static inline float __port_nan(void) +{ + static const unsigned __nan_bytes = 0x7fc00000; + return *(const float *)&__nan_bytes; +} +#define NAN __port_nan() + +static inline float __port_ind(void) +{ + static const unsigned __ind_bytes = 0xffc00000; + return *(const float *)&__ind_bytes; +} +#define IND __port_ind() + typedef double LDOUBLE; /* long double is just a double */ typedef struct { @@ -707,31 +728,34 @@ static void test_Ctraits_math_functions(void) ret = p_std_Ctraits_float__Isnan(0.0); ok(ret == FALSE, "ret = %d\n", ret); - ret = p_std_Ctraits_float__Isnan(0.0 / 0.0); - ok(ret == TRUE, "ret = %d\n", ret); - - ret = p_std_Ctraits_float__Isnan(1.0 / 0.0); + ret = p_std_Ctraits_float__Isnan(INFINITY); ok(ret == FALSE, "ret = %d\n", ret); - ret = p_std_Ctraits_float__Isnan(-1.0 / 0.0); + ret = p_std_Ctraits_float__Isnan(-INFINITY); ok(ret == FALSE, "ret = %d\n", ret); - ret = p_std_Ctraits_float__Isnan(log(-1.0)); + ret = p_std_Ctraits_float__Isnan(IND); ok(ret == TRUE, "ret = %d\n", ret); - ret = p_std_Ctraits_float__Isnan(sqrt(-1.0)); + ret = p_std_Ctraits_float__Isnan(NAN); ok(ret == TRUE, "ret = %d\n", ret); - ret = p_std_Ctraits_double__Isnan(3.14159 / 0.0); + ret = p_std_Ctraits_double__Isnan(INFINITY); ok(ret == FALSE, "ret = %d\n", ret); - ret = p_std_Ctraits_double__Isnan(log(-3.14159)); + ret = p_std_Ctraits_double__Isnan(IND); ok(ret == TRUE, "ret = %d\n", ret); - ret = p_std_Ctraits_long_double__Isnan(3.14159 / 0.0); + ret = p_std_Ctraits_double__Isnan(NAN); + ok(ret == TRUE, "ret = %d\n", ret); + + ret = p_std_Ctraits_long_double__Isnan(INFINITY); ok(ret == FALSE, "ret = %d\n", ret); - ret = p_std_Ctraits_long_double__Isnan(sqrt(-3.14159)); + ret = p_std_Ctraits_long_double__Isnan(IND); + ok(ret == TRUE, "ret = %d\n", ret); + + ret = p_std_Ctraits_long_double__Isnan(NAN); ok(ret == TRUE, "ret = %d\n", ret); }