diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 2c52030d99e3c8aad3f3017f7104af02389807af..d81458ab911a173528feb6598517a55523cedd01 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -32,9 +32,11 @@ static bool load_file_in_memory(const char* path, char*& data, size_t& size) if (!file) return false; fseek(file, 0, SEEK_END); - size = static_cast<size_t>(ftell(file)); + long length = ftell(file); fseek(file, 0, SEEK_SET); + CHECK(length >= 0); + size = static_cast<size_t>(length); data = new char[size]; CHECK(fread(data, 1, size, file) == size); diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index ae18171bbd28b4f5c9f535a6d98628b4bab6beed..fc6dd590060bb247f805821ad95289b08e35759d 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -644,7 +644,7 @@ TEST_XML(dom_node_remove_child, "<node><n1/><n2/><n3/><child><n4/></child></node TEST_XML(dom_node_remove_child_complex, "<node id='1'><n1 id1='1' id2='2'/><n2/><n3/><child><n4/></child></node>") { - doc.child(STR("node")).remove_child(STR("n1")); + CHECK(doc.child(STR("node")).remove_child(STR("n1"))); CHECK_NODE(doc, STR("<node id=\"1\"><n2 /><n3 /><child><n4 /></child></node>")); @@ -1040,7 +1040,7 @@ TEST_XML(dom_node_append_buffer_remove, "<node>test</node>") CHECK_NODE(doc, STR("<node>test</node>")); - doc.remove_child(STR("node")); + CHECK(doc.remove_child(STR("node"))); CHECK(!doc.first_child()); } diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 721a0794bb8b39a3bbf9af53627f2c3e37f0e7f6..4423dbe954230909b33f31288f4b8e75862a654d 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -1085,14 +1085,24 @@ TEST_XML(dom_unspecified_bool_coverage, "<node attr='value'>text</node>") { xml_node node = doc.first_child(); + CHECK(node); static_cast<void (*)(xml_node***)>(node)(0); + + CHECK(node.first_attribute()); static_cast<void (*)(xml_attribute***)>(node.first_attribute())(0); + + CHECK(node.text()); static_cast<void (*)(xml_text***)>(node.text())(0); #ifndef PUGIXML_NO_XPATH xpath_query q(STR("/node")); + CHECK(q); static_cast<void (*)(xpath_query***)>(q)(0); - static_cast<void (*)(xpath_node***)>(q.evaluate_node(doc))(0); + + xpath_node qn = q.evaluate_node(doc); + + CHECK(qn); + static_cast<void (*)(xpath_node***)>(qn)(0); #endif }