Piotr Caban : msvcp90/tests: Use NAN and INFINITY definitions from port.h in Ctraits::_Isnan tests.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 26 11:13:57 CDT 2015
Module: wine
Branch: master
Commit: d2751ebcd56f368bae71b6b824fb62b9768a7131
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2751ebcd56f368bae71b6b824fb62b9768a7131
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Mar 26 11:32:05 2015 +0100
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 a4e07d7..d4e1f5a 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -27,6 +27,27 @@
#include <winbase.h>
#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);
}
More information about the wine-cvs
mailing list