Browse Source

Tests: Framework - add identitylist_to_string()

LIB-12
heck 4 years ago
parent
commit
1de257538d
  1. 20
      test/framework/utils.cc
  2. 2
      test/framework/utils.hh

20
test/framework/utils.cc

@ -3,7 +3,7 @@
#include "utils.hh" #include "utils.hh"
#include <pEp/keymanagement.h> #include <pEp/identity_list.h>
#include "../../src/Adapter.hh" #include "../../src/Adapter.hh"
#include "../../src/adapter_group.h" #include "../../src/adapter_group.h"
@ -58,6 +58,24 @@ namespace pEp {
return builder.str(); 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) string member_to_string(::pEp_member* member, bool full, int indent)
{ {

2
test/framework/utils.hh

@ -6,12 +6,14 @@
#include <string> #include <string>
#include <pEp/message.h> #include <pEp/message.h>
#include <pEp/identity_list.h>
#include <pEp/group.h> #include <pEp/group.h>
namespace pEp { namespace pEp {
namespace Test { namespace Test {
namespace Utils { namespace Utils {
std::string identity_to_string(::pEp_identity* ident, bool full = true, int indent = 0); 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 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 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); std::string group_to_string(::pEp_group* group, bool full = true, int indent = 0);

Loading…
Cancel
Save