stuff-from-scratch/test/test_utils/TestCase.h
2023-12-18 10:16:31 +00:00

45 lines
697 B
C++

#pragma once
#include "String.h"
#include "Pointer.h"
#include <functional>
class TestCase
{
public:
using TestCaseFunction = std::function<void()>;
TestCase(const String& name, const String& tags, TestCaseFunction func)
: mTestFunction(func),
mName(name),
mTags(tags)
{
};
virtual ~TestCase() = default;
const String& getName() const
{
return mName;
}
const String& getTags() const
{
return mTags;
}
virtual void run()
{
mTestFunction();
};
public:
TestCaseFunction mTestFunction{nullptr};
private:
String mName;
String mTags;
};
using TestCasePtr = Ptr<TestCase>;