From 473ab359347d6cf4ea5f963bdd04c5ad83cf384f Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 11 Oct 2009 09:06:01 +0000 Subject: [PATCH] tests: Some finishing touches for test_dom_traverse (for now) git-svn-id: http://pugixml.googlecode.com/svn/trunk@147 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_dom_traverse.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 71c08c6..f74a3b8 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -360,6 +360,7 @@ TEST_XML(dom_node_attribute, "") CHECK(node.attribute("attr2") == node.last_attribute()); CHECK(node.attribute_w("*tt?[23456789]*") == node.attribute("attr2")); + CHECK(node.attribute_w("?") == xml_attribute()); } TEST_XML(dom_node_next_previous_sibling, "") @@ -389,7 +390,9 @@ TEST_XML(dom_node_next_previous_sibling, "value1value2value4") @@ -447,10 +450,14 @@ TEST_XML(dom_node_find_child_by_attribute, "") @@ -551,6 +558,8 @@ TEST_XML(dom_node_find_node, "") CHECK(node.find_node(find_predicate_prefix("child2")) == node.last_child()); CHECK(node.find_node(find_predicate_prefix("child")) == node.first_child()); CHECK(doc.find_node(find_predicate_prefix("child")) == node.first_child()); + CHECK(doc.find_node(find_predicate_prefix("child2")) == node.last_child()); + CHECK(doc.find_node(find_predicate_prefix("child3")) == xml_node()); } TEST_XML(dom_node_path, "text") @@ -582,6 +591,9 @@ TEST_XML(dom_node_first_element_by_path, "texttext") CHECK(walker.log == "|-1 <=|0 !node=|1 !child=|2 !=text|-1 >="); } +TEST_XML(dom_node_traverse_siblings, "text") +{ + test_walker walker; + + CHECK(doc.traverse(walker)); + + CHECK(walker.call_count == 7); + CHECK(walker.log == "|-1 <=|0 !node=|1 !child=|1 !child=|2 !=text|1 !child=|-1 >="); +} + TEST(dom_node_traverse_empty) { test_walker walker;