diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-03 20:16:12 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2001-10-03 20:16:12 +0000 |
| commit | c2ac2ac3bcfb30cb8ae4e95e531f1b630b8dd80e (patch) | |
| tree | 090517dbef21bb46ad096008a54cfdedd4066d3a /src/cppunit/TestFailure.cpp | |
| parent | ddfca2261132a879f631cbaaf22e82feaa2460ef (diff) | |
| download | cppunit-c2ac2ac3bcfb30cb8ae4e95e531f1b630b8dd80e.tar.gz | |
Include/cppunit/TestFailure.
include/cppunit/TestFailure.cpp :
* include/cppunit/TestFailure.h : fixed some constness issues. Added
argument to indicate the type of failure to constructor. Added
isError().
* include/cppunit/TestListener.h : removed addError(). addFailure()
now take a TestFailure as argument.
* include/cppunit/TestResult.h :
* include/cppunit/TestResult.cpp : removed errors(). Refactored. Fixed
some constness issues. Added typedef TestFailures for vector returned
by failures(). failures() returns a const reference on the list of
failure. added testFailuresTotal(). Constructor can take an optional
synchronization object.
* include/cppunit/TextTestResult.h :
* include/cppunit/TextTestResult.cpp : removed printErrors().
Refactored. Updated to suit new TestResult, errors and failures are
reported in the same list.
* examples/cppunittest/TestFailureTest.cpp :
* examples/cppunittest/TestFailureTest.h : modified to use the new
TestFailure constructor. Added one test.
* examples/cppunittest/TestListenerTest.cpp: removed addError().
Refactored to suit new TestListener.
* examples/cppunittest/TestResultTest.h :
* examples/cppunittest/TestResultTest.cpp : modified to suit the
new TestResult.
Diffstat (limited to 'src/cppunit/TestFailure.cpp')
| -rw-r--r-- | src/cppunit/TestFailure.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/src/cppunit/TestFailure.cpp b/src/cppunit/TestFailure.cpp index 6a48696..0db1628 100644 --- a/src/cppunit/TestFailure.cpp +++ b/src/cppunit/TestFailure.cpp @@ -1,26 +1,53 @@ -#include "cppunit/TestFailure.h" #include "cppunit/Exception.h" #include "cppunit/Test.h" +#include "cppunit/TestFailure.h" namespace CppUnit { -/// Returns a short description of the failure. -std::string -TestFailure::toString () const -{ - return m_failedTest->toString () + ": " + m_thrownException->what (); -} - /// Constructs a TestFailure with the given test and exception. -TestFailure::TestFailure (Test *failedTest, Exception *thrownException) - : m_failedTest (failedTest), m_thrownException (thrownException) +TestFailure::TestFailure( Test *failedTest, + Exception *thrownException, + bool isError ) : + m_failedTest( failedTest ), + m_thrownException( thrownException ), + m_isError( isError ) { } /// Deletes the owned exception. -TestFailure::~TestFailure () +TestFailure::~TestFailure() { delete m_thrownException; } +/// Gets the failed test. +Test * +TestFailure::failedTest() const +{ + return m_failedTest; +} + + +/// Gets the thrown exception. Never \c NULL. +Exception * +TestFailure::thrownException() const +{ + return m_thrownException; +} + + +/// Indicates if the failure is a failed assertion or an error. +bool +TestFailure::isError() const +{ + return m_isError; +} + +/// Returns a short description of the failure. +std::string +TestFailure::toString() const +{ + return m_failedTest->toString() + ": " + m_thrownException->what(); +} + } // namespace CppUnit |
