summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-23 04:39:51 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-23 04:39:51 +0000
commit89fc7c241ca8766ffd327e985d26ee8fcce17b52 (patch)
tree9e821bbc255c9b33890bcfe02c037869691d92f5
parentbb6eaa756588df7ed270a4f32a43922f7e006bba (diff)
tests: More XPath tests
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1020 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--tests/test_xpath.cpp2
-rw-r--r--tests/test_xpath_paths.cpp19
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