summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-20 21:36:56 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-20 21:36:56 +0000
commit2d6dd8845462d1ad1f6c511664718b728286acc2 (patch)
tree5870d9eada3b8e47cb84677b247f1da5270cc1b8
parentc4fbc83cd021b46fb84ab2e55d9da0caaa8a4bb5 (diff)
tests: Final core tests, 99.0% coverage for pugixml.cpp
git-svn-id: http://pugixml.googlecode.com/svn/trunk@166 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--tests/test_document.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 2b7d950..362b469 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -27,6 +27,13 @@ TEST(document_load_stream_error)
std::ifstream fs2("con");
CHECK(doc.load(fs2).status == status_io_error);
+
+ std::ifstream fs3("nul");
+ CHECK(doc.load(fs3).status == status_io_error);
+
+ test_runner::_memory_fail_threshold = 1;
+ std::istringstream iss("<node/>");
+ CHECK(doc.load(iss).status == status_out_of_memory);
}
TEST(document_load_string)
@@ -65,6 +72,10 @@ TEST(document_load_file_error)
CHECK(doc.load_file("").status == status_file_not_found);
CHECK(doc.load_file("con").status == status_io_error);
+ CHECK(doc.load_file("nul").status == status_io_error);
+
+ test_runner::_memory_fail_threshold = 1;
+ CHECK(doc.load_file("tests/data/small.xml").status == status_out_of_memory);
}
TEST_XML(document_save, "<node/>")
@@ -119,7 +130,9 @@ TEST(document_parse)
TEST(document_parse_transfer_ownership)
{
- char* text = static_cast<char*>(malloc(strlen("<node/>") + 1));
+ allocation_function alloc = get_memory_allocation_function();
+
+ char* text = static_cast<char*>(alloc(strlen("<node/>") + 1));
CHECK(text);
strcpy(text, "<node/>");