From 5ff56a6d68ce6fbab0980232d95b5d190e2ecdcf Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 9 May 2010 20:37:49 +0000 Subject: [PATCH] Removed document order optimization (it helps on a tiny percentage of queries), XPath tests now compute their own order git-svn-id: http://pugixml.googlecode.com/svn/trunk@400 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 41 +++-------------- src/pugixml.hpp | 9 ++-- src/pugixpath.cpp | 6 --- tests/test.cpp | 64 ++++++++++++++++++++++---- tests/test.hpp | 6 ++- tests/test_xpath.cpp | 24 ---------- tests/test_xpath_api.cpp | 18 +++----- tests/test_xpath_functions.cpp | 4 -- tests/test_xpath_operators.cpp | 2 - tests/test_xpath_paths.cpp | 60 ------------------------ tests/test_xpath_paths_abbrev_w3c.cpp | 46 ------------------- tests/test_xpath_paths_w3c.cpp | 66 --------------------------- 12 files changed, 74 insertions(+), 272 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 27c2960..fcd40b1 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -262,7 +262,7 @@ namespace pugi struct xml_attribute_struct { /// Default ctor - xml_attribute_struct(): document_order(0), name_allocated(false), value_allocated(false), name(0), value(0), prev_attribute(0), next_attribute(0) + xml_attribute_struct(): padding(0), name_allocated(false), value_allocated(false), name(0), value(0), prev_attribute(0), next_attribute(0) { } @@ -281,7 +281,7 @@ namespace pugi } } - unsigned int document_order : 30; ///< Document order value + unsigned int padding : 30; unsigned int name_allocated : 1; unsigned int value_allocated : 1; @@ -297,7 +297,7 @@ namespace pugi { /// Default ctor /// \param type - node type - xml_node_struct(xml_node_type type = node_element): name_allocated(false), value_allocated(false), document_order(0), type(type), parent(0), name(0), value(0), first_child(0), last_child(0), prev_sibling(0), next_sibling(0), first_attribute(0), last_attribute(0) + xml_node_struct(xml_node_type type = node_element): name_allocated(false), value_allocated(false), padding(0), type(type), parent(0), name(0), value(0), first_child(0), last_child(0), prev_sibling(0), next_sibling(0), first_attribute(0), last_attribute(0) { } @@ -357,7 +357,7 @@ namespace pugi unsigned int name_allocated : 1; unsigned int value_allocated : 1; - unsigned int document_order : 27; ///< Document order value + unsigned int padding : 27; unsigned int type : 3; ///< Node type; see xml_node_type. xml_node_struct* parent; ///< Pointer to parent @@ -2890,7 +2890,7 @@ namespace pugi unsigned int xml_attribute::document_order() const { - return _attr ? _attr->document_order : 0; + return 0; } xml_attribute& xml_attribute::operator=(const char_t* rhs) @@ -3683,35 +3683,7 @@ namespace pugi unsigned int xml_node::document_order() const { - return _root ? _root->document_order : 0; - } - - void xml_node::precompute_document_order_impl() - { - if (type() != node_document) return; - - unsigned int current = 1; - xml_node cur = *this; - - for (;;) - { - cur._root->document_order = current++; - - for (xml_attribute a = cur.first_attribute(); a; a = a.next_attribute()) - a._attr->document_order = current++; - - if (cur.first_child()) - cur = cur.first_child(); - else if (cur.next_sibling()) - cur = cur.next_sibling(); - else - { - while (cur && !cur.next_sibling()) cur = cur.parent(); - cur = cur.next_sibling(); - - if (!cur) break; - } - } + return 0; } void xml_node::print(xml_writer& writer, const char_t* indent, unsigned int flags, encoding_t encoding, unsigned int depth) const @@ -4154,7 +4126,6 @@ namespace pugi void xml_document::precompute_document_order() { - precompute_document_order_impl(); } #ifndef PUGIXML_NO_STL diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 8b4a733..83c4ee0 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -644,7 +644,7 @@ namespace pugi bool as_bool() const; /// \internal Document order or 0 if not set - unsigned int document_order() const; + PUGIXML_DEPRECATED unsigned int document_order() const; public: /** @@ -787,9 +787,6 @@ namespace pugi /// \internal Initializing ctor explicit xml_node(xml_node_struct* p); - /// \internal Precompute document order (valid only for document node) - void precompute_document_order_impl(); - /// \internal Get allocator xml_allocator& get_allocator() const; @@ -1457,7 +1454,7 @@ namespace pugi #endif /// \internal Document order or 0 if not set - unsigned int document_order() const; + PUGIXML_DEPRECATED unsigned int document_order() const; /** * Print subtree to writer @@ -2019,7 +2016,7 @@ namespace pugi * Compute document order for the whole tree * Sometimes this makes evaluation of XPath queries faster. */ - void precompute_document_order(); + PUGIXML_DEPRECATED void precompute_document_order(); }; #ifndef PUGIXML_NO_XPATH diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index dc25a0e..0059f78 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -213,12 +213,6 @@ namespace { bool operator()(const xpath_node& lhs, const xpath_node& rhs) const { - unsigned int lo = lhs.attribute() ? lhs.attribute().document_order() : lhs.node().document_order(); - unsigned int ro = rhs.attribute() ? rhs.attribute().document_order() : rhs.node().document_order(); - - if (lo != 0 && ro != 0) - return lo < ro; - xml_node ln = lhs.node(), rn = rhs.node(); if (lhs.attribute() && rhs.attribute()) diff --git a/tests/test.cpp b/tests/test.cpp index ebd4bf4..1744e4f 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -1,3 +1,5 @@ +#define _SCL_SECURE_NO_WARNINGS + #include "test.hpp" #include "writer_string.hpp" @@ -5,6 +7,38 @@ #include #include +#include +#include + +#ifndef PUGIXML_NO_XPATH +static void build_document_order(std::vector& result, pugi::xml_node root) +{ + result.push_back(pugi::xpath_node()); + + pugi::xml_node cur = root; + + for (;;) + { + result.push_back(cur); + + for (pugi::xml_attribute a = cur.first_attribute(); a; a = a.next_attribute()) + result.push_back(pugi::xpath_node(a, cur)); + + if (cur.first_child()) + cur = cur.first_child(); + else if (cur.next_sibling()) + cur = cur.next_sibling(); + else + { + while (cur && !cur.next_sibling()) cur = cur.parent(); + cur = cur.next_sibling(); + + if (!cur) break; + } + } +} +#endif + bool test_string_equal(const pugi::char_t* lhs, const pugi::char_t* rhs) { return (!lhs || !rhs) ? lhs == rhs : pugi::impl::strequal(lhs, rhs); @@ -82,21 +116,33 @@ void xpath_node_set_tester::check(bool condition) } } -xpath_node_set_tester::xpath_node_set_tester(const pugi::xml_node& node, const pugi::char_t* query, const char* message): last(0), message(message) -{ - pugi::xpath_query q(query); - result = q.evaluate_node_set(node); -} - xpath_node_set_tester::xpath_node_set_tester(const pugi::xpath_node_set& set, const char* message): last(0), message(message) { result = set; + + if (result.empty()) + { + document_order = 0; + document_size = 0; + } + else + { + std::vector order; + build_document_order(order, (result[0].attribute() ? result[0].parent() : result[0].node()).root()); + + document_order = new pugi::xpath_node[order.size()]; + std::copy(order.begin(), order.end(), document_order); + + document_size = order.size(); + } } xpath_node_set_tester::~xpath_node_set_tester() { // check that we processed everything check(last == result.size()); + + delete[] document_order; } xpath_node_set_tester& xpath_node_set_tester::operator%(unsigned int expected) @@ -105,10 +151,8 @@ xpath_node_set_tester& xpath_node_set_tester::operator%(unsigned int expected) check(last < result.size()); // check document order - pugi::xpath_node node = result.begin()[last]; - unsigned int order = node.attribute() ? node.attribute().document_order() : node.node().document_order(); - - check(order == expected); + check(expected < document_size); + check(result.begin()[last] == document_order[expected]); // continue to the next element last++; diff --git a/tests/test.hpp b/tests/test.hpp index be42b8b..49fd3a1 100644 --- a/tests/test.hpp +++ b/tests/test.hpp @@ -45,13 +45,15 @@ bool test_xpath_fail_compile(const pugi::char_t* query); struct xpath_node_set_tester { + pugi::xpath_node* document_order; + size_t document_size; + pugi::xpath_node_set result; unsigned int last; const char* message; void check(bool condition); - xpath_node_set_tester(const pugi::xml_node& node, const pugi::char_t* query, const char* message); xpath_node_set_tester(const pugi::xpath_node_set& set, const char* message); ~xpath_node_set_tester(); @@ -123,7 +125,7 @@ struct dummy_fixture {}; #define CHECK_XPATH_NUMBER(node, query, expected) CHECK_TEXT(test_xpath_number(node, query, expected), STRINGIZE(query) " does not evaluate to " STRINGIZE(expected) " in context " STRINGIZE(node)) #define CHECK_XPATH_NUMBER_NAN(node, query) CHECK_TEXT(test_xpath_number_nan(node, query), STRINGIZE(query) " does not evaluate to NaN in context " STRINGIZE(node)) #define CHECK_XPATH_FAIL(query) CHECK_TEXT(test_xpath_fail_compile(query), STRINGIZE(query) " should not compile") -#define CHECK_XPATH_NODESET(node, query) xpath_node_set_tester(node, query, CHECK_JOIN2(STRINGIZE(query) " does not evaluate to expected set in context " STRINGIZE(node), " at "__FILE__ ":", __LINE__)) +#define CHECK_XPATH_NODESET(node, query) xpath_node_set_tester(node.select_nodes(query), CHECK_JOIN2(STRINGIZE(query) " does not evaluate to expected set in context " STRINGIZE(node), " at "__FILE__ ":", __LINE__)) #endif #define STR(text) PUGIXML_TEXT(text) diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 7ef34ec..e2c5edb 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -8,24 +8,6 @@ #include -TEST_XML(xpath_document_order, "test") -{ - CHECK(xml_node().document_order() == 0); - CHECK(doc.child(STR("node")).document_order() == 0); - CHECK(doc.document_order() == 0); - - doc.precompute_document_order(); - - CHECK(doc.document_order() == 1); - CHECK(doc.child(STR("node")).document_order() == 2); - CHECK(doc.child(STR("node")).child(STR("child1")).document_order() == 3); - CHECK(doc.child(STR("node")).child(STR("child1")).attribute(STR("attr1")).document_order() == 4); - CHECK(doc.child(STR("node")).child(STR("child1")).attribute(STR("attr2")).document_order() == 5); - CHECK(doc.child(STR("node")).child(STR("child2")).document_order() == 6); - CHECK(doc.child(STR("node")).child(STR("child2")).attribute(STR("attr1")).document_order() == 7); - CHECK(doc.child(STR("node")).child(STR("child2")).first_child().document_order() == 8); -} - TEST(xpath_allocator_many_pages) { pugi::string_t query = STR("0"); @@ -55,8 +37,6 @@ TEST_XML(xpath_sort_complex, "") ns.sort(false); xpath_node_set sorted = ns; - doc.precompute_document_order(); - xpath_node_set_tester(sorted, "sorted order failed") % 3 % 4 % 5; xpath_node_set_tester(reverse_sorted, "reverse sorted order failed") % 5 % 4 % 3; } diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp index d7cc094..453220d 100644 --- a/tests/test_xpath_api.cpp +++ b/tests/test_xpath_api.cpp @@ -8,28 +8,24 @@ TEST_XML(xpath_api_select_nodes, "") { - doc.precompute_document_order(); - xpath_node_set ns1 = doc.select_nodes(STR("node/foo")); xpath_query q(STR("node/foo")); xpath_node_set ns2 = doc.select_nodes(q); - CHECK(ns1.size() == 2 && ns1[0].node().document_order() == 4 && ns1[1].node().document_order() == 5); - CHECK(ns2.size() == 2 && ns2[0].node().document_order() == 4 && ns2[1].node().document_order() == 5); + xpath_node_set_tester(ns1, "ns1") % 4 % 5; + xpath_node_set_tester(ns2, "ns2") % 4 % 5; } -TEST_XML(xpath_api_select_single_node, "") +TEST_XML(xpath_api_select_single_node, "") { - doc.precompute_document_order(); - xpath_node n1 = doc.select_single_node(STR("node/foo")); xpath_query q(STR("node/foo")); xpath_node n2 = doc.select_single_node(q); - CHECK(n1.node().document_order() == 4); - CHECK(n2.node().document_order() == 4); + CHECK(n1.node().attribute(STR("id")).as_int() == 1); + CHECK(n2.node().attribute(STR("id")).as_int() == 1); xpath_node n3 = doc.select_single_node(STR("node/bar")); @@ -38,8 +34,8 @@ TEST_XML(xpath_api_select_single_node, "" xpath_node n4 = doc.select_single_node(STR("node/head/following-sibling::foo")); xpath_node n5 = doc.select_single_node(STR("node/tail/preceding-sibling::foo")); - CHECK(n4.node().document_order() == 4); - CHECK(n5.node().document_order() == 4); + CHECK(n4.node().attribute(STR("id")).as_int() == 1); + CHECK(n5.node().attribute(STR("id")).as_int() == 1); } TEST(xpath_api_exception_what) diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp index ed18e5f..7e98181 100644 --- a/tests/test_xpath_functions.cpp +++ b/tests/test_xpath_functions.cpp @@ -504,8 +504,6 @@ TEST(xpath_string_translate) TEST_XML(xpath_nodeset_last, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")); // last with 0 arguments @@ -520,8 +518,6 @@ TEST_XML(xpath_nodeset_last, "") TEST_XML(xpath_nodeset_position, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")); // position with 0 arguments diff --git a/tests/test_xpath_operators.cpp b/tests/test_xpath_operators.cpp index 79202a7..3c1f69c 100644 --- a/tests/test_xpath_operators.cpp +++ b/tests/test_xpath_operators.cpp @@ -404,8 +404,6 @@ TEST(xpath_operators_boolean_precedence) TEST_XML(xpath_operators_union, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp index 47ebada..4da3989 100644 --- a/tests/test_xpath_paths.cpp +++ b/tests/test_xpath_paths.cpp @@ -4,8 +4,6 @@ TEST_XML(xpath_paths_axes_child, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -17,8 +15,6 @@ TEST_XML(xpath_paths_axes_child, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -32,8 +28,6 @@ TEST_XML(xpath_paths_axes_descendant, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -48,8 +42,6 @@ TEST_XML(xpath_paths_axes_parent, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -64,8 +56,6 @@ TEST_XML(xpath_paths_axes_ancestor, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -78,8 +68,6 @@ TEST_XML(xpath_paths_axes_following_sibling, " TEST_XML(xpath_paths_axes_preceding_sibling, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -92,8 +80,6 @@ TEST_XML(xpath_paths_axes_preceding_sibling, " TEST_XML(xpath_paths_axes_following, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -107,8 +93,6 @@ TEST_XML(xpath_paths_axes_following, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -122,8 +106,6 @@ TEST_XML(xpath_paths_axes_preceding, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -145,8 +127,6 @@ TEST_XML(xpath_paths_axes_namespace, "") TEST_XML(xpath_paths_axes_self, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -161,8 +141,6 @@ TEST_XML(xpath_paths_axes_self, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -176,8 +154,6 @@ TEST_XML(xpath_paths_axes_descendant_or_self, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -192,8 +168,6 @@ TEST_XML(xpath_paths_axes_ancestor_or_self, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -213,8 +187,6 @@ TEST_XML(xpath_paths_axes_abbrev, "") TEST_XML(xpath_paths_nodetest_all, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -228,8 +200,6 @@ TEST_XML(xpath_paths_nodetest_all, "", parse_default | parse_pi) { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -249,8 +219,6 @@ TEST_XML_FLAGS(xpath_paths_nodetest_name, "< TEST_XML(xpath_paths_nodetest_all_in_namespace, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -269,8 +237,6 @@ TEST_XML(xpath_paths_nodetest_all_in_namespace, "pcdata", parse_default | parse_pi | parse_comments) { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -305,8 +271,6 @@ TEST_XML_FLAGS(xpath_paths_nodetest_type, "pcdata") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -322,8 +286,6 @@ TEST_XML(xpath_paths_absolute, "") TEST_XML(xpath_paths_step_abbrev, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -341,8 +303,6 @@ TEST_XML(xpath_paths_step_abbrev, "") TEST_XML(xpath_paths_relative_abbrev, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -355,8 +315,6 @@ TEST_XML(xpath_paths_relative_abbrev, "") TEST_XML(xpath_paths_absolute_abbrev, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -369,8 +327,6 @@ TEST_XML(xpath_paths_absolute_abbrev, "") TEST_XML(xpath_paths_predicate_boolean, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[position()=1]")) % 6; @@ -381,8 +337,6 @@ TEST_XML(xpath_paths_predicate_boolean, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1]")) % 6; @@ -393,8 +347,6 @@ TEST_XML(xpath_paths_predicate_number, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")); CHECK_XPATH_NODESET(n, STR("employee")) % 3 % 4 % 6 % 8 % 11; @@ -407,8 +359,6 @@ TEST_XML(xpath_paths_predicate_several, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[position()=1]")) % 6; @@ -419,8 +369,6 @@ TEST_XML(xpath_paths_predicate_filter_boolean, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[1]")) % 6; @@ -431,8 +379,6 @@ TEST_XML(xpath_paths_predicate_filter_number, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")); CHECK_XPATH_NODESET(n, STR("employee")) % 3 % 4 % 6 % 8 % 11; @@ -442,8 +388,6 @@ TEST_XML(xpath_paths_predicate_filter_posinv, "") { - doc.precompute_document_order(); - xml_node n = doc.child(STR("node")); CHECK_XPATH_NODESET(n, STR("(.)/foo")) % 3 % 6; @@ -456,8 +400,6 @@ TEST_XML(xpath_paths_step_compose, "") TEST_XML(xpath_paths_descendant_double_slash_w3c, "") { - doc.precompute_document_order(); - CHECK_XPATH_NODESET(doc, STR("//para")) % 3 % 4 % 5 % 6 % 7 % 8; CHECK_XPATH_NODESET(doc, STR("/descendant::para")) % 3 % 4 % 5 % 6 % 7 % 8; CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3 % 4 % 7; @@ -466,8 +408,6 @@ TEST_XML(xpath_paths_descendant_double_slash_w3c, "") { - doc.precompute_document_order(); - CHECK_XPATH_NODESET(doc, STR("(node/child/subchild)[2]")) % 7; } diff --git a/tests/test_xpath_paths_abbrev_w3c.cpp b/tests/test_xpath_paths_abbrev_w3c.cpp index 7fd092c..ebd13aa 100644 --- a/tests/test_xpath_paths_abbrev_w3c.cpp +++ b/tests/test_xpath_paths_abbrev_w3c.cpp @@ -4,8 +4,6 @@ TEST_XML(xpath_paths_abbrev_w3c_1, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -15,8 +13,6 @@ TEST_XML(xpath_paths_abbrev_w3c_1, "") TEST_XML(xpath_paths_abbrev_w3c_2, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -26,8 +22,6 @@ TEST_XML(xpath_paths_abbrev_w3c_2, "") TEST_XML(xpath_paths_abbrev_w3c_3, "pcdata") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -37,8 +31,6 @@ TEST_XML(xpath_paths_abbrev_w3c_3, "pcdata TEST_XML(xpath_paths_abbrev_w3c_4, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -48,8 +40,6 @@ TEST_XML(xpath_paths_abbrev_w3c_4, "") TEST_XML(xpath_paths_abbrev_w3c_5, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -59,8 +49,6 @@ TEST_XML(xpath_paths_abbrev_w3c_5, "") TEST_XML(xpath_paths_abbrev_w3c_6, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -70,8 +58,6 @@ TEST_XML(xpath_paths_abbrev_w3c_6, "") TEST_XML(xpath_paths_abbrev_w3c_7, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -81,8 +67,6 @@ TEST_XML(xpath_paths_abbrev_w3c_7, "") TEST_XML(xpath_paths_abbrev_w3c_8, "") { - doc.precompute_document_order(); - xml_node c; CHECK_XPATH_NODESET(c, STR("*/para")); @@ -91,8 +75,6 @@ TEST_XML(xpath_paths_abbrev_w3c_8, " TEST_XML(xpath_paths_abbrev_w3c_9, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("doc")).child(STR("chapter")); @@ -103,8 +85,6 @@ TEST_XML(xpath_paths_abbrev_w3c_9, "") { - doc.precompute_document_order(); - xml_node c; CHECK_XPATH_NODESET(c, STR("chapter//para")); @@ -113,8 +93,6 @@ TEST_XML(xpath_paths_abbrev_w3c_10, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -125,8 +103,6 @@ TEST_XML(xpath_paths_abbrev_w3c_11, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -137,8 +113,6 @@ TEST_XML(xpath_paths_abbrev_w3c_12, "< TEST_XML(xpath_paths_abbrev_w3c_13, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -149,8 +123,6 @@ TEST_XML(xpath_paths_abbrev_w3c_13, "") TEST_XML(xpath_paths_abbrev_w3c_14, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -161,8 +133,6 @@ TEST_XML(xpath_paths_abbrev_w3c_14, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -173,8 +143,6 @@ TEST_XML(xpath_paths_abbrev_w3c_15, "") TEST_XML(xpath_paths_abbrev_w3c_16, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -185,8 +153,6 @@ TEST_XML(xpath_paths_abbrev_w3c_16, "") TEST_XML(xpath_paths_abbrev_w3c_17, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -196,8 +162,6 @@ TEST_XML(xpath_paths_abbrev_w3c_17, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -207,8 +171,6 @@ TEST_XML(xpath_paths_abbrev_w3c_18, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -218,8 +180,6 @@ TEST_XML(xpath_paths_abbrev_w3c_19a, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -229,8 +189,6 @@ TEST_XML(xpath_paths_abbrev_w3c_19b, "fooIntroductionintroductionIntroductionfoo") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -240,8 +198,6 @@ TEST_XML(xpath_paths_abbrev_w3c_20, "foo TEST_XML(xpath_paths_abbrev_w3c_21, "fooIntroductionintroductionIntroductionfoo") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -251,8 +207,6 @@ TEST_XML(xpath_paths_abbrev_w3c_21, "foo TEST_XML(xpath_paths_abbrev_w3c_22, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); diff --git a/tests/test_xpath_paths_w3c.cpp b/tests/test_xpath_paths_w3c.cpp index 75b9637..d3f1554 100644 --- a/tests/test_xpath_paths_w3c.cpp +++ b/tests/test_xpath_paths_w3c.cpp @@ -4,8 +4,6 @@ TEST_XML(xpath_paths_w3c_1, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -15,8 +13,6 @@ TEST_XML(xpath_paths_w3c_1, "") TEST_XML(xpath_paths_w3c_2, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -26,8 +22,6 @@ TEST_XML(xpath_paths_w3c_2, "") TEST_XML(xpath_paths_w3c_3, "pcdata") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -37,8 +31,6 @@ TEST_XML(xpath_paths_w3c_3, "pcdata") TEST_XML(xpath_paths_w3c_4, "pcdata") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -48,8 +40,6 @@ TEST_XML(xpath_paths_w3c_4, "pcdata") TEST_XML(xpath_paths_w3c_5, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -59,8 +49,6 @@ TEST_XML(xpath_paths_w3c_5, "") TEST_XML(xpath_paths_w3c_6, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -70,8 +58,6 @@ TEST_XML(xpath_paths_w3c_6, "") TEST_XML(xpath_paths_w3c_7, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -82,8 +68,6 @@ TEST_XML(xpath_paths_w3c_7, " TEST_XML(xpath_paths_w3c_8, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -93,8 +77,6 @@ TEST_XML(xpath_paths_w3c_8, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -104,8 +86,6 @@ TEST_XML(xpath_paths_w3c_9, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -116,8 +96,6 @@ TEST_XML(xpath_paths_w3c_10, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -128,8 +106,6 @@ TEST_XML(xpath_paths_w3c_11, "") { - doc.precompute_document_order(); - xml_node c; CHECK_XPATH_NODESET(c, STR("child::chapter/descendant::para")); @@ -138,8 +114,6 @@ TEST_XML(xpath_paths_w3c_12, "

") { - doc.precompute_document_order(); - xml_node c; CHECK_XPATH_NODESET(c, STR("child::*/child::para")); @@ -148,8 +122,6 @@ TEST_XML(xpath_paths_w3c_13, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -162,8 +134,6 @@ TEST_XML(xpath_paths_w3c_14, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -174,8 +144,6 @@ TEST_XML(xpath_paths_w3c_15, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -186,8 +154,6 @@ TEST_XML(xpath_paths_w3c_16, "< TEST_XML(xpath_paths_w3c_17, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -197,8 +163,6 @@ TEST_XML(xpath_paths_w3c_17, "") TEST_XML(xpath_paths_w3c_18, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -208,8 +172,6 @@ TEST_XML(xpath_paths_w3c_18, "") TEST_XML(xpath_paths_w3c_19, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -219,8 +181,6 @@ TEST_XML(xpath_paths_w3c_19, "") TEST_XML(xpath_paths_w3c_20, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -230,8 +190,6 @@ TEST_XML(xpath_paths_w3c_20, "") TEST_XML(xpath_paths_w3c_21, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); @@ -241,8 +199,6 @@ TEST_XML(xpath_paths_w3c_21, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling(); @@ -252,8 +208,6 @@ TEST_XML(xpath_paths_w3c_22, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -264,8 +218,6 @@ TEST_XML(xpath_paths_w3c_23, "
") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("doc")).child(STR("chapter")); @@ -276,8 +228,6 @@ TEST_XML(xpath_paths_w3c_24, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -287,8 +237,6 @@ TEST_XML(xpath_paths_w3c_25, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -298,8 +246,6 @@ TEST_XML(xpath_paths_w3c_26, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -309,8 +255,6 @@ TEST_XML(xpath_paths_w3c_27a, "") { - doc.precompute_document_order(); - xml_node c; xml_node n = doc.child(STR("node")); @@ -320,8 +264,6 @@ TEST_XML(xpath_paths_w3c_27b, "