summaryrefslogtreecommitdiff
path: root/tests/test_xpath_operators.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-08 12:25:56 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-08 12:25:56 +0000
commite3293a8baa1294e51bfcd6d3fc0cb7cee756ee7c (patch)
treea7664790f661de6b7bf40a909076450d2d57eb0d /tests/test_xpath_operators.cpp
parent19ac9fab402a338acb42e220132eed7aa3554354 (diff)
tests: Mostly complete coverage of XPath W3C
git-svn-id: http://pugixml.googlecode.com/svn/trunk@217 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_operators.cpp')
-rw-r--r--tests/test_xpath_operators.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_xpath_operators.cpp b/tests/test_xpath_operators.cpp
index de18070..876e86a 100644
--- a/tests/test_xpath_operators.cpp
+++ b/tests/test_xpath_operators.cpp
@@ -402,4 +402,20 @@ TEST(xpath_operators_boolean_precedence)
CHECK_XPATH_BOOLEAN(c, "3 > (2 > 1)", true);
}
+TEST_XML(xpath_operators_union, "<node><employee/><employee secretary=''/><employee assistant=''/><employee secretary='' assistant=''/><employee assistant='' secretary=''/><tail/></node>")
+{
+ doc.precompute_document_order();
+
+ xml_node c;
+ xml_node n = doc.child("node");
+
+ CHECK_XPATH_NODESET(n, "employee | .") % 2 % 3 % 4 % 6 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "employee[@secretary] | employee[@assistant]") % 4 % 6 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "employee[@assistant] | employee[@secretary]") % 4 % 6 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "employee[@secretary] | employee[@nobody]") % 4 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "employee[@nobody] | employee[@secretary]") % 4 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "tail/preceding-sibling::employee | .") % 2 % 3 % 4 % 6 % 8 % 11;
+ CHECK_XPATH_NODESET(n, ". | tail/preceding-sibling::employee | .") % 2 % 3 % 4 % 6 % 8 % 11;
+}
+
#endif