diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-01-31 19:19:04 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-01-31 19:19:04 -0800 |
commit | 094a0c8ebe44a1bfeb8575b33138a8b258bf8f4b (patch) | |
tree | 22a20d927f0f18c0fcff1bc4808fc27594bf00d0 /tests/test_parse.cpp | |
parent | 41fb880bf0c3246df50103c6ef3cf91d0fd5eefc (diff) |
tests: Add compact hash table reserve test
This makes sure all .reserve calls failure paths are covered. These
tests don't explicitly test if reserve is present on all paths - this is
much harder to test since not all modifications require reserve to be
called, so we'll have to rely on a combination of automated testing and
sanity checking for this.
Also add more parsing out of memory coverage tests.
Diffstat (limited to 'tests/test_parse.cpp')
-rw-r--r-- | tests/test_parse.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index f94a565..fa9555d 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -928,13 +928,24 @@ TEST(parse_out_of_memory_halfway_attr) TEST(parse_out_of_memory_conversion) { - test_runner::_memory_fail_threshold = 256; + test_runner::_memory_fail_threshold = 1; xml_document doc; CHECK_ALLOC_FAIL(CHECK(doc.load_buffer("<foo\x90/>", 7, parse_default, encoding_latin1).status == status_out_of_memory)); CHECK(!doc.first_child()); } +#ifdef PUGIXML_WCHAR_MODE +TEST(parse_out_of_memory_conversion_wchar) +{ + test_runner::_memory_fail_threshold = 1; + + xml_document doc; + CHECK_ALLOC_FAIL(CHECK(doc.load_buffer("<foo />", 7).status == status_out_of_memory)); + CHECK(!doc.first_child()); +} +#endif + TEST(parse_out_of_memory_allocator_state_sync) { const unsigned int count = 10000; |