Add UnitTest::anyTestsFailed()

This commit is contained in:
Vinnie Falco
2013-07-27 11:50:21 -07:00
parent 3dc5a47d78
commit 7c81bc611c
2 changed files with 14 additions and 0 deletions

View File

@@ -127,6 +127,17 @@ const UnitTests::TestResult* UnitTests::getResult (int index) const noexcept
return results [index];
}
bool UnitTests::anyTestsFailed () const noexcept
{
for (int i = 0; i < results.size (); ++i)
{
if (results [i]->failures > 0)
return true;
}
return false;
}
void UnitTests::resultsUpdated()
{
}

View File

@@ -279,6 +279,9 @@ public:
*/
const TestResult* getResult (int index) const noexcept;
/** Returns `true` if any test failed. */
bool anyTestsFailed () const noexcept;
protected:
/** Called when the list of results changes.
You can override this to perform some sort of behaviour when results are added.