summaryrefslogtreecommitdiff
path: root/tests/test.hpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 20:37:54 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 20:37:54 +0000
commit5cc45c82898304dad06f747a72b4663a0b22c015 (patch)
tree45543e6015a3a45d4204fbb3a2f2e6b3cff50f04 /tests/test.hpp
parent27ec5a0b37cc756f01bc5b9f05bc92c6a7ec400e (diff)
tests: Added tests for some XPath functions
git-svn-id: http://pugixml.googlecode.com/svn/trunk@173 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test.hpp')
-rw-r--r--tests/test.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test.hpp b/tests/test.hpp
index 41dc218..028da62 100644
--- a/tests/test.hpp
+++ b/tests/test.hpp
@@ -46,6 +46,15 @@ inline bool test_xpath_number(const pugi::xml_node& node, const char* query, dou
return fabs(q.evaluate_number(node) - expected) < 1e-8f;
}
+inline bool test_xpath_number_nan(const pugi::xml_node& node, const char* query)
+{
+ pugi::xpath_query q(query);
+
+ double r = q.evaluate_number(node);
+
+ return r != r;
+}
+
inline bool test_xpath_fail_compile(const char* query)
{
try
@@ -127,6 +136,7 @@ struct dummy_fixture {};
#define CHECK_XPATH_STRING(node, query, expected) CHECK_TEXT(test_xpath_string(node, query, expected), #query " does not evaluate to " #expected " in context " #node)
#define CHECK_XPATH_BOOLEAN(node, query, expected) CHECK_TEXT(test_xpath_boolean(node, query, expected), #query " does not evaluate to " #expected " in context " #node)
#define CHECK_XPATH_NUMBER(node, query, expected) CHECK_TEXT(test_xpath_number(node, query, expected), #query " does not evaluate to " #expected " in context " #node)
+#define CHECK_XPATH_NUMBER_NAN(node, query) CHECK_TEXT(test_xpath_number_nan(node, query), #query " does not evaluate to NaN in context " #node)
#define CHECK_XPATH_FAIL(query) CHECK_TEXT(test_xpath_fail_compile(query), #query " should not compile")
#endif