From 2d6dd8845462d1ad1f6c511664718b728286acc2 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Tue, 20 Oct 2009 21:36:56 +0000 Subject: 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 --- tests/test_document.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/test_document.cpp') 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(""); + 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, "") @@ -119,7 +130,9 @@ TEST(document_parse) TEST(document_parse_transfer_ownership) { - char* text = static_cast(malloc(strlen("") + 1)); + allocation_function alloc = get_memory_allocation_function(); + + char* text = static_cast(alloc(strlen("") + 1)); CHECK(text); strcpy(text, ""); -- cgit v1.2.3