Add exception handling for test runner.

This commit is contained in:
James Grogan 2023-01-16 18:16:14 +00:00
parent b76dc184b3
commit d370c26c42
3 changed files with 11 additions and 3 deletions

View file

@ -12,7 +12,7 @@ Image::Image(unsigned width, unsigned height, DataType dataType)
mHeight(height), mHeight(height),
mDataType(dataType) mDataType(dataType)
{ {
initialize();
} }
Image::~Image() Image::~Image()

View file

@ -48,7 +48,6 @@ public:
private: private:
void initialize(); void initialize();
unsigned mWidth{1}; unsigned mWidth{1};
unsigned mHeight{1}; unsigned mHeight{1};
unsigned mBitDepth{8}; unsigned mBitDepth{8};

View file

@ -67,7 +67,16 @@ bool TestCaseRunner::run(const std::vector<std::string>& args)
sLastTestFailed = false; sLastTestFailed = false;
std::cout << "TestFramework: Running Test - " << test_case->getName() << std::endl; std::cout << "TestFramework: Running Test - " << test_case->getName() << std::endl;
try{
test_case->run(); test_case->run();
}
catch(...)
{
std::cout << "Failed with exception" << std::endl;
mFailingTests.push_back(test_case->getName());
};
if (sLastTestFailed) if (sLastTestFailed)
{ {
std::cout << "Failed at line: " << sFailureLine << std::endl; std::cout << "Failed at line: " << sFailureLine << std::endl;