summaryrefslogtreecommitdiff
path: root/src/cppunit/NotEqualException.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
commitc7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f (patch)
treef0bb90d0fd555bbf07646380c6cab7bf06254620 /src/cppunit/NotEqualException.cpp
parent1806e9640462461fba3e1149c7b2c4a31805ec5e (diff)
downloadcppunit-c7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.cpp: addded, exception to be used with assertEquals(). * src/cppunit/RepeatedTest.cpp: added to reduce header dependency (TestResult.h was missing). * src/cppunit/TestAssert.cpp: added to put non template functions there. * src/cppunit/TestCase.cpp: added std:: prefix to catch (exception& e). Integrated a modified version of Tim Jansen patch (#403745) for TestCase to make the unit test (TestCaseTest) pass. If the setUp() fail then neither the runTest() nor the tearDown() method is called.
Diffstat (limited to 'src/cppunit/NotEqualException.cpp')
-rw-r--r--src/cppunit/NotEqualException.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/cppunit/NotEqualException.cpp b/src/cppunit/NotEqualException.cpp
new file mode 100644
index 0000000..2fe9e76
--- /dev/null
+++ b/src/cppunit/NotEqualException.cpp
@@ -0,0 +1,64 @@
+#include <cppunit/NotEqualException.h>
+
+namespace CppUnit {
+
+
+NotEqualException::NotEqualException( std::string expected,
+ std::string actual,
+ long lineNumber,
+ std::string fileName ) :
+ Exception( "Expected: " + expected + ", but was:" + actual,
+ lineNumber,
+ fileName )
+{
+}
+
+
+NotEqualException::NotEqualException( const NotEqualException &other ) :
+ Exception( other ),
+ m_expected( other.m_expected ),
+ m_actual( other.m_actual )
+{
+}
+
+
+NotEqualException::~NotEqualException()
+{
+}
+
+
+NotEqualException &
+NotEqualException::operator =( const NotEqualException &other )
+{
+ if ( &other != this )
+ {
+ m_expected = other.m_expected;
+ m_actual = other.m_actual;
+ }
+ return *this;
+}
+
+
+Exception *
+NotEqualException::clone() const
+{
+ return new NotEqualException( *this );
+}
+
+
+bool
+NotEqualException::isInstanceOf( const Type &exceptionType ) const
+{
+ return exceptionType == type() ||
+ Exception::isInstanceOf( exceptionType );
+}
+
+
+Exception::Type
+NotEqualException::type()
+{
+ return Type( "CppUnit::NotEqualException" );
+}
+
+
+} // namespace CppUnit