diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:49:35 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-08-29 15:49:35 +0000 |
commit | 31b8e28997767d152e93df900adddde8f244ccdf (patch) | |
tree | 4faa3ea2a18d9fd7a0fa52014721f5534981b0ff /tests/test_dom_traverse.cpp | |
parent | 998a534df7232c142521c57e7abd5e366ac3a8eb (diff) |
tests: Improved document_order() coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@693 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_dom_traverse.cpp')
-rw-r--r-- | tests/test_dom_traverse.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 18d59a4..71402c5 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -757,3 +757,31 @@ TEST_XML_FLAGS(dom_offset_debug, "<?xml?><?pi?><!--comment--><node>pcdata<![CDAT CHECK((cit++)->offset_debug() == 33); CHECK((cit++)->offset_debug() == 48); } + +TEST_XML(dom_document_order, "<node attr='value'>value</node>") +{ + xml_node node = doc.child(STR("node")); + xml_attribute attr = node.first_attribute(); + xml_node value = node.first_child(); + + CHECK(xml_node().document_order() == 0); + CHECK(xml_attribute().document_order() == 0); + + CHECK(doc.document_order() == 0); + CHECK(node.document_order() != 0 && attr.document_order() != 0 && value.document_order() != 0); + + CHECK(node.document_order() < attr.document_order() && attr.document_order() < value.document_order()); + + attr.set_name(STR("newattr")); + CHECK(attr.document_order() != 0); + CHECK(node.document_order() < attr.document_order() && attr.document_order() < value.document_order()); + + attr.set_value(STR("newvalue")); + CHECK(attr.document_order() == 0); + + node.set_name(STR("newnode")); + CHECK(node.document_order() == 0); + + value.set_value(STR("newvalue")); + CHECK(value.document_order() == 0); +} |