0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

tests: Add even more stream coverage tests

Apparently only narrow character streams had out of memory coverage -
fix that and also split this into a separate test.
This commit is contained in:
Arseny Kapoulkine 2017-06-16 21:38:55 -07:00
parent 86593c0999
commit 08f102f14c

View File

@ -109,12 +109,26 @@ TEST(document_load_stream_error)
std::ifstream fs("filedoesnotexist");
CHECK(doc.load(fs).status == status_io_error);
}
TEST(document_load_stream_out_of_memory)
{
pugi::xml_document doc;
std::istringstream iss("<node/>");
test_runner::_memory_fail_threshold = 1;
CHECK_ALLOC_FAIL(CHECK(doc.load(iss).status == status_out_of_memory));
}
TEST(document_load_stream_wide_out_of_memory)
{
pugi::xml_document doc;
std::basic_istringstream<wchar_t> iss(L"<node/>");
test_runner::_memory_fail_threshold = 1;
CHECK_ALLOC_FAIL(CHECK(doc.load(iss).status == status_out_of_memory));
}
TEST(document_load_stream_empty)
{
std::istringstream iss;