mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 09:57:57 +08:00
tests: Add more XPath out of memory tests
This commit is contained in:
parent
d4c456bdef
commit
ba39838ab5
@ -521,6 +521,19 @@ TEST(xpath_memory_concat_massive)
|
||||
CHECK(size == 5001);
|
||||
}
|
||||
|
||||
TEST_XML(xpath_memory_translate_table, "<node>a</node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 + 128;
|
||||
|
||||
// 128b per table => we need 32 translate calls to exhaust a page
|
||||
std::basic_string<char_t> query = STR("concat(");
|
||||
for (int i = 0; i < 32; ++i)
|
||||
query += STR("translate(.,'a','A'),");
|
||||
query += STR("'')");
|
||||
|
||||
CHECK_ALLOC_FAIL(pugi::xpath_query(query.c_str()).evaluate_string(doc.first_child()) == STR("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_sort_copy_share, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
|
||||
{
|
||||
// copy sharing shares the name/value data for nodes that can potentially make document order optimization invalid (silently)
|
||||
|
@ -474,6 +474,18 @@ TEST_XML(xpath_variables_copy_out_of_memory, "<node1 /><node2 />")
|
||||
CHECK(set2.get(STR("d"))->get_node_set().size() == 2);
|
||||
}
|
||||
|
||||
TEST(xpath_variables_copy_out_of_memory_clone)
|
||||
{
|
||||
xpath_variable_set set1;
|
||||
set1.set(STR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), true);
|
||||
|
||||
xpath_variable_set set2 = set1;
|
||||
|
||||
test_runner::_memory_fail_threshold = 60;
|
||||
|
||||
CHECK_ALLOC_FAIL(xpath_variable_set set3 = set1);
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
TEST_XML(xpath_variables_move, "<node />")
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user