7#ifndef TEST_TO_ELEMENT_H
8#define TEST_TO_ELEMENT_H
12#include <gtest/gtest.h>
18#ifndef CONFIG_H_WAS_INCLUDED
19#error config.h must be included before test_to_element.h
51template <
typename Cfg>
56 static_assert(std::is_base_of<CfgToElement, Cfg>::value,
57 "CfgToElement is not a base of the template parameter");
60 ASSERT_NO_THROW(json = Element::fromJSON(expected)) << expected;
62 ASSERT_NO_THROW(unparsed = cfg.toElement());
63 if (!isEquivalent(json, unparsed)) {
64 std::string wanted = prettyPrint(json);
65 std::string got = prettyPrint(unparsed);
66 ADD_FAILURE() <<
"Expected:\n" << wanted <<
"\n"
81 static_assert(std::is_base_of<isc::data::CfgToElement, Cfg>::value,
82 "CfgToElement is not a base of the template parameter");
85 ASSERT_NO_THROW(unparsed = cfg.toElement());
86 if (!isEquivalent(expected, unparsed)) {
87 std::string wanted = prettyPrint(expected);
88 std::string got = prettyPrint(unparsed);
89 ADD_FAILURE() <<
"Expected:\n" << wanted <<
"\n"
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
void expectEqWithDiff(ConstElementPtr const &a, ConstElementPtr const &b)
Expect two element pointers to be equal.
void runToElementTest(const std::string &expected, const Cfg &cfg)
Run a test using toElement() method with a string.
std::string generateDiff(std::string, std::string)
Return the difference between two strings.
Defines the logger used by the top-level component of kea-lfc.