stuff-from-scratch/test/test_utils/TestCaseRunner.h

29 lines
531 B
C
Raw Normal View History

2021-05-23 20:02:38 +00:00
#pragma once
#include "TestCase.h"
#include <vector>
2021-09-26 20:42:35 +00:00
#include <string>
2021-05-23 20:02:38 +00:00
class TestCaseRunner
{
public:
2022-11-30 18:28:50 +00:00
TestCaseRunner();
2021-05-23 20:02:38 +00:00
2022-11-30 18:28:50 +00:00
static TestCaseRunner& getInstance();
2021-05-23 20:02:38 +00:00
2022-11-29 18:00:19 +00:00
~TestCaseRunner();
void addTestCase(const std::string& label, const std::string& tag, TestCase::TestCaseFunction func);
2022-11-30 18:28:50 +00:00
void markTestFailure(const std::string& line);
2022-11-29 18:00:19 +00:00
bool run();
2021-05-23 20:02:38 +00:00
private:
2022-11-30 18:28:50 +00:00
std::vector<std::string> mFailingTests;
static bool sLastTestFailed;
static std::string sFailureLine;
2022-11-29 18:00:19 +00:00
std::vector<TestCase*> mCases;
2021-05-23 20:02:38 +00:00
};