diff options
| author | Anton <anton@picapica> | 2017-07-27 02:17:14 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2017-07-27 02:17:14 +0400 |
| commit | c0713b9a9ffca4516b44127cc335332a9405eb27 (patch) | |
| tree | ff8c8764b4580e985ffe2ec95bd49e32b5ec81d9 /tests | |
| parent | 1ba81a25b54881d0519963df31ef85f45ea30a87 (diff) | |
| download | pica-pica-c0713b9a9ffca4516b44127cc335332a9405eb27.tar.gz pica-pica-c0713b9a9ffca4516b44127cc335332a9405eb27.zip | |
test_client: compare sent & received messages in random message mode
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_client.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_client.c b/tests/test_client.c index 5f5e44b..691dd6d 100644 --- a/tests/test_client.c +++ b/tests/test_client.c @@ -49,6 +49,17 @@ void newmsg_cb(const unsigned char *peer_id, const char* msgbuf, unsigned int nb return; } + if (random_message_mode) + { + //compare received & sent messages, fail if they do not match exactly + if (memcmp(msgbuf, buf, nb) != 0) + { + printf("sent and returned messages are not equal!\n"); + return 1; + } + + } + memcpy(buf, msgbuf, nb); buf[nb] = 0; printf(" %s: ", PICA_id_to_base64(peer_id, NULL)); |
