Commit 25881c4f authored by Jesse Beder's avatar Jesse Beder
Browse files

Add ifdef to check if BOOST_FOREACH is defined, and disable tests that use it...

Add ifdef to check if BOOST_FOREACH is defined, and disable tests that use it if it is not available
parent 0305ad13
#include "nodetests.h" #include "nodetests.h"
#include "yaml-cpp/yaml.h" #include "yaml-cpp/yaml.h"
#include <boost/foreach.hpp>
#include <iostream> #include <iostream>
#include <boost/version.hpp>
#if BOOST_VERSION >= 103400
#include <boost/foreach.hpp>
#endif
namespace { namespace {
struct TEST { struct TEST {
TEST(): ok(false) {} TEST(): ok(false) {}
...@@ -382,7 +387,8 @@ namespace Test ...@@ -382,7 +387,8 @@ namespace Test
YAML_ASSERT(i == 3); YAML_ASSERT(i == 3);
return true; return true;
} }
#ifdef BOOST_FOREACH
TEST ForEach() TEST ForEach()
{ {
YAML::Node node = YAML::Load("[1, 3, 5, 7]"); YAML::Node node = YAML::Load("[1, 3, 5, 7]");
...@@ -403,6 +409,7 @@ namespace Test ...@@ -403,6 +409,7 @@ namespace Test
} }
return true; return true;
} }
#endif
TEST CloneScalar() TEST CloneScalar()
{ {
...@@ -568,8 +575,10 @@ namespace Test ...@@ -568,8 +575,10 @@ namespace Test
RunNodeTest(&Node::Binary, "binary", passed, total); RunNodeTest(&Node::Binary, "binary", passed, total);
RunNodeTest(&Node::IterateSequence, "iterate sequence", passed, total); RunNodeTest(&Node::IterateSequence, "iterate sequence", passed, total);
RunNodeTest(&Node::IterateMap, "iterate map", passed, total); RunNodeTest(&Node::IterateMap, "iterate map", passed, total);
#ifdef BOOST_FOREACH
RunNodeTest(&Node::ForEach, "for each", passed, total); RunNodeTest(&Node::ForEach, "for each", passed, total);
RunNodeTest(&Node::ForEachMap, "for each map", passed, total); RunNodeTest(&Node::ForEachMap, "for each map", passed, total);
#endif
RunNodeTest(&Node::CloneScalar, "clone scalar", passed, total); RunNodeTest(&Node::CloneScalar, "clone scalar", passed, total);
RunNodeTest(&Node::CloneSeq, "clone seq", passed, total); RunNodeTest(&Node::CloneSeq, "clone seq", passed, total);
RunNodeTest(&Node::CloneMap, "clone map", passed, total); RunNodeTest(&Node::CloneMap, "clone map", passed, total);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment