Tests: config_apply/gettargetservices_*: use BOOST_CHECK_EQUAL_COLLECTIONS()

to show the value diff in case of mismatch.

Co-authored-by: Yonas Habteab <yonas.habteab@icinga.com>
This commit is contained in:
Alexander A. Klimov 2023-12-18 16:01:31 +01:00
parent 191bf93f2e
commit 4424d57e7a
1 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,15 @@ static Expression* RequireActualExpression(const std::unique_ptr<Expression>& co
return sub0; return sub0;
} }
template<>
struct boost::test_tools::tt_detail::print_log_value<std::pair<String, String>>
{
inline void operator()(std::ostream& os, const std::pair<String, String>& hs)
{
os << hs.first << "!" << hs.second;
}
};
static void GetTargetHostsHelper( static void GetTargetHostsHelper(
const String& filter, const Dictionary::Ptr& constants, bool targeted, const std::vector<String>& hosts = {} const String& filter, const Dictionary::Ptr& constants, bool targeted, const std::vector<String>& hosts = {}
) )
@ -64,7 +73,7 @@ static void GetTargetServicesHelper(
actualServiceNames.emplace_back(*s.first, *s.second); actualServiceNames.emplace_back(*s.first, *s.second);
} }
BOOST_CHECK(actualServiceNames == services); BOOST_CHECK_EQUAL_COLLECTIONS(actualServiceNames.begin(), actualServiceNames.end(), services.begin(), services.end());
} }
} }