From cfb7d46246ae785f844312214768eca049fbb7fc Mon Sep 17 00:00:00 2001 From: beder Date: Tue, 8 May 2012 12:30:02 -0500 Subject: [PATCH] Added test for BOOST_FOREACH on a map --- test/new-api/nodetests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/new-api/nodetests.cpp b/test/new-api/nodetests.cpp index 121b6e0..ee40110 100644 --- a/test/new-api/nodetests.cpp +++ b/test/new-api/nodetests.cpp @@ -364,6 +364,15 @@ namespace Test } return true; } + + TEST ForEachMap() + { + YAML::Node node = YAML::Load("{a: A, b: B, c: C}"); + BOOST_FOREACH(const YAML::const_iterator::value_type &p, node) { + YAML_ASSERT(p.first.as() + 'A' - 'a' == p.second.as()); + } + return true; + } } void RunNodeTest(TEST (*test)(), const std::string& name, int& passed, int& total) { @@ -416,6 +425,7 @@ namespace Test RunNodeTest(&Node::IterateSequence, "iterate sequence", passed, total); RunNodeTest(&Node::IterateMap, "iterate map", passed, total); RunNodeTest(&Node::ForEach, "for each", passed, total); + RunNodeTest(&Node::ForEachMap, "for each map", passed, total); std::cout << "Node tests: " << passed << "/" << total << " passed\n"; return passed == total;