Add pass and fail to UnitTest

This commit is contained in:
Vinnie Falco
2013-07-24 06:04:18 -07:00
parent c50fc88827
commit 114012fab2
2 changed files with 24 additions and 2 deletions

View File

@@ -72,12 +72,26 @@ void UnitTest::beginTest (const String& testName)
m_runner->beginNewTest (this, testName);
}
void UnitTest::pass ()
{
m_runner->addPass();
}
void UnitTest::fail (String const& failureMessage)
{
m_runner->addFail (failureMessage);
}
void UnitTest::expect (const bool result, const String& failureMessage)
{
if (result)
m_runner->addPass();
{
pass ();
}
else
m_runner->addFail (failureMessage);
{
fail (failureMessage);
}
}
//==============================================================================

View File

@@ -136,6 +136,14 @@ public:
*/
void beginTest (const String& testName);
/** Passes a test.
*/
void pass ();
/** Fails a test with the specified message.
*/
void fail (String const& failureMessage);
//==============================================================================
/** Checks that the result of a test is true, and logs this result.