diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-03-13 03:03:11 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | c7740f0e3cbcd9a7233258f22e6168b1cd8853a8 (patch) | |
tree | 21292e24cb7c534d27d8a0600a033977312cfffc /tests | |
parent | 6099ec04bd0d98b9e75f5b55b1215c94ccf20202 (diff) |
Fix add data operation not working correctly
Reminder: do not get reference to hash map value... duh
Add thread-safe logging (log is in order now!).
Store data immediately to database when WE add it instead of waiting for
response from remote peers.
TODO: Test with multiple peers (not only localhost)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/main.cpp b/tests/main.cpp index 4d3bcc3..9992eee 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,4 +1,5 @@ #include "assert.hpp" +#include "../include/Log.hpp" #include "../include/Database.hpp" #include "../include/Group.hpp" #include "../include/LocalUser.hpp" @@ -16,16 +17,16 @@ void testHash() { Hash hash("odhtdb", 6); assertEquals<string>("a7b30ec8ab92de60e551b26bb8f78d315697f84dd7f5549a143477e095ec934f", hash.toString()); - printf("hash of 'odhtdb' is: a7b30ec8ab92de60e551b26bb8f78d315697f84dd7f5549a143477e095ec934f\n"); + Log::debug("hash of 'odhtdb' is: a7b30ec8ab92de60e551b26bb8f78d315697f84dd7f5549a143477e095ec934f\n"); } void testSignData(LocalUser *localUser) { std::string publicKeyStr = localUser->getPublicKey().toString(); - printf("Local user public key: %s\n", publicKeyStr.c_str()); + Log::debug("Local user public key: %s\n", publicKeyStr.c_str()); std::string privateKeyStr = localUser->getPrivateKey().toString(); - printf("Local user private key: %s\n", privateKeyStr.c_str()); + Log::debug("Local user private key: %s\n", privateKeyStr.c_str()); string expectedUnsignedData = "hello, world!"; string signedData = localUser->getPrivateKey().sign(DataView((void*)expectedUnsignedData.data(), expectedUnsignedData.size())); @@ -82,7 +83,7 @@ void testEncryption() int main() { - printf("Starting tests...\n"); + Log::debug("Starting tests...\n"); LocalUser *localUser = LocalUser::create(Signature::KeyPair(), "dec05eba", nullptr); testSignData(localUser); testEncryption(); |