mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-27 13:33:17 +08:00
tests: Add more move tests
Make sure we have coverage for empty documents and for large documents that trigger compact_shared_parent != root for some pages.
This commit is contained in:
parent
faba4786c0
commit
402b967fa9
@ -1691,10 +1691,10 @@ TEST(document_move_append_child)
|
||||
xml_document other = std::move(*doc);
|
||||
delete doc;
|
||||
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
for (int i = 0; i < 3000; ++i)
|
||||
other.child(STR("node1")).append_child(STR("node"));
|
||||
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
for (int i = 0; i < 3000; ++i)
|
||||
other.child(STR("node1")).remove_child(other.child(STR("node1")).last_child());
|
||||
|
||||
CHECK_NODE(other, STR("<node1 attr1=\"value1\"><node2/></node1>"));
|
||||
@ -1703,4 +1703,27 @@ TEST(document_move_append_child)
|
||||
|
||||
CHECK(!other.first_child());
|
||||
}
|
||||
|
||||
TEST(document_move_empty)
|
||||
{
|
||||
xml_document* doc = new xml_document();
|
||||
xml_document other = std::move(*doc);
|
||||
delete doc;
|
||||
}
|
||||
|
||||
TEST(document_move_large)
|
||||
{
|
||||
xml_document* doc = new xml_document();
|
||||
|
||||
for (int i = 0; i < 3000; ++i)
|
||||
doc->append_child(STR("node"));
|
||||
|
||||
xml_document other = std::move(*doc);
|
||||
delete doc;
|
||||
|
||||
for (int i = 0; i < 3000; ++i)
|
||||
CHECK(other.remove_child(other.first_child()));
|
||||
|
||||
CHECK(!other.first_child());
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user