diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-20 20:34:28 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-10-20 20:34:28 -0700 |
commit | d7ac5e2e0cb0521af1628e95774ad418af82af58 (patch) | |
tree | 2fca26ab47941b0511de460de0fc58f0a2882024 /tests/test_xpath.cpp | |
parent | fcd1876a21593bd62580383874b57c734d629a0c (diff) | |
parent | 7258aea09be1847b3dcc99ca389990027d4a92d3 (diff) |
Merge branch 'master' into compact
Diffstat (limited to 'tests/test_xpath.cpp')
-rw-r--r-- | tests/test_xpath.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index f7da258..2143376 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -122,6 +122,28 @@ TEST_XML(xpath_sort_attributes, "<node/>") xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 5 % 4 % 3; } +TEST(xpath_sort_random_medium) +{ + xml_document doc; + load_document_copy(doc, STR("<node>") + STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>") + STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>") + STR("<child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2>") + STR("</node>")); + + xpath_node_set ns = doc.select_nodes(STR("//node() | //@*")); + + std::vector<xpath_node> nsv(ns.begin(), ns.end()); + std::random_shuffle(nsv.begin(), nsv.end()); + + xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size()); + copy.sort(); + + xpath_node_set_tester tester(copy, "sorted order failed"); + + for (unsigned int i = 2; i < 39; ++i) tester % i; +} + TEST(xpath_sort_random_large) { xml_document doc; |