summaryrefslogtreecommitdiff
path: root/tests/test.hpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:39:43 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:39:43 +0000
commit61ceb10baf347bb19078afdb945a6cdec85777d7 (patch)
treebe25d2607d737657373db68b9fdd5c1f58fb2af1 /tests/test.hpp
parent23d84cdf7c9a7d91d46bd98aed070148cb697b77 (diff)
tests: Added more XPath variable tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@681 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test.hpp')
-rw-r--r--tests/test.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test.hpp b/tests/test.hpp
index 37f78c8..7dd4df3 100644
--- a/tests/test.hpp
+++ b/tests/test.hpp
@@ -38,11 +38,17 @@ bool test_node(const pugi::xml_node& node, const pugi::char_t* contents, const p
bool test_double_nan(double value);
#ifndef PUGIXML_NO_XPATH
+bool test_xpath_string(const pugi::xpath_node& node, const pugi::xpath_query& query, const pugi::char_t* expected);
+bool test_xpath_boolean(const pugi::xpath_node& node, const pugi::xpath_query& query, bool expected);
+bool test_xpath_number(const pugi::xpath_node& node, const pugi::xpath_query& query, double expected);
+bool test_xpath_number_nan(const pugi::xpath_node& node, const pugi::xpath_query& query);
+
bool test_xpath_string(const pugi::xpath_node& node, const pugi::char_t* query, const pugi::char_t* expected);
bool test_xpath_boolean(const pugi::xpath_node& node, const pugi::char_t* query, bool expected);
bool test_xpath_number(const pugi::xpath_node& node, const pugi::char_t* query, double expected);
bool test_xpath_number_nan(const pugi::xpath_node& node, const pugi::char_t* query);
-bool test_xpath_fail_compile(const pugi::char_t* query);
+
+bool test_xpath_fail_compile(const pugi::char_t* query, pugi::xpath_variable_set* variables = 0);
struct xpath_node_set_tester
{
@@ -128,7 +134,9 @@ struct dummy_fixture {};
#define CHECK_XPATH_NUMBER(node, query, expected) CHECK_TEXT(test_xpath_number(node, query, expected), STRINGIZE(query) " does not evaluate to " STRINGIZE(expected) " in context " STRINGIZE(node))
#define CHECK_XPATH_NUMBER_NAN(node, query) CHECK_TEXT(test_xpath_number_nan(node, query), STRINGIZE(query) " does not evaluate to NaN in context " STRINGIZE(node))
#define CHECK_XPATH_FAIL(query) CHECK_TEXT(test_xpath_fail_compile(query), STRINGIZE(query) " should not compile")
-#define CHECK_XPATH_NODESET(node, query) xpath_node_set_tester(xpath_query(query).evaluate_node_set(node), CHECK_JOIN2(STRINGIZE(query) " does not evaluate to expected set in context " STRINGIZE(node), " at "__FILE__ ":", __LINE__))
+#define CHECK_XPATH_FAIL_VAR(query, variables) CHECK_TEXT(test_xpath_fail_compile(query, variables), STRINGIZE(query) " should not compile")
+#define CHECK_XPATH_NODESET_Q(node, query) xpath_node_set_tester(query.evaluate_node_set(node), CHECK_JOIN2(STRINGIZE(query) " does not evaluate to expected set in context " STRINGIZE(node), " at "__FILE__ ":", __LINE__))
+#define CHECK_XPATH_NODESET(node, query) CHECK_XPATH_NODESET_Q(node, pugi::xpath_query(query))
#endif
#define STR(text) PUGIXML_TEXT(text)