From 35ea9a6088222823998bcce99367a32abc455f67 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Wed, 14 Mar 2012 05:34:29 +0000 Subject: tests: Added tests for constant iterator objects git-svn-id: http://pugixml.googlecode.com/svn/trunk@859 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_dom_traverse.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/test_dom_traverse.cpp') diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 173c430..f6a2495 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -228,6 +228,22 @@ TEST_XML(dom_attr_iterator_invalidate, "") +{ + pugi::xml_node node = doc.child(STR("node")); + + const pugi::xml_attribute_iterator i1 = node.attributes_begin(); + const pugi::xml_attribute_iterator i2 = ++xml_attribute_iterator(i1); + const pugi::xml_attribute_iterator i3 = ++xml_attribute_iterator(i2); + + CHECK(*i1 == node.attribute(STR("attr1"))); + CHECK(*i2 == node.attribute(STR("attr2"))); + CHECK(i3 == node.attributes_end()); + + CHECK_STRING(i1->name(), STR("attr1")); + CHECK_STRING(i2->name(), STR("attr2")); +} + TEST_XML(dom_node_bool_ops, "") { generic_bool_ops_test(doc.child(STR("node"))); @@ -334,6 +350,22 @@ TEST_XML(dom_node_iterator_invalidate, "") +{ + pugi::xml_node node = doc.child(STR("node")); + + const pugi::xml_node_iterator i1 = node.begin(); + const pugi::xml_node_iterator i2 = ++xml_node_iterator(i1); + const pugi::xml_node_iterator i3 = ++xml_node_iterator(i2); + + CHECK(*i1 == node.child(STR("child1"))); + CHECK(*i2 == node.child(STR("child2"))); + CHECK(i3 == node.end()); + + CHECK_STRING(i1->name(), STR("child1")); + CHECK_STRING(i2->name(), STR("child2")); +} + TEST_XML(dom_node_parent, "") { CHECK(xml_node().parent() == xml_node()); -- cgit v1.2.3