summaryrefslogtreecommitdiff
path: root/src/unittest.cpp
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2015-03-06 20:02:19 +0000
committerOthmar Gsenger <otti@anytun.org>2015-03-06 20:02:19 +0000
commitf1ef7b2a3875e13de3a6b835951ec319a4513f81 (patch)
tree6c847391d5adee828662c530589c0808ba74bd19 /src/unittest.cpp
parentadded performance compair to unit tests (diff)
bugfix wrong pointer
Diffstat (limited to 'src/unittest.cpp')
-rw-r--r--src/unittest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/unittest.cpp b/src/unittest.cpp
index a9e6bf9..2aa1edc 100644
--- a/src/unittest.cpp
+++ b/src/unittest.cpp
@@ -166,8 +166,8 @@ void testCrypt()
c->decrypt(*kd, encrypted_packet, plain_packet);
- if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
- std::cerr << "crypto test failed" << std::endl;
+ if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
+ std::cerr << "crypto test failed at position "<< pos << std::endl;
std::cout << test_text << std::endl;
ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength());
if (len)
@@ -187,8 +187,8 @@ void testCrypt()
//exit(-1);
}
cnew->decrypt(encrypted_packet, plain_packet, masterkey, mastersalt, ROLE_RIGHT );
- if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
- std::cerr << "crypto test failed" << std::endl;
+ if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
+ std::cerr << "crypto test failed at position "<< pos << std::endl;
std::cout << test_text << std::endl;
ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength());
if (len)
@@ -234,8 +234,8 @@ void newCrypt()
}
cnew->decrypt(encrypted_packet, plain_packet, masterkey, mastersalt, ROLE_RIGHT );
- if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
- std::cerr << "crypto test failed" << std::endl;
+ if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) {
+ std::cerr << "crypto test failed at position "<< pos << std::endl;
std::cout << test_text << std::endl;
ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength());
if (len)