#include #include #include #include #include namespace Util { unsigned static GetRandomNumber() { static std::default_random_engine eng; static std::uniform_int_distribution valueDist(0u, 8096u); return valueDist(eng); } }; namespace Test { void Execute(bool (*testFunction)(void), char const * const message) { try { if(testFunction()) { std::printf("[PASS] %s\n", message); } else { std::printf("[FAIL] %s\n", message); } } catch(std::exception & e) { std::printf("[FAIL] Exception thrown during execution of <%s>, error: %s\n", message, e.what()); } } void Execute(bool (*testFunction)(std::vector &), char const * const message) { std::vector issues; try { if(testFunction(issues)) { std::printf("[PASS] %s\n", message); } else { for(auto & issue : issues) { std::printf(" Issue: %s\n", issue.c_str()); } std::printf("[FAIL] %s\n", message); } } catch(std::exception & e) { std::printf("[FAIL] Exception thrown during execution of <%s>, error: %s\n", message, e.what()); } } };