From a9a7ecaa25e6bc11062e21affd458e2de78747ff Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Feb 2018 19:36:35 +0100 Subject: Fix put not working because used time discards message before received --- tests/main.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/main.cpp b/tests/main.cpp index a685ee6..5e53dc8 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -2,7 +2,11 @@ #include "../include/Database.hpp" #include "../include/Group.hpp" #include "../include/LocalUser.hpp" +#include +#include +using namespace std; +using namespace chrono_literals; using namespace odhtdb; int main() @@ -14,6 +18,7 @@ int main() std::string privateKeyStr = localUser->getPrivateKey().toString(); printf("Local user private key: %s\n", privateKeyStr.c_str()); + /* char hex_ed_pk[65]; unsigned char seed[crypto_sign_ed25519_SEEDBYTES]; @@ -27,21 +32,24 @@ int main() */ - //crypto_sign_ed25519_sk_to_seed // TODO: For tests, dont run against bootstrap.ring.cx. // Run against a bootstrap node made only for testing which doesn't persist added data. - /* + Database database("bootstrap.ring.cx", 4222, "storage"); database.seed(); - LocalUser *localUser = LocalUser::create("dec05eba"); Group group("admin"); group.addUser(localUser); database.create("galax.channel.latenight.chat", &group); - const char *data = "hello, world!"; - database.add("galax.channel.latenight.chat", DataView{ (void*)data, strlen(data) }); + //const char *data = "hello, world!"; + //database.add("galax.channel.latenight.chat", DataView{ (void*)data, strlen(data) }); database.commit(); - */ + auto start = chrono::high_resolution_clock::now(); + while(chrono::high_resolution_clock::now() - start < 5s) + { + this_thread::sleep_for(10ms); + } + return 0; } -- cgit v1.2.3