From 89fc7c241ca8766ffd327e985d26ee8fcce17b52 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 23 Sep 2014 04:39:51 +0000 Subject: tests: More XPath tests git-svn-id: https://pugixml.googlecode.com/svn/trunk@1020 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath.cpp | 2 +- tests/test_xpath_paths.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index f9ae858..f3af88a 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -399,7 +399,7 @@ TEST_XML(xpath_out_of_memory_evaluate_union, " #endif } -TEST_XML(xpath_out_of_memory_evaluate_predicate, "") +TEST_XML(xpath_out_of_memory_evaluate_predicate, "") { test_runner::_memory_fail_threshold = 32768 + 4096 * 2; diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp index b6d7a4f..1f81d62 100644 --- a/tests/test_xpath_paths.cpp +++ b/tests/test_xpath_paths.cpp @@ -503,4 +503,23 @@ TEST_XML(xpath_paths_needs_sorting, "") +{ + CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3 % 4 % 7; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[1]")) % 3; + CHECK_XPATH_NODESET(doc, STR("//para[true()][1]")) % 3 % 4 % 7; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][1]")) % 3; + CHECK_XPATH_NODESET(doc, STR("//para[1][true()]")) % 3 % 4 % 7; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][true()]")) % 3; + CHECK_XPATH_NODESET(doc, STR("//para[1][2]")); + CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][2]")); + CHECK_XPATH_NODESET(doc, STR("//para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8; + CHECK_XPATH_NODESET(doc, STR("//para[position()=1][true()]")) % 3 % 4 % 7; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[position()=1][true()]")) % 3; + CHECK_XPATH_NODESET(doc, STR("//para[true()][position()=1]")) % 3 % 4 % 7; + CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][position()=1]")) % 3; + CHECK_XPATH_NODESET(doc, STR("//node()[self::para]")) % 3 % 4 % 5 % 6 % 7 % 8; +} + #endif -- cgit v1.2.3