From 3f26375583dc2c2c7e1b1f2b9a1d89f2066d13b3 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 24 Jul 2013 06:04:18 -0700 Subject: [PATCH] Add pass and fail to UnitTest --- .../beast_core/diagnostic/beast_UnitTest.cpp | 18 ++++++++++++++++-- .../beast_core/diagnostic/beast_UnitTest.h | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.cpp b/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.cpp index 8905ed2a1..0a5241dd1 100644 --- a/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.cpp +++ b/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.cpp @@ -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); + } } //============================================================================== diff --git a/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.h b/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.h index f7e8466c1..bb300b364 100644 --- a/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.h +++ b/Subtrees/beast/modules/beast_core/diagnostic/beast_UnitTest.h @@ -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.