mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Run a named unit test
This commit is contained in:
@@ -105,6 +105,33 @@ void UnitTests::resultsUpdated()
|
||||
{
|
||||
}
|
||||
|
||||
void UnitTests::runTest (String const& name)
|
||||
{
|
||||
results.clear();
|
||||
resultsUpdated();
|
||||
|
||||
Array<UnitTest*>& tests = UnitTest::getAllTests ();
|
||||
|
||||
for (int i = 0; i < tests.size(); ++i)
|
||||
{
|
||||
UnitTest& test = *tests [i];
|
||||
|
||||
if (test.getName () == name)
|
||||
{
|
||||
try
|
||||
{
|
||||
test.performTest (this);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
addFail ("An unhandled exception was thrown!");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnitTests::runTests (const Array<UnitTest*>& tests)
|
||||
{
|
||||
results.clear();
|
||||
|
||||
Reference in New Issue
Block a user