summaryrefslogtreecommitdiff
path: root/include/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 17:17:42 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-06-13 17:17:42 +0000
commit7f0766499db248afe9985a5700c22f9a8ce7ce6c (patch)
treeba70577fe0ed4343b5127d1e8848cbe0ccebf4fe /include/cppunit
parentabd178318ae3cdb6cc0a700e77414a33ef9297ca (diff)
downloadcppunit-7f0766499db248afe9985a5700c22f9a8ce7ce6c.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.h: * src/cppunit/NotEqualException.cpp: removed. * include/cppunit/Exception.h: * src/cppunit/Exception.cpp: removed 'type' related stuffs. * include/cppunit/TextTestResult.h: * src/cppunit/TextTestResult.cpp: delegate printing to TextOutputter. * examples/simple/ExampleTestCase.h: * examples/simple/ExampleTestCase.cpp: reindented. * src/qttestrunner/build: * src/qttestrunner/qttestrunner.pro: * src/qttestrunner/TestBrowserDlgImpl.h: * src/qttestrunner/TestRunnerModel.h: applied Thomas Neidhart's patch, 'Some minor fixes to compile QTTestrunner under Linux.'.
Diffstat (limited to 'include/cppunit')
-rw-r--r--include/cppunit/Asserter.h28
-rw-r--r--include/cppunit/Exception.h24
-rw-r--r--include/cppunit/Makefile.am1
-rw-r--r--include/cppunit/NotEqualException.h65
-rw-r--r--include/cppunit/TextTestResult.h18
5 files changed, 23 insertions, 113 deletions
diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h
index 412b831..fd7eb9b 100644
--- a/include/cppunit/Asserter.h
+++ b/include/cppunit/Asserter.h
@@ -77,8 +77,7 @@ namespace Asserter
std::string message,
const SourceLine &sourceLine = SourceLine() );
-
- /*! Throws a NotEqualException with the specified message and location.
+ /*! Throws an Exception with the specified message and location.
* \param expected Text describing the expected value.
* \param actual Text describing the actual value.
* \param additionalMessage Additional message. Usually used to report
@@ -88,9 +87,27 @@ namespace Asserter
void CPPUNIT_API failNotEqual( std::string expected,
std::string actual,
const SourceLine &sourceLine,
- const Message &additionalMessage );
+ const Message &additionalMessage,
+ std::string shortDescription = "equality assertion failed" );
+
+ /*! Throws an Exception with the specified message and location.
+ * \param shouldFail if \c true then the exception is thrown. Otherwise
+ * nothing happen.
+ * \param expected Text describing the expected value.
+ * \param actual Text describing the actual value.
+ * \param additionalMessage Additional message. Usually used to report
+ * where the "difference" is located.
+ * \param sourceLine Location of the assertion.
+ */
+ void CPPUNIT_API failNotEqualIf( bool shouldFail,
+ std::string expected,
+ std::string actual,
+ const SourceLine &sourceLine,
+ const Message &additionalMessage,
+ std::string shortDescription = "equality assertion failed" );
- /*! Throws a NotEqualException with the specified message and location.
+ /*! Throws an Exception with the specified message and location.
+ * \deprecated Use failNotEqual( std::string, std::string, SourceLine, Message, std::string ) instead.
* \param expected Text describing the expected value.
* \param actual Text describing the actual value.
* \param additionalMessage Additional message. Usually used to report
@@ -102,7 +119,8 @@ namespace Asserter
const SourceLine &sourceLine = SourceLine(),
std::string additionalMessage ="" );
- /*! Throws a NotEqualException with the specified message and location.
+ /*! Throws an Exception with the specified message and location.
+ * \deprecated Use failNotEqualIf( bool, std::string, std::string, SourceLine, Message, std::string ) instead.
* \param shouldFail if \c true then the exception is thrown. Otherwise
* nothing happen.
* \param expected Text describing the expected value.
diff --git a/include/cppunit/Exception.h b/include/cppunit/Exception.h
index afadd00..d4792fc 100644
--- a/include/cppunit/Exception.h
+++ b/include/cppunit/Exception.h
@@ -18,24 +18,6 @@ namespace CppUnit {
class CPPUNIT_API Exception : public std::exception
{
public:
-
- class Type
- {
- public:
- Type( std::string type ) : m_type ( type )
- {
- }
-
- bool operator ==( const Type &other ) const
- {
- return m_type == other.m_type;
- }
-
- private:
- const std::string m_type;
- };
-
-
/*! Constructs the exception with the specified message and source location.
* \param message Message associated to the exception.
* \param sourceLine Source location related to the exception.
@@ -85,12 +67,6 @@ public:
/// Clones the exception.
virtual Exception *clone() const;
-
- /// Tests if the exception is an instance of the specified type.
- virtual bool isInstanceOf( const Type &type ) const;
-
- /// Type of this exception.
- static Type type();
protected:
// VC++ does not recognize call to parent class when prefixed
diff --git a/include/cppunit/Makefile.am b/include/cppunit/Makefile.am
index e9c7eaf..bd505ad 100644
--- a/include/cppunit/Makefile.am
+++ b/include/cppunit/Makefile.am
@@ -10,7 +10,6 @@ libcppunitinclude_HEADERS = \
CompilerOutputter.h \
Exception.h \
Message.h \
- NotEqualException.h \
Outputter.h \
Portability.h \
SourceLine.h \
diff --git a/include/cppunit/NotEqualException.h b/include/cppunit/NotEqualException.h
deleted file mode 100644
index 52cc7d2..0000000
--- a/include/cppunit/NotEqualException.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef NOTEQUALEXCEPTION_H
-#define NOTEQUALEXCEPTION_H
-
-#include <cppunit/Exception.h>
-
-
-namespace CppUnit {
-
-/*! \brief Exception thrown by failed equality assertions.
- * \ingroup BrowsingCollectedTestResult
- */
-class CPPUNIT_API NotEqualException : public Exception
-{
-public:
- /*! Constructs the exception.
- * \param expected Text that represents the expected value.
- * \param actual Text that represents the actual value.
- * \param sourceLine Location of the assertion.
- * \param additionalMessage Additionnal information provided to further qualify
- * the inequality.
- */
- NotEqualException( std::string expected,
- std::string actual,
- SourceLine sourceLine = SourceLine(),
- std::string additionalMessage = "" );
-
-#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
- NotEqualException( std::string expected,
- std::string actual,
- long lineNumber,
- std::string fileName );
-#endif
-
- NotEqualException( const NotEqualException &other );
-
-
- virtual ~NotEqualException() throw();
-
- std::string expectedValue() const;
-
- std::string actualValue() const;
-
- std::string additionalMessage() const;
-
- /*! 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;
- std::string m_additionalMessage;
-};
-
-} // namespace CppUnit
-
-#endif // NOTEQUALEXCEPTION_H
diff --git a/include/cppunit/TextTestResult.h b/include/cppunit/TextTestResult.h
index 0e39376..bce2fbd 100644
--- a/include/cppunit/TextTestResult.h
+++ b/include/cppunit/TextTestResult.h
@@ -25,24 +25,6 @@ public:
virtual void addFailure( const TestFailure &failure );
virtual void startTest( Test *test );
virtual void print( std::ostream &stream );
- virtual void printFailures( std::ostream &stream );
- virtual void printHeader( std::ostream &stream );
-
- virtual void printFailure( TestFailure *failure,
- int failureNumber,
- std::ostream &stream );
- virtual void printFailureListMark( int failureNumber,
- std::ostream &stream );
- virtual void printFailureTestName( TestFailure *failure,
- std::ostream &stream );
- virtual void printFailureType( TestFailure *failure,
- std::ostream &stream );
- virtual void printFailureLocation( SourceLine sourceLine,
- std::ostream &stream );
- virtual void printFailureDetail( Exception *thrownException,
- std::ostream &stream );
- virtual void printFailureWarning( std::ostream &stream );
- virtual void printStatistics( std::ostream &stream );
};
/** insertion operator for easy output */