diff --git a/modules/beast_core/diagnostic/beast_UnitTest.cpp b/modules/beast_core/diagnostic/beast_UnitTest.cpp index 603e005472..0c5d1802e6 100644 --- a/modules/beast_core/diagnostic/beast_UnitTest.cpp +++ b/modules/beast_core/diagnostic/beast_UnitTest.cpp @@ -106,7 +106,7 @@ void UnitTest::beginTestCase (String const& name) m_case = new Case (name, m_className); } -void UnitTest::expect (bool trueCondition, String const& failureMessage) +bool UnitTest::expect (bool trueCondition, String const& failureMessage) { if (trueCondition) { @@ -116,9 +116,11 @@ void UnitTest::expect (bool trueCondition, String const& failureMessage) { fail (failureMessage); } + + return trueCondition; } -void UnitTest::unexpected (bool falseCondition, String const& failureMessage) +bool UnitTest::unexpected (bool falseCondition, String const& failureMessage) { if (! falseCondition) { @@ -128,6 +130,8 @@ void UnitTest::unexpected (bool falseCondition, String const& failureMessage) { fail (failureMessage); } + + return ! falseCondition; } void UnitTest::pass () diff --git a/modules/beast_core/diagnostic/beast_UnitTest.h b/modules/beast_core/diagnostic/beast_UnitTest.h index 2c67a5e6b9..9af564b803 100644 --- a/modules/beast_core/diagnostic/beast_UnitTest.h +++ b/modules/beast_core/diagnostic/beast_UnitTest.h @@ -262,7 +262,7 @@ public: If Suite is true, a pass is logged; if it's false, a failure is logged. If the failure message is specified, it will be written to the log if the test fails. */ - void expect (bool trueCondition, String const& failureMessage = String::empty); + bool expect (bool trueCondition, String const& failureMessage = String::empty); /** Checks that the result of a test is false, and logs this result. @@ -270,13 +270,13 @@ public: @see expect */ - void unexpected (bool falseCondition, String const& failureMessage = String::empty); + bool unexpected (bool falseCondition, String const& failureMessage = String::empty); /** Compares two values, and if they don't match, prints out a message containing the expected and actual result values. */ template - void expectEquals (ActualType actual, ExpectedType expected, String failureMessage = String::empty) + bool expectEquals (ActualType actual, ExpectedType expected, String failureMessage = String::empty) { const bool result = (actual == expected); @@ -288,7 +288,7 @@ public: failureMessage << "Expected value: " << expected << ", Actual value: " << actual; } - expect (result, failureMessage); + return expect (result, failureMessage); } /** Causes the test item to pass. */