summaryrefslogtreecommitdiff
path: root/src/cppunit/TestFailure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppunit/TestFailure.cpp')
-rw-r--r--src/cppunit/TestFailure.cpp49
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