28 lines
1.3 KiB
C++
28 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "TestCaseRunner.h"
|
|
|
|
struct Holder
|
|
{
|
|
Holder(const std::string& name, const std::string& tags, std::function<void()> func)
|
|
{
|
|
TestCaseRunner::getInstance().addTestCase(name, tags, func);
|
|
}
|
|
};
|
|
|
|
#define TEST_CASE(NAME, TAGS) \
|
|
static void Test##NAME(); \
|
|
namespace{Holder holder##NAME( #NAME, #TAGS, &Test##NAME );} \
|
|
static void Test##NAME() \
|
|
|
|
|
|
#define REQUIRE(predicate) \
|
|
if(!bool(predicate)) \
|
|
{ \
|
|
TestCaseRunner::getInstance().markTestFailure(std::to_string(__LINE__) + " with check: '" + std::string(#predicate) + "'"); \
|
|
return; \
|
|
} \
|
|
|
|
|
|
|
|
|