summaryrefslogtreecommitdiff
path: root/test/cairo-test.h
diff options
context:
space:
mode:
authorJeff Muizelaar <jmuizelaar@mozilla.com>2009-02-11 15:24:20 -0500
committerJeff Muizelaar <jmuizelaar@mozilla.com>2009-02-11 15:24:24 -0500
commit41cbd935f9dba276db716e2c71ac21dc60505be9 (patch)
tree08b0573e74a8bff54a4c8cbe7cf37dca936189b2 /test/cairo-test.h
parent70297f257d4dc0accb5183b806d43a033887acb7 (diff)
downloadcairo-41cbd935f9dba276db716e2c71ac21dc60505be9.tar.gz
[test] Add cairo_test_NaN and use it in place of strtod
strtod("NaN") returns 0.0 with the MSVC runtime so we need to generate NaN some other way.
Diffstat (limited to 'test/cairo-test.h')
-rw-r--r--test/cairo-test.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/cairo-test.h b/test/cairo-test.h
index ac8856b3a..5a5be44ea 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -64,6 +64,21 @@ typedef unsigned __int64 uint64_t;
#include <math.h>
+static inline double
+cairo_test_NaN (void)
+{
+#ifdef _MSC_VER
+ /* MSVC strtod("NaN", NULL) returns 0.0 */
+ union {
+ uint32_t i[2];
+ double d;
+ } nan = {{0xffffffff, 0x7fffffff}};
+ return nan.d;
+#else
+ return strtod("NaN", NULL);
+#endif
+}
+
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,
CAIRO_TEST_NO_MEMORY,