summaryrefslogtreecommitdiff
path: root/tests/test_dom_traverse.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-21 19:44:19 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-21 19:44:19 -0700
commit4eadece45f559825b236709ffb92037c6af5e962 (patch)
tree70d5300e82b6e5e733c8674c0984951e42fdba56 /tests/test_dom_traverse.cpp
parent83b894b8f17e8c09eb21675983be0656301d2d99 (diff)
tests: Add move semantics tests
Also test ranged for and copying big xpath_variable_set objects (to make sure we actually handle hash collisions properly)
Diffstat (limited to 'tests/test_dom_traverse.cpp')
-rw-r--r--tests/test_dom_traverse.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index 4423dbe..e4b8c44 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -1106,3 +1106,27 @@ TEST_XML(dom_unspecified_bool_coverage, "<node attr='value'>text</node>")
static_cast<void (*)(xpath_node***)>(qn)(0);
#endif
}
+
+#if __cplusplus >= 201103
+TEST_XML(dom_ranged_for, "<node attr1='1' attr2='2'><test>3</test><fake>5</fake><test>4</test></node>")
+{
+ int index = 1;
+
+ for (xml_node n: doc.children())
+ {
+ for (xml_attribute a: n.attributes())
+ {
+ CHECK(a.as_int() == index);
+ index++;
+ }
+
+ for (xml_node c: n.children(STR("test")))
+ {
+ CHECK(c.text().as_int() == index);
+ index++;
+ }
+ }
+
+ CHECK(index == 5);
+}
+#endif