Skip to content
Snippets Groups Projects
Commit 6a9aae46 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[T] extracted common testing functionality

parent 3dbf2702
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <sstream> #include <sstream>
#include "BaseLib/ConfigTree.h" #include "BaseLib/ConfigTree.h"
#include "Tests/TestTools.h"
// make useful line numbers appear in the output of gtest // make useful line numbers appear in the output of gtest
#define EXPECT_ERR_WARN(cbs, error, warning) do { \ #define EXPECT_ERR_WARN(cbs, error, warning) do { \
...@@ -73,18 +74,6 @@ private: ...@@ -73,18 +74,6 @@ private:
bool _warning = false; 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 BaseLib::ConfigTree
makeConfigTree(boost::property_tree::ptree const& ptree, Callbacks& cbs) makeConfigTree(boost::property_tree::ptree const& ptree, Callbacks& cbs)
{ {
......
/**
* \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;
}
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/property_tree/ptree_fwd.hpp>
#ifndef TESTTOOLS_H_ #ifndef TESTTOOLS_H_
#define TESTTOOLS_H_ #define TESTTOOLS_H_
...@@ -25,4 +26,7 @@ ...@@ -25,4 +26,7 @@
for (std::size_t i=0; i<(unsigned)(N); i++) \ for (std::size_t i=0; i<(unsigned)(N); i++) \
ASSERT_EQ((E)[i], (A)[i]); ASSERT_EQ((E)[i], (A)[i]);
boost::property_tree::ptree
readXml(const char xml[]);
#endif // TESTTOOLS_H_ #endif // TESTTOOLS_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment