From e11a81455afb36f59d2ec08ca7ccd4c56d0691a6 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 11 Oct 2009 06:49:30 +0000 Subject: tests: Added more node/attribute tests git-svn-id: http://pugixml.googlecode.com/svn/trunk@142 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_xpath.cpp (limited to 'tests/test_xpath.cpp') 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, "test") +{ + 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); +} -- cgit v1.2.3