stuff-from-scratch/test/test_utils/TestCase.h
2022-11-29 18:00:19 +00:00

45 lines
734 B
C++

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