stuff-from-scratch/test/test_utils/TestCaseRunner.cpp
2021-05-23 21:02:38 +01:00

26 lines
601 B
C++

#include "TestCaseRunner.h"
#include <vector>
#include <iostream>
void TestCaseRunner::AddTestCase(const std::string& label, TestCasePtr testCase)
{
mCases.push_back({label, std::move(testCase)});
}
bool TestCaseRunner::Run()
{
bool testsPassed = true;
for(const auto& test : mCases)
{
std::cout << "Running " << test.first << std::endl;
const auto result = test.second->Run();
if (!result)
{
std::cout << test.first << " Failed" << std::endl;
testsPassed = false;
break;
}
}
return testsPassed;
}