summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-20 20:34:28 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-20 20:34:28 -0700
commitd7ac5e2e0cb0521af1628e95774ad418af82af58 (patch)
tree2fca26ab47941b0511de460de0fc58f0a2882024 /tests
parentfcd1876a21593bd62580383874b57c734d629a0c (diff)
parent7258aea09be1847b3dcc99ca389990027d4a92d3 (diff)
Merge branch 'master' into compact
Diffstat (limited to 'tests')
-rw-r--r--tests/allocator.cpp3
-rw-r--r--tests/main.cpp1
-rw-r--r--tests/test_dom_traverse.cpp16
-rw-r--r--tests/test_write.cpp23
-rw-r--r--tests/test_xpath.cpp22
-rw-r--r--tests/test_xpath_api.cpp65
-rw-r--r--tests/test_xpath_functions.cpp4
-rw-r--r--tests/test_xpath_paths.cpp84
-rw-r--r--tests/test_xpath_variables.cpp2
-rw-r--r--tests/test_xpath_xalan_3.cpp16
10 files changed, 211 insertions, 25 deletions
diff --git a/tests/allocator.cpp b/tests/allocator.cpp
index 3641585..094d5e5 100644
--- a/tests/allocator.cpp
+++ b/tests/allocator.cpp
@@ -1,6 +1,7 @@
#include "allocator.hpp"
#include <string.h>
+#include <assert.h>
// Low-level allocation functions
#if defined(_WIN32) || defined(_WIN64)
@@ -97,6 +98,8 @@ void* memory_allocate(size_t size)
size_t memory_size(void* ptr)
{
+ assert(ptr);
+
size_t result;
memcpy(&result, static_cast<size_t*>(ptr) - 1, sizeof(size_t));
diff --git a/tests/main.cpp b/tests/main.cpp
index 3bcf9be..75b0108 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -34,6 +34,7 @@ static void* custom_allocate(size_t size)
else
{
void* ptr = memory_allocate(size);
+ assert(ptr);
g_memory_total_size += memory_size(ptr);
g_memory_total_count++;
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index c2437ab..e42846f 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -1043,3 +1043,19 @@ TEST_XML(dom_node_children_attributes, "<node1 attr1='value1' attr2='value2' /><
CHECK(r4.begin() == xml_attribute_iterator());
CHECK(r4.end() == xml_attribute_iterator());
}
+
+TEST_XML(dom_unspecified_bool_coverage, "<node attr='value'>text</node>")
+{
+ xml_node node = doc.first_child();
+
+ node(0);
+ node.first_attribute()(0);
+ node.text()(0);
+
+#ifndef PUGIXML_NO_XPATH
+ xpath_query q(STR("/node"));
+
+ q(0);
+ q.evaluate_node(doc)(0);
+#endif
+}
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index 0c20e26..98650ac 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -57,6 +57,29 @@ TEST_XML_FLAGS(write_comment, "<!--text-->", parse_comments | parse_fragment)
CHECK_NODE_EX(doc, STR("<!--text-->\n"), STR(""), 0);
}
+TEST(write_comment_invalid)
+{
+ xml_document doc;
+ xml_node child = doc.append_child(node_comment);
+
+ CHECK_NODE(doc, STR("<!---->"));
+
+ child.set_value(STR("-"));
+ CHECK_NODE(doc, STR("<!--- -->"));
+
+ child.set_value(STR("--"));
+ CHECK_NODE(doc, STR("<!--- - -->"));
+
+ child.set_value(STR("---"));
+ CHECK_NODE(doc, STR("<!--- - - -->"));
+
+ child.set_value(STR("-->"));
+ CHECK_NODE(doc, STR("<!--- ->-->"));
+
+ child.set_value(STR("-->-"));
+ CHECK_NODE(doc, STR("<!--- ->- -->"));
+}
+
TEST_XML_FLAGS(write_pi, "<?name value?>", parse_pi | parse_fragment)
{
CHECK_NODE(doc, STR("<?name value?>"));
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;
diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp
index d831712..270f6aa 100644
--- a/tests/test_xpath_api.cpp
+++ b/tests/test_xpath_api.cpp
@@ -19,22 +19,22 @@ TEST_XML(xpath_api_select_nodes, "<node><head/><foo/><foo/><tail/></node>")
xpath_node_set_tester(ns2, "ns2") % 4 % 5;
}
-TEST_XML(xpath_api_select_single_node, "<node><head/><foo id='1'/><foo/><tail/></node>")
+TEST_XML(xpath_api_select_node, "<node><head/><foo id='1'/><foo/><tail/></node>")
{
- xpath_node n1 = doc.select_single_node(STR("node/foo"));
+ xpath_node n1 = doc.select_node(STR("node/foo"));
xpath_query q(STR("node/foo"));
- xpath_node n2 = doc.select_single_node(q);
+ xpath_node n2 = doc.select_node(q);
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"));
+ xpath_node n3 = doc.select_node(STR("node/bar"));
CHECK(!n3);
- 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"));
+ xpath_node n4 = doc.select_node(STR("node/head/following-sibling::foo"));
+ xpath_node n5 = doc.select_node(STR("node/tail/preceding-sibling::foo"));
CHECK(n4.node().attribute(STR("id")).as_int() == 1);
CHECK(n5.node().attribute(STR("id")).as_int() == 1);
@@ -42,20 +42,20 @@ TEST_XML(xpath_api_select_single_node, "<node><head/><foo id='1'/><foo/><tail/><
TEST_XML(xpath_api_node_bool_ops, "<node attr='value'/>")
{
- generic_bool_ops_test(doc.select_single_node(STR("node")));
- generic_bool_ops_test(doc.select_single_node(STR("node/@attr")));
+ generic_bool_ops_test(doc.select_node(STR("node")));
+ generic_bool_ops_test(doc.select_node(STR("node/@attr")));
}
TEST_XML(xpath_api_node_eq_ops, "<node attr='value'/>")
{
- generic_eq_ops_test(doc.select_single_node(STR("node")), doc.select_single_node(STR("node/@attr")));
+ generic_eq_ops_test(doc.select_node(STR("node")), doc.select_node(STR("node/@attr")));
}
TEST_XML(xpath_api_node_accessors, "<node attr='value'/>")
{
xpath_node null;
- xpath_node node = doc.select_single_node(STR("node"));
- xpath_node attr = doc.select_single_node(STR("node/@attr"));
+ xpath_node node = doc.select_node(STR("node"));
+ xpath_node attr = doc.select_node(STR("node/@attr"));
CHECK(!null.node());
CHECK(!null.attribute());
@@ -154,6 +154,9 @@ TEST_XML(xpath_api_evaluate, "<node attr='3'/>")
xpath_node_set ns = q.evaluate_node_set(doc);
CHECK(ns.size() == 1 && ns[0].attribute() == doc.child(STR("node")).attribute(STR("attr")));
+
+ xpath_node nr = q.evaluate_node(doc);
+ CHECK(nr.attribute() == doc.child(STR("node")).attribute(STR("attr")));
}
TEST_XML(xpath_api_evaluate_attr, "<node attr='3'/>")
@@ -173,6 +176,9 @@ TEST_XML(xpath_api_evaluate_attr, "<node attr='3'/>")
xpath_node_set ns = q.evaluate_node_set(n);
CHECK(ns.size() == 1 && ns[0] == n);
+
+ xpath_node nr = q.evaluate_node(n);
+ CHECK(nr == n);
}
#ifdef PUGIXML_NO_EXCEPTIONS
@@ -190,18 +196,20 @@ TEST_XML(xpath_api_evaluate_fail, "<node attr='3'/>")
#endif
CHECK(q.evaluate_node_set(doc).empty());
+
+ CHECK(!q.evaluate_node(doc));
}
#endif
TEST(xpath_api_evaluate_node_set_fail)
{
+ xpath_query q(STR("1"));
+
#ifdef PUGIXML_NO_EXCEPTIONS
- CHECK_XPATH_NODESET(xml_node(), STR("1"));
+ CHECK(q.evaluate_node_set(xml_node()).empty());
#else
try
{
- xpath_query q(STR("1"));
-
q.evaluate_node_set(xml_node());
CHECK_FORCE_FAIL("Expected exception");
@@ -212,6 +220,25 @@ TEST(xpath_api_evaluate_node_set_fail)
#endif
}
+TEST(xpath_api_evaluate_node_fail)
+{
+ xpath_query q(STR("1"));
+
+#ifdef PUGIXML_NO_EXCEPTIONS
+ CHECK(!q.evaluate_node(xml_node()));
+#else
+ try
+ {
+ q.evaluate_node(xml_node());
+
+ CHECK_FORCE_FAIL("Expected exception");
+ }
+ catch (const xpath_exception&)
+ {
+ }
+#endif
+}
+
TEST(xpath_api_evaluate_string)
{
xpath_query q(STR("\"0123456789\""));
@@ -384,4 +411,14 @@ TEST_XML(xpath_api_node_set_assign_out_of_memory_preserve, "<node><a/><b/></node
}
#endif
+TEST_XML(xpath_api_deprecated_select_single_node, "<node><head/><foo id='1'/><foo/><tail/></node>")
+{
+ 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().attribute(STR("id")).as_int() == 1);
+ CHECK(n2.node().attribute(STR("id")).as_int() == 1);
+}
#endif
diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp
index f5d9e53..da820ef 100644
--- a/tests/test_xpath_functions.cpp
+++ b/tests/test_xpath_functions.cpp
@@ -114,7 +114,7 @@ TEST(xpath_number_ceiling)
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(0))"), STR("Infinity"));
// ceiling with argument in range (-1, -0] should result in minus zero
-#if !(defined(__APPLE__) && defined(__MACH__)) // MacOS X gcc 4.0.1 implements ceil incorrectly (ceil never returns -0)
+#if !(defined(__APPLE__) && defined(__MACH__)) && !defined(__CLR_VER) // MacOS X gcc 4.0.1 and x64 CLR implement ceil incorrectly (ceil never returns -0)
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(-0))"), STR("-Infinity"));
CHECK_XPATH_STRING(c, STR("string(1 div ceiling(-0.1))"), STR("-Infinity"));
#endif
@@ -145,7 +145,7 @@ TEST(xpath_number_round)
// round with argument in range [-0.5, -0] should result in minus zero
CHECK_XPATH_STRING(c, STR("string(1 div round(0))"), STR("Infinity"));
-#if !(defined(__APPLE__) && defined(__MACH__)) // MacOS X gcc 4.0.1 implements ceil incorrectly (ceil never returns -0)
+#if !(defined(__APPLE__) && defined(__MACH__)) && !defined(__CLR_VER) // MacOS X gcc 4.0.1 and x64 CLR implement ceil incorrectly (ceil never returns -0)
CHECK_XPATH_STRING(c, STR("string(1 div round(-0.5))"), STR("-Infinity"));
CHECK_XPATH_STRING(c, STR("string(1 div round(-0))"), STR("-Infinity"));
CHECK_XPATH_STRING(c, STR("string(1 div round(-0.1))"), STR("-Infinity"));
diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp
index c18acd2..f1d52ad 100644
--- a/tests/test_xpath_paths.cpp
+++ b/tests/test_xpath_paths.cpp
@@ -531,6 +531,27 @@ TEST_XML(xpath_paths_descendant_optimize, "<node><para><para/><para/><para><para
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[3]/child::para")) % 4 % 5 % 6;
}
+TEST_XML(xpath_paths_descendant_optimize_axes, "<node><para><para/><para/><para><para/></para></para><para/></node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("//.")) % 1 % 2 % 3 % 4 % 5 % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//descendant::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//descendant-or-self::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
+
+ CHECK_XPATH_NODESET(doc, STR("//..")) % 1 % 2 % 3 % 6;
+ CHECK_XPATH_NODESET(doc, STR("//ancestor::*")) % 2 % 3 % 6;
+ CHECK_XPATH_NODESET(doc, STR("//ancestor-or-self::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//preceding-sibling::*")) % 3 % 4 % 5;
+ CHECK_XPATH_NODESET(doc, STR("//following-sibling::*")) % 5 % 6 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//preceding::*")) % 3 % 4 % 5 % 6 % 7;
+ CHECK_XPATH_NODESET(doc, STR("//following::*")) % 5 % 6 % 7 % 8;
+}
+
+TEST_XML(xpath_paths_descendant_optimize_last, "<node><para><para/><para/><para><para/></para></para><para/></node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("//para[last()]")) % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//para[last() = 1]")) % 7;
+}
+
TEST_XML(xpath_paths_precision, "<node><para/><para/><para/><para/><para/></node>")
{
CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3;
@@ -555,4 +576,67 @@ TEST_XML(xpath_paths_unsorted_child, "<node><foo><bar/></foo><node><foo><bar/></
CHECK(ns[2] == nss[1]);
}
+TEST_XML(xpath_paths_optimize_compare_attribute, "<node id='1' /><node id='2' /><node xmlns='3' />")
+{
+ CHECK_XPATH_NODESET(doc, STR("node[@id = '1']")) % 2;
+ CHECK_XPATH_NODESET(doc, STR("node[@id = '2']")) % 4;
+ CHECK_XPATH_NODESET(doc, STR("node[@id = 2]")) % 4;
+ CHECK_XPATH_NODESET(doc, STR("node[@id[. > 3] = '2']"));
+ CHECK_XPATH_NODESET(doc, STR("node['1' = @id]")) % 2;
+
+ xpath_variable_set set;
+ set.set(STR("var1"), STR("2"));
+ set.set(STR("var2"), 2.0);
+
+ CHECK_XPATH_NODESET_VAR(doc, STR("node[@id = $var1]"), &set) % 4;
+ CHECK_XPATH_NODESET_VAR(doc, STR("node[@id = $var2]"), &set) % 4;
+
+ CHECK_XPATH_NODESET(doc, STR("node[@xmlns = '3']"));
+}
+
+TEST_XML(xpath_paths_optimize_step_once, "<node><para1><para2/><para3/><para4><para5 attr5=''/></para4></para1><para6/></node>")
+{
+ CHECK_XPATH_BOOLEAN(doc, STR("node//para2/following::*"), true);
+ CHECK_XPATH_BOOLEAN(doc, STR("node//para6/following::*"), false);
+
+ CHECK_XPATH_STRING(doc, STR("name(node//para2/following::*)"), STR("para3"));
+ CHECK_XPATH_STRING(doc, STR("name(node//para6/following::*)"), STR(""));
+
+ CHECK_XPATH_BOOLEAN(doc, STR("node//para1/preceding::*"), false);
+ CHECK_XPATH_BOOLEAN(doc, STR("node//para6/preceding::*"), true);
+
+ CHECK_XPATH_STRING(doc, STR("name(node//para1/preceding::*)"), STR(""));
+ CHECK_XPATH_STRING(doc, STR("name(node//para6/preceding::*)"), STR("para1"));
+
+ CHECK_XPATH_BOOLEAN(doc, STR("node//para6/preceding::para4"), true);
+
+ CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/ancestor-or-self::*"), true);
+ CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/ancestor::*"), true);
+
+ CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/following::para6"), true);
+ CHECK_XPATH_STRING(doc, STR("name(//@attr5/following::para6)"), STR("para6"));
+}
+
+TEST_XML(xpath_paths_null_nodeset_entries, "<node attr='value'/>")
+{
+ xpath_node nodes[] =
+ {
+ xpath_node(doc.first_child()),
+ xpath_node(xml_node()),
+ xpath_node(doc.first_child().first_attribute(), doc.first_child()),
+ xpath_node(xml_attribute(), doc.first_child()),
+ xpath_node(xml_attribute(), xml_node()),
+ };
+
+ xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]));
+
+ xpath_variable_set vars;
+ vars.set(STR("x"), ns);
+
+ xpath_node_set rs = xpath_query("$x/.", &vars).evaluate_node_set(xml_node());
+
+ CHECK(rs.size() == 2);
+ CHECK(rs[0] == nodes[0]);
+ CHECK(rs[1] == nodes[2]);
+}
#endif
diff --git a/tests/test_xpath_variables.cpp b/tests/test_xpath_variables.cpp
index 785a504..70bb4ea 100644
--- a/tests/test_xpath_variables.cpp
+++ b/tests/test_xpath_variables.cpp
@@ -281,7 +281,7 @@ TEST_XML(xpath_variables_select, "<node attr='1'/><node attr='2'/>")
xpath_node_set ns = doc.select_nodes(STR("node[@attr=$one+1]"), &set);
CHECK(ns.size() == 1 && ns[0].node() == doc.last_child());
- xpath_node n = doc.select_single_node(STR("node[@attr=$one+1]"), &set);
+ xpath_node n = doc.select_node(STR("node[@attr=$one+1]"), &set);
CHECK(n == ns[0]);
}
diff --git a/tests/test_xpath_xalan_3.cpp b/tests/test_xpath_xalan_3.cpp
index 54b8a62..d2df3e5 100644
--- a/tests/test_xpath_xalan_3.cpp
+++ b/tests/test_xpath_xalan_3.cpp
@@ -4,7 +4,7 @@
TEST_XML(xpath_xalan_axes_1, "<far-north><north-north-west1/><north-north-west2/><north><near-north><far-west/><west/><near-west/><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south-west/><near-south><south><far-south/></south></near-south><near-south-east/></center><near-east/><east/><far-east/></near-north></north><north-north-east1/><north-north-east2/></far-north>")
{
- xml_node center = doc.select_single_node(STR("//center")).node();
+ xml_node center = doc.select_node(STR("//center")).node();
CHECK_XPATH_NODESET(center, STR("self::*[near-south]")) % 10;
CHECK_XPATH_NODESET(center, STR("self::*[@center-attr-2]")) % 10;
@@ -35,7 +35,7 @@ TEST_XML(xpath_xalan_axes_1, "<far-north><north-north-west1/><north-north-west2/
TEST_XML_FLAGS(xpath_xalan_axes_2, "<far-north> Level-1<north-north-west1/><north-north-west2/><!-- Comment-2 --> Level-2<?a-pi pi-2?><north><!-- Comment-3 --> Level-3<?a-pi pi-3?><near-north><far-west/><west/><near-west/><!-- Comment-4 --> Level-4<?a-pi pi-4?><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south-west/><!--Comment-5--> Level-5<?a-pi pi-5?><near-south><!--Comment-6--> Level-6<?a-pi pi-6?><south attr1='First' attr2='Last'> <far-south/></south></near-south><near-south-east/></center><near-east/><east/><far-east/></near-north></north><north-north-east1/><north-north-east2/></far-north>", parse_default | parse_comments | parse_pi)
{
- xml_node center = doc.select_single_node(STR("//center")).node();
+ xml_node center = doc.select_node(STR("//center")).node();
CHECK_XPATH_NODESET(center, STR("@*")) % 21 % 22 % 23;
CHECK_XPATH_NODESET(center, STR("@*/child::*"));
@@ -65,7 +65,7 @@ TEST_XML_FLAGS(xpath_xalan_axes_2, "<far-north> Level-1<north-north-west1/><nort
TEST_XML(xpath_xalan_axes_3, "<far-north><north><near-north><far-west/><west/><near-west/><center><near-south><south><far-south/></south></near-south></center><near-east/><east/><far-east/></near-north></north></far-north>")
{
- xml_node center = doc.select_single_node(STR("//center")).node();
+ xml_node center = doc.select_node(STR("//center")).node();
CHECK_XPATH_NODESET(center, STR("ancestor-or-self::*")) % 8 % 4 % 3 % 2;
CHECK_XPATH_NODESET(center, STR("ancestor::*[3]")) % 2;
@@ -99,7 +99,7 @@ TEST_XML(xpath_xalan_axes_3, "<far-north><north><near-north><far-west/><west/><n
TEST_XML(xpath_xalan_axes_4, "<far-north><north><near-north><far-west/><west/><near-west/><center><near-south><south><far-south/></south></near-south></center><near-east/><east/><far-east/></near-north></north></far-north>")
{
- xml_node north = doc.select_single_node(STR("//north")).node();
+ xml_node north = doc.select_node(STR("//north")).node();
CHECK_XPATH_STRING(north, STR("name(/descendant-or-self::north)"), STR("north"));
CHECK_XPATH_STRING(north, STR("name(/descendant::near-north)"), STR("near-north"));
@@ -166,7 +166,7 @@ TEST_XML(xpath_xalan_axes_6, "<doc><T>Test for source tree depth</T><a><T>A</T><
TEST_XML(xpath_xalan_axes_7, "<far-north><north><near-north><far-west/><west/><near-west/><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south><south><far-south/></south></near-south></center><near-east/><east/><far-east/></near-north></north></far-north>")
{
- xml_node center = doc.select_single_node(STR("//center")).node();
+ xml_node center = doc.select_node(STR("//center")).node();
CHECK_XPATH_NODESET(center, STR("attribute::*[2]")) % 10;
CHECK_XPATH_NODESET(center, STR("@*")) % 9 % 10 % 11;
@@ -177,7 +177,7 @@ TEST_XML(xpath_xalan_axes_7, "<far-north><north><near-north><far-west/><west/><n
TEST_XML(xpath_xalan_axes_8, "<far-north><north><near-north><far-west/><west/><near-west/><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south-east/><near-south><south><far-south/></south></near-south><near-south-west/></center><near-east/><east/><far-east/></near-north></north></far-north>")
{
- xml_node near_north = doc.select_single_node(STR("//near-north")).node();
+ xml_node near_north = doc.select_node(STR("//near-north")).node();
CHECK_XPATH_NODESET(near_north, STR("center//child::*")) % 12 % 13 % 14 % 15 % 16;
CHECK_XPATH_NODESET(near_north, STR("center//descendant::*")) % 12 % 13 % 14 % 15 % 16;
@@ -188,7 +188,7 @@ TEST_XML(xpath_xalan_axes_8, "<far-north><north><near-north><far-west/><west/><n
TEST_XML(xpath_xalan_axes_9, "<doc><foo att1='c'><foo att1='b'><foo att1='a'><baz/></foo></foo></foo><bar/></doc>")
{
- xml_node baz = doc.select_single_node(STR("//baz")).node();
+ xml_node baz = doc.select_node(STR("//baz")).node();
CHECK_XPATH_NODESET(baz, STR("ancestor-or-self::*[@att1][1]/@att1")) % 8;
CHECK_XPATH_NODESET(baz, STR("(ancestor-or-self::*)[@att1][1]/@att1")) % 4;
@@ -243,7 +243,7 @@ TEST_XML_FLAGS(xpath_xalan_axes_12, "<far-north><north>north-text1<near-north><f
TEST_XML(xpath_xalan_axes_13, "<doc att1='e'><foo att1='d'><foo att1='c'><foo att1='b'><baz att1='a'/></foo></foo></foo></doc>")
{
xml_node d = doc.child(STR("doc"));
- xml_node baz = doc.select_single_node(STR("//baz")).node();
+ xml_node baz = doc.select_node(STR("//baz")).node();
CHECK_XPATH_NUMBER(d, STR("count(descendant-or-self::*/@att1)"), 5);
CHECK_XPATH_NODESET(d, STR("descendant-or-self::*/@att1[last()]")) % 3 % 5 % 7 % 9 % 11;