From da8e822d28d281276f4cef78b7e7c7f2660de232 Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Mon, 11 Jun 2001 19:00:52 +0000 Subject: Include/cppunit/Exception. include/cppunit/Exception.h: now inherit from std::exception instead of ::exception. Added clone(), type(), and isInstanceOf() methods for subclassing support. Changed UNKNOWNLINENUMBER type to long for consistence with lineNumber(). * include/cppunit/NotEqualException.h: addded, exception to be used with assertEquals(). * include/cppunit/TestAssert.h: changed TestAssert into a namespace instead of a class. This remove the need of template member methods and does not cause compiler internal error on VC++. Macro CPPUNIT_ASSERT_MESSAGE has been added to fail test with a specified message. * include/cppunit/TestCaller.h: added "Expected exception" support. Based on Tim Jansen patch (#403745), but use a traits instead of RTTI to distingh between "No expected exception" and "Excepted exception". Exception type name is reported using RTTI if CPPUNIT_USE_TYPEINFO is defined. --- include/cppunit/NotEqualException.h | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/cppunit/NotEqualException.h (limited to 'include/cppunit/NotEqualException.h') diff --git a/include/cppunit/NotEqualException.h b/include/cppunit/NotEqualException.h new file mode 100644 index 0000000..ba39cd2 --- /dev/null +++ b/include/cppunit/NotEqualException.h @@ -0,0 +1,41 @@ +#ifndef NOTEQUALEXCEPTION_H +#define NOTEQUALEXCEPTION_H + +#include + + +namespace CppUnit { + + + class NotEqualException : public Exception + { + public: + NotEqualException( std::string expected, + std::string actual, + long lineNumber = UNKNOWNLINENUMBER, + std::string fileName = UNKNOWNFILENAME ); + + NotEqualException( const NotEqualException &other ); + + virtual ~NotEqualException(); + + /*! Copy operator. + * @param other Object to copy. + * @return Reference on this object. + */ + NotEqualException &operator =( const NotEqualException &other ); + + Exception *clone() const; + + bool isInstanceOf( const Type &type ) const; + + static Type type(); + + private: + std::string m_expected; + std::string m_actual; + }; + +} // namespace CppUnit + +#endif // NOTEQUALEXCEPTION_H -- cgit v1.2.1