mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-28 14:48:43 +08:00
tests: Add more XPath sorting tests
Cover empty node case - no XPath query can result in that but it's possible to create a node set with empty nodes manually.
This commit is contained in:
parent
bcc7ed57a2
commit
10676b6b85
@ -672,6 +672,17 @@ TEST(xpath_sort_crossdoc_different_depth)
|
|||||||
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
CHECK((ns[0] == ns1[0] && ns[1] == ns2[0]) || (ns[0] == ns2[0] && ns[1] == ns1[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_XML(xpath_sort_empty_node, "<node><child1/><child2/></node>")
|
||||||
|
{
|
||||||
|
xml_node n = doc.child(STR("node"));
|
||||||
|
xpath_node nodes[] = { n.child(STR("child2")), xml_node(), n.child(STR("child1")), xml_node() };
|
||||||
|
xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]));
|
||||||
|
|
||||||
|
ns.sort();
|
||||||
|
|
||||||
|
CHECK(!ns[0] && !ns[1] && ns[2] == nodes[2] && ns[3] == nodes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(xpath_allocate_string_out_of_memory)
|
TEST(xpath_allocate_string_out_of_memory)
|
||||||
{
|
{
|
||||||
std::basic_string<char_t> query;
|
std::basic_string<char_t> query;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user