2222namespace isc {
2323namespace test {
2424
25+ // / @brief Expect two element pointers to be equal. Order of elements
26+ // / in a list or a map is also checked by default.
27+ // / @{
28+ void
29+ expectEqWithDiff (isc::data::ConstElementPtr const & left, isc::data::ConstElementPtr const & right);
30+
31+ void
32+ expectEqWithDiff (isc::data::ElementPtr const & left, isc::data::ElementPtr const & right);
33+ // / @}
34+
2535// / @brief Return the difference between two strings
2636// /
2737// / Use the gtest >= 1.8.0 tool which builds the difference between
@@ -30,15 +40,17 @@ namespace test {
3040// / @param left left string
3141// / @param right right string
3242// / @return the unified diff between left and right
33- std::string generateDiff (std::string left, std::string right);
43+ std::string
44+ generateDiff (std::string left, std::string right);
3445
3546// / @brief Run a test using toElement() method with a string
3647// /
3748// / @tparam Cfg the class implementing the toElement() method
3849// / @param expected the expected textual value
3950// / @param cfg an instance of the Cfg class
40- template <typename Cfg>
41- void runToElementTest (const std::string& expected, const Cfg& cfg) {
51+ template <typename Cfg>
52+ void
53+ runToElementTest (const std::string& expected, const Cfg& cfg) {
4254 using namespace isc ::data;
4355#ifdef HAVE_IS_BASE_OF
4456 static_assert (std::is_base_of<CfgToElement, Cfg>::value,
@@ -53,9 +65,7 @@ void runToElementTest(const std::string& expected, const Cfg& cfg) {
5365 std::string got = prettyPrint (unparsed);
5466 ADD_FAILURE () << " Expected:\n " << wanted << " \n "
5567 << " Actual:\n " << got
56- #ifdef HAVE_CREATE_UNIFIED_DIFF
5768 << " \n Diff:\n " << generateDiff (wanted, got)
58- #endif
5969 << " \n " ;
6070 }
6171}
@@ -78,14 +88,12 @@ void runToElementTest(isc::data::ConstElementPtr expected, const Cfg& cfg) {
7888 std::string got = prettyPrint (unparsed);
7989 ADD_FAILURE () << " Expected:\n " << wanted << " \n "
8090 << " Actual:\n " << got
81- #ifdef HAVE_CREATE_UNIFIED_DIFF
8291 << " \n Diff:\n " << generateDiff (wanted, got)
83- #endif
8492 << " \n " ;
8593 }
8694}
8795
88- }; // end of isc:: test namespace
89- }; // end of isc namespace
96+ } // namespace test
97+ } // namespace isc
9098
9199#endif // TEST_TO_ELEMENT_H
0 commit comments