summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_dom_modify.cpp19
-rw-r--r--tests/test_dom_traverse.cpp2
-rw-r--r--tests/test_parse.cpp12
3 files changed, 32 insertions, 1 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index c14d8eb..e29cbb9 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -658,3 +658,22 @@ TEST(dom_node_out_of_memory)
CHECK(!n.insert_copy_after(a, a));
CHECK(!n.insert_copy_before(a, a));
}
+
+TEST(dom_node_memory_limit)
+{
+ const unsigned int length = 65536;
+ static char_t string[length + 1];
+
+ for (unsigned int i = 0; i < length; ++i) string[i] = 'a';
+ string[length] = 0;
+
+ test_runner::_memory_fail_threshold = 32768 * 4;
+
+ xml_document doc;
+
+ for (int i = 0; i < 32; ++i)
+ {
+ CHECK(doc.append_child().set_name(string));
+ CHECK(doc.remove_child(doc.first_child()));
+ }
+}
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index cbf873b..4825c67 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -700,7 +700,7 @@ TEST(dom_node_traverse_empty)
CHECK(walker.log == STR("|-1 <=|-1 >="));
}
-TEST_XML(dom_node_traverse_child, "<node><child>text</child></node>")
+TEST_XML(dom_node_traverse_child, "<node><child>text</child></node><another>node</another>")
{
test_walker walker;
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index 5b3cf3f..2fcaf6e 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -35,6 +35,18 @@ TEST(parse_pi_parse)
CHECK_STRING(pi2.value(), STR("value"));
}
+TEST(parse_pi_parse_spaces)
+{
+ xml_document doc;
+ CHECK(doc.load(STR("<?target \r\n\t value ?>"), parse_minimal | parse_pi));
+
+ xml_node pi = doc.first_child();
+
+ CHECK(pi.type() == node_pi);
+ CHECK_STRING(pi.name(), STR("target"));
+ CHECK_STRING(pi.value(), STR("value "));
+}
+
TEST(parse_pi_error)
{
xml_document doc;