From 903db8682a5f14b52adec996584c70ea072619ea Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 23 Oct 2014 07:41:07 +0000 Subject: tests: Add more tests for better coverage More tests for out-of-memory and other edge conditions git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_dom_modify.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests/test_dom_modify.cpp') diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index 5f4e26c..01b562a 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -27,6 +27,16 @@ TEST_XML(dom_attr_assign, "") CHECK_NODE(node, STR("")); } +TEST_XML(dom_attr_set_name, "") +{ + xml_attribute attr = doc.child(STR("node")).attribute(STR("attr")); + + CHECK(attr.set_name(STR("n"))); + CHECK(!xml_attribute().set_name(STR("n"))); + + CHECK_NODE(doc, STR("")); +} + TEST_XML(dom_attr_set_value, "") { xml_node node = doc.child(STR("node")); @@ -758,8 +768,9 @@ TEST(dom_node_declaration_name) doc.insert_child_after(node_declaration, doc.first_child()); doc.insert_child_before(node_declaration, doc.first_child()); + doc.prepend_child(node_declaration); - CHECK_NODE(doc, STR("")); + CHECK_NODE(doc, STR("")); } TEST(dom_node_declaration_attributes) @@ -867,17 +878,21 @@ TEST(dom_node_out_of_memory) // verify all node modification operations CHECK(!n.append_child()); + CHECK(!n.prepend_child()); CHECK(!n.insert_child_after(node_element, n.first_child())); CHECK(!n.insert_child_before(node_element, n.first_child())); CHECK(!n.append_attribute(STR(""))); + CHECK(!n.prepend_attribute(STR(""))); CHECK(!n.insert_attribute_after(STR(""), a)); CHECK(!n.insert_attribute_before(STR(""), a)); // verify node copy operations CHECK(!n.append_copy(n.first_child())); + CHECK(!n.prepend_copy(n.first_child())); CHECK(!n.insert_copy_after(n.first_child(), n.first_child())); CHECK(!n.insert_copy_before(n.first_child(), n.first_child())); CHECK(!n.append_copy(a)); + CHECK(!n.prepend_copy(a)); CHECK(!n.insert_copy_after(a, a)); CHECK(!n.insert_copy_before(a, a)); } -- cgit v1.2.3