summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_document.cpp4
-rw-r--r--tests/test_dom_modify.cpp4
-rw-r--r--tests/test_dom_traverse.cpp12
3 files changed, 16 insertions, 4 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 2c52030..d81458a 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 ae18171..fc6dd59 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 721a079..4423dbe 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
}