From 9e6dcc292da05781c50822ce2966ac932e5e7438 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sun, 5 Oct 2014 08:39:44 +0000 Subject: tests: Add XPath sorting test git-svn-id: https://pugixml.googlecode.com/svn/trunk@1054 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath_paths.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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, "") +{ + 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 -- cgit v1.2.3