tests: Improved document_order() coverage

git-svn-id: http://pugixml.googlecode.com/svn/trunk@693 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2010-08-29 15:49:35 +00:00
parent 998a534df7
commit 31b8e28997
2 changed files with 28 additions and 6 deletions

View File

@ -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() == 33);
CHECK((cit++)->offset_debug() == 48); 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);
}

View File

@ -263,12 +263,6 @@ TEST(xpath_miscellaneous)
CHECK_XPATH_NODESET(xml_node(), STR("foo/@FOO/@bar")); CHECK_XPATH_NODESET(xml_node(), STR("foo/@FOO/@bar"));
} }
TEST(xpath_document_order)
{
CHECK(xml_attribute().document_order() == 0);
CHECK(xml_node().document_order() == 0);
}
TEST_XML(xpath_context_node, "<node>5</node>") TEST_XML(xpath_context_node, "<node>5</node>")
{ {
CHECK_XPATH_NODESET(doc, STR("node")) % 2; CHECK_XPATH_NODESET(doc, STR("node")) % 2;