summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_xpath_paths.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp
index 45579a9..c18acd2 100644
--- a/tests/test_xpath_paths.cpp
+++ b/tests/test_xpath_paths.cpp
@@ -539,4 +539,20 @@ TEST_XML(xpath_paths_precision, "<node><para/><para/><para/><para/><para/></node
CHECK_XPATH_NODESET(doc, STR("//para[6 * (1 div 3) - 1]")) % 3;
}
+TEST_XML(xpath_paths_unsorted_child, "<node><foo><bar/></foo><node><foo><bar/></foo></node><foo><bar/></foo></node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("//node/foo")) % 3 % 6 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//node/foo/bar")) % 4 % 7 % 9;
+
+ xpath_node_set ns = doc.select_nodes(STR("//node/foo/bar"));
+ CHECK(ns.type() == xpath_node_set::type_unsorted);
+
+ xpath_node_set nss = ns;
+ nss.sort();
+
+ CHECK(ns[0] == nss[0]);
+ CHECK(ns[1] == nss[2]);
+ CHECK(ns[2] == nss[1]);
+}
+
#endif