7 #ifndef TEST_TO_ELEMENT_H 8 #define TEST_TO_ELEMENT_H 12 #include <gtest/gtest.h> 14 #ifdef HAVE_IS_BASE_OF 15 #include <type_traits> 18 #ifndef CONFIG_H_WAS_INCLUDED 19 #error config.h must be included before test_to_element.h 33 std::string
generateDiff(std::string left, std::string right);
40 template<
typename Cfg>
43 #ifdef HAVE_IS_BASE_OF 44 static_assert(std::is_base_of<CfgToElement, Cfg>::value,
45 "CfgToElement is not a base of the template parameter");
48 ASSERT_NO_THROW(json = Element::fromJSON(expected)) << expected;
50 ASSERT_NO_THROW(unparsed = cfg.toElement());
54 ADD_FAILURE() <<
"Expected:\n" << wanted <<
"\n" 56 #ifdef HAVE_CREATE_UNIFIED_DIFF 68 template<
typename Cfg>
70 #ifdef HAVE_IS_BASE_OF 71 static_assert(std::is_base_of<isc::data::CfgToElement, Cfg>::value,
72 "CfgToElement is not a base of the template parameter");
75 ASSERT_NO_THROW(unparsed = cfg.toElement());
79 ADD_FAILURE() <<
"Expected:\n" << wanted <<
"\n" 81 #ifdef HAVE_CREATE_UNIFIED_DIFF 91 #endif // TEST_TO_ELEMENT_H void runToElementTest(const std::string &expected, const Cfg &cfg)
Run a test using toElement() method with a string.
void prettyPrint(ConstElementPtr element, std::ostream &out, unsigned indent, unsigned step)
Pretty prints the data into stream.
bool isEquivalent(ConstElementPtr a, ConstElementPtr b)
Compares the data with other using unordered lists.
boost::shared_ptr< const Element > ConstElementPtr
std::string generateDiff(std::string, std::string)
Return the difference between two strings.
Defines the logger used by the top-level component of kea-dhcp-ddns.