diff options
author | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-14 05:34:29 +0000 |
---|---|---|
committer | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-14 05:34:29 +0000 |
commit | 35ea9a6088222823998bcce99367a32abc455f67 (patch) | |
tree | 11a1cd5a5a4e1e8d26e6e021e0c710885fff20cc /tests | |
parent | e4ae72937054324ccee6d67579d4fb7040d916dc (diff) |
tests: Added tests for constant iterator objects
git-svn-id: http://pugixml.googlecode.com/svn/trunk@859 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_dom_traverse.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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, "<node><node1 attr1='0'/><node2 attr1='0' CHECK(node2.attributes_end() == it3); } +TEST_XML(dom_attr_iterator_const, "<node attr1='0' attr2='1'/>") +{ + 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, "<node/>") { generic_bool_ops_test(doc.child(STR("node"))); @@ -334,6 +350,22 @@ TEST_XML(dom_node_iterator_invalidate, "<node><node1><child1/></node1><node2><ch CHECK(node2.end() == it3); } +TEST_XML(dom_node_iterator_const, "<node><child1/><child2/></node>") +{ + 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, "<node><child/></node>") { CHECK(xml_node().parent() == xml_node()); |