diff options
author | dec05eba <0xdec05eba@gmail.com> | 2018-05-14 00:20:11 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-05-14 00:27:29 +0200 |
commit | 9af086151e6d9d3fe88f9e3e21797812a3e701ba (patch) | |
tree | a11889f81b8f929c11dccbd2c1c3b3cd74fbb740 /tests/assert.hpp | |
parent | ebff7aeafded4dd9d245dbcfc80d9c8d83fe1242 (diff) |
Replace files with sqlite
Using sqlite because sqlite has transactions, storing/loading from files
automatically, unloading data that is not accessed often.
Removed cosmetic data (node name, username). They can be added using
addData by the application that uses odhtdb instead.
Database callback functions can now be called with stored data using
database.loadNode function.
TODO: Add local user storage (with password) back, it has been temorary
disabled
Diffstat (limited to 'tests/assert.hpp')
-rw-r--r-- | tests/assert.hpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/assert.hpp b/tests/assert.hpp index 86f74f2..03157c6 100644 --- a/tests/assert.hpp +++ b/tests/assert.hpp @@ -2,19 +2,23 @@ #include <cstdlib> #include <iostream> +#include <sstream> +#include <stdexcept> template <typename T> static void assertEquals(const T &expected, const T &actual) { if(expected != actual) { - std::cerr << "Assertion failed!\nExpected: " << expected << ", actual: " << actual << std::endl; - exit(1); + std::stringstream ss; + ss << "Assertion failed!\nExpected: " << expected << ", actual: " << actual << std::endl; + throw std::runtime_error(ss.str()); } } static void fail(const std::string &errMsg) { - fprintf(stderr, "Fail:\n%.*s\n", errMsg.size(), errMsg.c_str()); - exit(1); + std::stringstream ss; + ss << "Fail:\n" << errMsg << std::endl; + throw std::runtime_error(ss.str()); } |