From f481f038d64a3d0a1db1a3ae9a13be6a4bb18a7d Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:37:29 +0000 Subject: tests: Added XPath variable and variable set tests git-svn-id: http://pugixml.googlecode.com/svn/trunk@679 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/test.cpp') diff --git a/tests/test.cpp b/tests/test.cpp index 43c6b22..9091f14 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -60,6 +60,15 @@ bool test_node(const pugi::xml_node& node, const pugi::char_t* contents, const p return writer.as_string() == contents; } +bool test_double_nan(double value) +{ +#if defined(_MSC_VER) || defined(__BORLANDC__) + return _isnan(value) != 0; +#else + return value != value; +#endif +} + #ifndef PUGIXML_NO_XPATH bool test_xpath_string(const pugi::xpath_node& node, const pugi::char_t* query, const pugi::char_t* expected) { @@ -99,13 +108,7 @@ bool test_xpath_number_nan(const pugi::xpath_node& node, const pugi::char_t* que { pugi::xpath_query q(query); - double r = q.evaluate_number(node); - -#if defined(_MSC_VER) || defined(__BORLANDC__) - return _isnan(r) != 0; -#else - return r != r; -#endif + return test_double_nan(q.evaluate_number(node)); } bool test_xpath_fail_compile(const pugi::char_t* query) -- cgit v1.2.3