diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
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 <chrono> +#include <thread> +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; } |