diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp index 726747bcd6e93b8ad5a65df37b033e39d0b62c01..c97ed98083ad68112464e3e62782e9b52d31824d 100644 --- a/Tests/BaseLib/TestConfigTree.cpp +++ b/Tests/BaseLib/TestConfigTree.cpp @@ -14,6 +14,7 @@ #include <sstream> #include "BaseLib/ConfigTree.h" +#include "Tests/TestTools.h" // make useful line numbers appear in the output of gtest #define EXPECT_ERR_WARN(cbs, error, warning) do { \ @@ -73,18 +74,6 @@ private: bool _warning = false; }; - -boost::property_tree::ptree -readXml(const char xml[]) -{ - boost::property_tree::ptree ptree; - std::istringstream xml_str(xml); - read_xml(xml_str, ptree, - boost::property_tree::xml_parser::no_comments | - boost::property_tree::xml_parser::trim_whitespace); - return ptree; -} - BaseLib::ConfigTree makeConfigTree(boost::property_tree::ptree const& ptree, Callbacks& cbs) { diff --git a/Tests/TestTools.cpp b/Tests/TestTools.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2d5078e539fce1e854cabea25d62ff1e420b8576 --- /dev/null +++ b/Tests/TestTools.cpp @@ -0,0 +1,24 @@ +/** + * \copyright + * Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include <boost/property_tree/xml_parser.hpp> + +#include "TestTools.h" + +boost::property_tree::ptree +readXml(const char xml[]) +{ + boost::property_tree::ptree ptree; + std::istringstream xml_str(xml); + boost::property_tree::read_xml( + xml_str, ptree, + boost::property_tree::xml_parser::no_comments | + boost::property_tree::xml_parser::trim_whitespace); + return ptree; +} diff --git a/Tests/TestTools.h b/Tests/TestTools.h index 36b060d8fe3136ea370a154fafc49e9f2795c402..5afa28a1354aa0ebe09da35cea41de4e10dcbaac 100644 --- a/Tests/TestTools.h +++ b/Tests/TestTools.h @@ -13,6 +13,7 @@ */ #include <gtest/gtest.h> +#include <boost/property_tree/ptree_fwd.hpp> #ifndef TESTTOOLS_H_ #define TESTTOOLS_H_ @@ -25,4 +26,7 @@ for (std::size_t i=0; i<(unsigned)(N); i++) \ ASSERT_EQ((E)[i], (A)[i]); +boost::property_tree::ptree +readXml(const char xml[]); + #endif // TESTTOOLS_H_