diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2018-03-16 21:33:26 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2018-03-16 21:33:26 -0700 |
commit | fe7b837868b22a3684603327bfaa3242eb8adf22 (patch) | |
tree | c5eb339308826cc7e74973b8062e75468bdadaa7 | |
parent | e50672cf37d4e071a9ab012b4d72a3dc62f1f817 (diff) |
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.
-rw-r--r-- | tests/test_memory.cpp | 2 | ||||
-rw-r--r-- | tests/test_parse.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp index 4acda5b..3258736 100644 --- a/tests/test_memory.cpp +++ b/tests/test_memory.cpp @@ -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); diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index dd40bc5..180c70a 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -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; |