Browse Source

Test: test_adapter - use TESTLOG() instead od pEpLog() for tests

LIB-11
heck 4 years ago
parent
commit
be1255f263
  1. 22
      test/test_adapter_cxx.cc

22
test/test_adapter_cxx.cc

@ -2,6 +2,7 @@
// see LICENSE.txt // see LICENSE.txt
#include "framework/framework.hh" #include "framework/framework.hh"
#include "framework/utils.hh"
#include <iostream> #include <iostream>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
@ -10,19 +11,18 @@
#include <pEp/sync_api.h> #include <pEp/sync_api.h>
#include "../src/Adapter.hh" #include "../src/Adapter.hh"
#include "../src/pEpLog.hh"
using namespace pEp; using namespace pEp;
PEP_STATUS messageToSend(struct _message *msg) PEP_STATUS messageToSend(struct _message *msg)
{ {
pEpLog("called"); TESTLOG("called");
return PEP_STATUS_OK; return PEP_STATUS_OK;
} }
PEP_STATUS notifyHandshake(pEp_identity *me, pEp_identity *partner, ::sync_handshake_signal signal) PEP_STATUS notifyHandshake(pEp_identity *me, pEp_identity *partner, ::sync_handshake_signal signal)
{ {
pEpLog("called"); TESTLOG("called");
return PEP_STATUS_OK; return PEP_STATUS_OK;
} }
@ -30,12 +30,12 @@ class JNISync {
public: public:
void onSyncStartup() void onSyncStartup()
{ {
pEpLog("called"); TESTLOG("called");
} }
void onSyncShutdown() void onSyncShutdown()
{ {
pEpLog("called"); TESTLOG("called");
} }
} o; } o;
@ -44,7 +44,7 @@ int main(int argc, char **argv)
pEp::Test::setup(argc, argv); pEp::Test::setup(argc, argv);
// Create new identity // Create new identity
pEpLog("updating or creating identity for me"); TESTLOG("updating or creating identity for me");
::pEp_identity *me = ::new_identity("alice@peptest.ch", NULL, "23", "Who the F* is Alice"); ::pEp_identity *me = ::new_identity("alice@peptest.ch", NULL, "23", "Who the F* is Alice");
assert(me); assert(me);
::PEP_STATUS status = ::myself(Adapter::session(), me); ::PEP_STATUS status = ::myself(Adapter::session(), me);
@ -55,17 +55,17 @@ int main(int argc, char **argv)
useconds_t sleepuSec = 1000 * 100; useconds_t sleepuSec = 1000 * 100;
unsigned long long int nrIters = 1000 * 1000 * 1000; unsigned long long int nrIters = 1000 * 1000 * 1000;
for (int i = 0; i < nrIters; i++) { for (int i = 0; i < nrIters; i++) {
pEpLog("RUN NR: "); TESTLOG("RUN NR: ");
pEpLog(i); TESTLOG(i);
pEpLog("SYNC START"); TESTLOG("SYNC START");
pEpLog("starting the adapter including sync"); TESTLOG("starting the adapter including sync");
Adapter::startup<JNISync>( Adapter::startup<JNISync>(
messageToSend, messageToSend,
notifyHandshake, notifyHandshake,
&o, &o,
&JNISync::onSyncStartup, &JNISync::onSyncStartup,
&JNISync::onSyncShutdown); &JNISync::onSyncShutdown);
pEpLog("SYNC STOP"); TESTLOG("SYNC STOP");
usleep(sleepuSec); usleep(sleepuSec);
Adapter::shutdown(); Adapter::shutdown();
} }

Loading…
Cancel
Save