diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-11-08 13:52:55 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-11-08 13:52:55 +0000 |
commit | 48bbb9f4dd9e6581e61d4d60e132cdb4415f813e (patch) | |
tree | 2cab46e9c96b3209161ce60154a11599e26d582b /tests/test_xpath_paths.cpp | |
parent | c8a8b30bddf0df8f137203b0a1533c46358000be (diff) |
tests: Extracted generic tests in a separate header, better filter tests, some API tests added
git-svn-id: http://pugixml.googlecode.com/svn/trunk@221 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_paths.cpp')
-rw-r--r-- | tests/test_xpath_paths.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp index 5b29309..f2b6402 100644 --- a/tests/test_xpath_paths.cpp +++ b/tests/test_xpath_paths.cpp @@ -404,7 +404,19 @@ TEST_XML(xpath_paths_predicate_several, "<node><employee/><employee secretary='' CHECK_XPATH_NODESET(n, "employee[@secretary and @assistant]") % 8 % 11;
}
-TEST_XML(xpath_paths_predicate_filter, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
+TEST_XML(xpath_paths_predicate_filter_boolean, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
+{
+ doc.precompute_document_order();
+
+ xml_node n = doc.child("node").child("chapter").next_sibling().next_sibling();
+
+ CHECK_XPATH_NODESET(n, "(following-sibling::chapter)[position()=1]") % 6;
+ CHECK_XPATH_NODESET(n, "(following-sibling::chapter)[position()=2]") % 7;
+ CHECK_XPATH_NODESET(n, "(preceding-sibling::chapter)[position()=1]") % 3;
+ CHECK_XPATH_NODESET(n, "(preceding-sibling::chapter)[position()=2]") % 4;
+}
+
+TEST_XML(xpath_paths_predicate_filter_number, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
{
doc.precompute_document_order();
@@ -416,6 +428,17 @@ TEST_XML(xpath_paths_predicate_filter, "<node><chapter/><chapter/><chapter/><cha CHECK_XPATH_NODESET(n, "(preceding-sibling::chapter)[2]") % 4;
}
+TEST_XML(xpath_paths_predicate_filter_posinv, "<node><employee/><employee secretary=''/><employee assistant=''/><employee secretary='' assistant=''/><employee assistant='' secretary=''/></node>")
+{
+ doc.precompute_document_order();
+
+ xml_node n = doc.child("node");
+
+ CHECK_XPATH_NODESET(n, "employee") % 3 % 4 % 6 % 8 % 11;
+ CHECK_XPATH_NODESET(n, "(employee[@secretary])[@assistant]") % 8 % 11;
+ CHECK_XPATH_NODESET(n, "((employee)[@assistant])[@secretary]") % 8 % 11;
+}
+
TEST_XML(xpath_paths_step_compose, "<node><foo><foo/><foo/></foo><foo/></node>")
{
doc.precompute_document_order();
|