0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-25 20:14:10 +08:00

tests: Fix PUGIXML_COMPACT+PUGIXML_WCHAR_MODE tests

Several tests got the buffer size wrong when sizeof(char_t)>1, and one
test didn't meet the carefully tuned allocation criteria under compact
mode due to the hash table usage and had to be changed a bit.
This commit is contained in:
Arseny Kapoulkine 2018-03-16 21:33:26 -07:00
parent e50672cf37
commit fe7b837868
2 changed files with 4 additions and 4 deletions

View File

@ -161,7 +161,7 @@ TEST(memory_page_management)
for (size_t i = 0; i < 4000; ++i)
{
xml_node node = doc.append_child(STR("node"));
xml_node node = doc.append_child(STR("n"));
CHECK(node);
nodes.push_back(node);

View File

@ -935,7 +935,7 @@ TEST(parse_out_of_memory_halfway_node)
test_runner::_memory_fail_threshold = 65536;
xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory));
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
CHECK_NODE(doc.first_child(), STR("<n/>"));
}
@ -962,7 +962,7 @@ TEST(parse_out_of_memory_halfway_attr)
test_runner::_memory_fail_threshold = 65536;
xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, count * 5 + 4).status == status_out_of_memory));
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
CHECK_STRING(doc.first_child().name(), STR("n"));
CHECK_STRING(doc.first_child().first_attribute().name(), STR("a"));
CHECK_STRING(doc.first_child().last_attribute().name(), STR("a"));
@ -993,7 +993,7 @@ TEST(parse_out_of_memory_allocator_state_sync)
test_runner::_memory_fail_threshold = 65536;
xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory));
CHECK_ALLOC_FAIL(CHECK(doc.load_buffer_inplace(text, sizeof(text)).status == status_out_of_memory));
CHECK_NODE(doc.first_child(), STR("<n/>"));
test_runner::_memory_fail_threshold = 0;