mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 21:45:52 +00:00
Add pass and fail to UnitTest
This commit is contained in:
@@ -72,12 +72,26 @@ void UnitTest::beginTest (const String& testName)
|
|||||||
m_runner->beginNewTest (this, 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)
|
void UnitTest::expect (const bool result, const String& failureMessage)
|
||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
m_runner->addPass();
|
{
|
||||||
|
pass ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_runner->addFail (failureMessage);
|
{
|
||||||
|
fail (failureMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|||||||
@@ -136,6 +136,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void beginTest (const String& testName);
|
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.
|
/** Checks that the result of a test is true, and logs this result.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user