diff options
-rw-r--r-- | tests/test_xpath.cpp | 2 | ||||
-rw-r--r-- | tests/test_xpath_paths.cpp | 19 |
2 files changed, 20 insertions, 1 deletions
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, "<node><a/><a/><a/><a/><a/><a/><a/> #endif } -TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>") +TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>") { 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, "<node><child/><child/><child><subchild/><su CHECK_XPATH_NODESET(doc, STR("(node/child/subchild)[2]")) % 7; } +TEST_XML(xpath_paths_descendant_filters, "<node><para><para/><para/><para><para/></para></para><para/></node>") +{ + 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 |