summaryrefslogtreecommitdiff
path: root/src/cppunit/NotEqualException.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-12 05:59:26 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-12 05:59:26 +0000
commitbf78ed5d2c0f623efd08c277f97b240f2fef7ee6 (patch)
tree6faa8ef2ae7d679cb14111211e8971f2deb9a54f /src/cppunit/NotEqualException.cpp
parent517df147c8508ec32c7ab780cc434d7f541e2bc7 (diff)
downloadcppunit-bf78ed5d2c0f623efd08c277f97b240f2fef7ee6.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.h * src/cppunit/NotEqualException.h: Fixed constructor and operator = (aren't unit test nice?). Added methods expectedValue() and actualValue(). * include/cppunit/TestAssert.h: * src/cppunit/TestAssert.cpp: Use NotEqualException to report equality failure. * src/cppunit/TestResult.cpp: Report expect/was on different line for assertEquals failure. * examples/cppunittest/NotEqualExceptionTest.*: added unit tests for NotEqualException.
Diffstat (limited to 'src/cppunit/NotEqualException.cpp')
-rw-r--r--src/cppunit/NotEqualException.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cppunit/NotEqualException.cpp b/src/cppunit/NotEqualException.cpp
index 2fe9e76..1615c2b 100644
--- a/src/cppunit/NotEqualException.cpp
+++ b/src/cppunit/NotEqualException.cpp
@@ -7,9 +7,11 @@ NotEqualException::NotEqualException( std::string expected,
std::string actual,
long lineNumber,
std::string fileName ) :
- Exception( "Expected: " + expected + ", but was:" + actual,
+ Exception( "Expected: " + expected + ", but was: " + actual,
lineNumber,
- fileName )
+ fileName ),
+ m_expected( expected ),
+ m_actual( actual )
{
}
@@ -30,6 +32,8 @@ NotEqualException::~NotEqualException()
NotEqualException &
NotEqualException::operator =( const NotEqualException &other )
{
+ Exception::operator =( other );
+
if ( &other != this )
{
m_expected = other.m_expected;
@@ -61,4 +65,18 @@ NotEqualException::type()
}
+std::string
+NotEqualException::expectedValue() const
+{
+ return m_expected;
+}
+
+
+std::string
+NotEqualException::actualValue() const
+{
+ return m_actual;
+}
+
+
} // namespace CppUnit