2021-05-23 20:02:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-18 10:16:31 +00:00
|
|
|
#include "String.h"
|
|
|
|
#include "Pointer.h"
|
2022-11-29 18:00:19 +00:00
|
|
|
#include <functional>
|
2021-05-23 20:02:38 +00:00
|
|
|
|
|
|
|
class TestCase
|
|
|
|
{
|
|
|
|
public:
|
2022-11-29 18:00:19 +00:00
|
|
|
using TestCaseFunction = std::function<void()>;
|
|
|
|
|
2023-12-18 10:16:31 +00:00
|
|
|
TestCase(const String& name, const String& tags, TestCaseFunction func)
|
2023-01-23 11:06:30 +00:00
|
|
|
: mTestFunction(func),
|
|
|
|
mName(name),
|
|
|
|
mTags(tags)
|
2022-11-29 18:00:19 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-05-23 20:02:38 +00:00
|
|
|
virtual ~TestCase() = default;
|
2022-11-29 18:00:19 +00:00
|
|
|
|
2023-12-18 10:16:31 +00:00
|
|
|
const String& getName() const
|
2022-11-29 18:00:19 +00:00
|
|
|
{
|
|
|
|
return mName;
|
|
|
|
}
|
|
|
|
|
2023-12-18 10:16:31 +00:00
|
|
|
const String& getTags() const
|
2022-11-29 18:00:19 +00:00
|
|
|
{
|
|
|
|
return mTags;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void run()
|
|
|
|
{
|
|
|
|
mTestFunction();
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
TestCaseFunction mTestFunction{nullptr};
|
|
|
|
|
|
|
|
private:
|
2023-12-18 10:16:31 +00:00
|
|
|
String mName;
|
|
|
|
String mTags;
|
2022-11-29 18:00:19 +00:00
|
|
|
|
2021-05-23 20:02:38 +00:00
|
|
|
};
|
2023-12-18 10:16:31 +00:00
|
|
|
using TestCasePtr = Ptr<TestCase>;
|