mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 01:47:55 +08:00
tests: Preparations for custom new/delete (leak detection)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@620 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
4f6ecee14c
commit
085584aa30
@ -80,8 +80,8 @@ TEST(document_load_stream_error)
|
||||
CHECK(doc.load(fs2).status == status_io_error);
|
||||
#endif
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
std::istringstream iss("<node/>");
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
CHECK(doc.load(iss).status == status_out_of_memory);
|
||||
}
|
||||
|
||||
|
@ -584,9 +584,9 @@ TEST(dom_node_declaration_copy)
|
||||
|
||||
TEST(dom_string_out_of_memory)
|
||||
{
|
||||
unsigned int length = 65536;
|
||||
const unsigned int length = 65536;
|
||||
static char_t string[length + 1];
|
||||
|
||||
char_t* string = new char_t[length + 1];
|
||||
for (unsigned int i = 0; i < length; ++i) string[i] = 'a';
|
||||
string[length] = 0;
|
||||
|
||||
|
@ -613,8 +613,8 @@ TEST(parse_out_of_memory)
|
||||
|
||||
TEST(parse_out_of_memory_halfway)
|
||||
{
|
||||
unsigned int count = 10000;
|
||||
char_t* text = new char_t[count * 4];
|
||||
const unsigned int count = 10000;
|
||||
static char_t text[count * 4];
|
||||
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
{
|
||||
@ -629,8 +629,6 @@ TEST(parse_out_of_memory_halfway)
|
||||
xml_document doc;
|
||||
CHECK(doc.load_buffer_inplace(text, count * 4).status == status_out_of_memory);
|
||||
CHECK_NODE(doc.first_child(), STR("<n />"));
|
||||
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
static bool test_offset(const char_t* contents, unsigned int options, pugi::xml_parse_status status, ptrdiff_t offset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user