diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-02-08 00:09:32 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-02-09 07:36:31 -0800 |
commit | ba39838ab587173ed6f08841f4a135403d605911 (patch) | |
tree | da4f6deeb30a949f9494bc3a46b37a1f3efdf001 /tests/test_xpath.cpp | |
parent | d4c456bdef566128ed18bcf066b430247ddb60b1 (diff) |
tests: Add more XPath out of memory tests
Diffstat (limited to 'tests/test_xpath.cpp')
-rw-r--r-- | tests/test_xpath.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 6cae607..a2af5e6 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -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) |