diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-06-16 22:42:40 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-06-16 22:45:42 -0700 |
commit | 0027b6ac7907dce79cc2f13230c7ecb46ce14ff6 (patch) | |
tree | 49b70cb89bd269af5cd9d053be4d79c2ac1c125f /tests/test_xpath.cpp | |
parent | 08f102f14c0d6b52d3fdeebc72bc05c1ddbf6867 (diff) |
tests: Improve XPath coverage
Add memory allocation failure test for concact with a very large list
and make sure we have every single axis covered with and without a
predicate, with and without a previous step.
Diffstat (limited to 'tests/test_xpath.cpp')
-rw-r--r-- | tests/test_xpath.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 69513fc..3f5d084 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -407,6 +407,22 @@ TEST(xpath_out_of_memory_evaluate_concat) CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1)); } +TEST(xpath_out_of_memory_evaluate_concat_list) +{ + std::basic_string<char_t> query = STR("concat("); + + for (size_t i = 0; i < 500; ++i) + query += STR("\"\","); + + query += STR("\"\")"); + + pugi::xpath_query q(query.c_str()); + + test_runner::_memory_fail_threshold = 1; + + CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1)); +} + TEST(xpath_out_of_memory_evaluate_substring) { test_runner::_memory_fail_threshold = 4196 * sizeof(char_t) + 4096 * 2; |