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

44 lines
980 B
C++

#include "TestCaseRunner.h"
#include <vector>
#include <iostream>
TestCaseRunner::~TestCaseRunner()
{
for (auto testCase : mCases)
{
//delete testCase;
}
}
void TestCaseRunner::addTestCase(const std::string& label, const std::string& tag, TestCase::TestCaseFunction func)
{
auto test_case = new TestCase(label, tag, func);
mCases.push_back(test_case);
}
bool TestCaseRunner::run()
{
for (auto test_case : mCases)
{
std::cout << "TestFramework: Running Test - " << test_case->getName() << std::endl;
test_case->run();
}
bool testsPassed = true;
/*
for(const auto& test : mCases)
{
std::cout << "Running " << test->getName() << std::endl;
const auto result = test->Run();
if (!result)
{
std::cout << test->getName() << " Failed" << std::endl;
testsPassed = false;
break;
}
}
return testsPassed;
*/
return true;
}