From 1de257538d450e6c1872472b526f7de830424cdf Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 9 Apr 2021 20:37:52 +0200 Subject: [PATCH] Tests: Framework - add identitylist_to_string() --- test/framework/utils.cc | 20 +++++++++++++++++++- test/framework/utils.hh | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/test/framework/utils.cc b/test/framework/utils.cc index 96e2958..49a4d63 100644 --- a/test/framework/utils.cc +++ b/test/framework/utils.cc @@ -3,7 +3,7 @@ #include "utils.hh" -#include +#include #include "../../src/Adapter.hh" #include "../../src/adapter_group.h" @@ -58,6 +58,24 @@ namespace pEp { return builder.str(); } + std::string identitylist_to_string(::identity_list* idl, bool full, int indent) + { + stringstream builder; + if (idl != nullptr) { + builder << endl; + builder << std::string(indent, '\t') << "[" << endl; + indent++; + for (::identity_list * curr = idl; curr != nullptr; curr = curr->next) { + builder << identity_to_string(curr->ident, full, indent) << endl; + } + indent--; + builder << std::string(indent, '\t') << "]"; + } else { + builder << "NULL"; + } + + return builder.str(); + } string member_to_string(::pEp_member* member, bool full, int indent) { diff --git a/test/framework/utils.hh b/test/framework/utils.hh index c696e5d..3fe514e 100644 --- a/test/framework/utils.hh +++ b/test/framework/utils.hh @@ -6,12 +6,14 @@ #include #include +#include #include namespace pEp { namespace Test { namespace Utils { std::string identity_to_string(::pEp_identity* ident, bool full = true, int indent = 0); + std::string identitylist_to_string(::identity_list * idl, bool full = true, int indent = 0); std::string member_to_string(::pEp_member* member, bool full = true, int indent = 0); std::string memberlist_to_string(::member_list* mbl, bool full = true, int indent = 0); std::string group_to_string(::pEp_group* group, bool full = true, int indent = 0);