diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 81c9014..bb5ed63 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -237,22 +237,6 @@ TEST(document_load_stream_nonseekable_out_of_memory) CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory)); } -TEST(document_load_stream_nonseekable_out_of_memory_large) -{ - std::basic_string str; - str += STR(""); - for (int i = 0; i < 10000; ++i) str += STR(""); - str += STR(""); - - char_array_buffer buffer(&str[0], &str[0] + str.length()); - std::basic_istream in(&buffer); - - test_runner::_memory_fail_threshold = 10000 * 8 * 3 / 2; - - pugi::xml_document doc; - CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory)); -} - TEST(document_load_stream_wide_nonseekable_out_of_memory) { wchar_t contents[] = L""; @@ -265,6 +249,38 @@ TEST(document_load_stream_wide_nonseekable_out_of_memory) CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory)); } +TEST(document_load_stream_nonseekable_out_of_memory_large) +{ + std::basic_string str; + str += ""; + for (int i = 0; i < 10000; ++i) str += ""; + str += ""; + + char_array_buffer buffer(&str[0], &str[0] + str.length()); + std::basic_istream in(&buffer); + + test_runner::_memory_fail_threshold = 10000 * 8 * 3 / 2; + + pugi::xml_document doc; + CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory)); +} + +TEST(document_load_stream_wide_nonseekable_out_of_memory_large) +{ + std::basic_string str; + str += L""; + for (int i = 0; i < 10000; ++i) str += L""; + str += L""; + + char_array_buffer buffer(&str[0], &str[0] + str.length()); + std::basic_istream in(&buffer); + + test_runner::_memory_fail_threshold = 10000 * 8 * 3 / 2; + + pugi::xml_document doc; + CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory)); +} + template class seek_fail_buffer: public std::basic_streambuf { public: