Vector tests added

This commit is contained in:
2019-04-28 19:48:48 +02:00
parent 3dbc5c211a
commit 2c726f144f
3 changed files with 85 additions and 15 deletions

View File

@@ -1,16 +1,36 @@
#include <cstdio>
#include <exception>
#include <random>
namespace Util
{
unsigned static GetRandomNumber()
{
static std::default_random_engine eng;
static std::uniform_int_distribution<unsigned> valueDist(0u, 8096u);
return valueDist(eng);
}
};
namespace Test
{
void Execute(bool (*testFunction)(void), char const * const message)
{
if(testFunction())
try
{
std::printf("[PASS] %s\n", message);
if(testFunction())
{
std::printf("[PASS] %s\n", message);
}
else
{
std::printf("[FAIL] %s\n", message);
}
}
else
catch(std::exception & e)
{
std::printf("[FAIL] %s\n", message);
std::printf("[FAIL] Exception thrown during execution of <%s>, error: %s\n", message, e.what());
}
}
};