summaryrefslogtreecommitdiff
path: root/tests/test_xpath.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-11 06:49:30 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-11 06:49:30 +0000
commite11a81455afb36f59d2ec08ca7ccd4c56d0691a6 (patch)
tree71eed7bc143e2d9f6d0832e0347e02ca888df647 /tests/test_xpath.cpp
parent6ff7e795752b0cfc3d85e447bab063667e786150 (diff)
tests: Added more node/attribute tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@142 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath.cpp')
-rw-r--r--tests/test_xpath.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp
new file mode 100644
index 0000000..b3ace66
--- /dev/null
+++ b/tests/test_xpath.cpp
@@ -0,0 +1,19 @@
+#include "common.hpp"
+
+TEST_XML(xpath_document_order, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
+{
+ CHECK(xml_node().document_order() == 0);
+ CHECK(doc.child("node").document_order() == 0);
+ CHECK(doc.document_order() == 0);
+
+ doc.precompute_document_order();
+
+ CHECK(doc.document_order() == 1);
+ CHECK(doc.child("node").document_order() == 2);
+ CHECK(doc.child("node").child("child1").document_order() == 3);
+ CHECK(doc.child("node").child("child1").attribute("attr1").document_order() == 4);
+ CHECK(doc.child("node").child("child1").attribute("attr2").document_order() == 5);
+ CHECK(doc.child("node").child("child2").document_order() == 6);
+ CHECK(doc.child("node").child("child2").attribute("attr1").document_order() == 7);
+ CHECK(doc.child("node").child("child2").first_child().document_order() == 8);
+}