summaryrefslogtreecommitdiff
path: root/include/cppunit
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-11 05:01:54 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-11 05:01:54 +0000
commit6943d47a76445bbfebc99859ed38698760354642 (patch)
treeffe6390ed4d606edb9539e255232cbe95c79d2ce /include/cppunit
parent85aa074c02154107459755b2a3ddbc0b5767558a (diff)
downloadcppunit-6943d47a76445bbfebc99859ed38698760354642.tar.gz
added missing files
Diffstat (limited to 'include/cppunit')
-rw-r--r--include/cppunit/AdditionalMessage.h77
-rw-r--r--include/cppunit/Portability.h10
-rw-r--r--include/cppunit/Test.h6
3 files changed, 90 insertions, 3 deletions
diff --git a/include/cppunit/AdditionalMessage.h b/include/cppunit/AdditionalMessage.h
new file mode 100644
index 0000000..7c9096a
--- /dev/null
+++ b/include/cppunit/AdditionalMessage.h
@@ -0,0 +1,77 @@
+#ifndef CPPUNIT_ADDITIONALMESSAGE_H
+#define CPPUNIT_ADDITIONALMESSAGE_H
+
+#include <cppunit/Message.h>
+
+
+namespace CppUnit
+{
+
+
+/*! \brief An additional Message for assertions.
+ * \ingroup CreatingNewAssertions
+ *
+ * Provides a implicit constructor that takes a single string. This allow this
+ * class to be used as the message arguments in macros.
+ *
+ * The constructed object is either a Message with a single detail string if
+ * a string was passed to the macro, or a copy of the Message passed to the macro.
+ *
+ * Here is an example of usage:
+ * \code
+ *
+ * void checkStringEquals( const std::string &expected,
+ * const std::string &actual,
+ * const CppUnit::SourceLine &sourceLine,
+ * const CppUnit::AdditionalMessage &message );
+ *
+ * #define XTLUT_ASSERT_STRING_EQUAL_MESSAGE( expected, actual, message ) \
+ * ::XtlUt::Impl::checkStringEquals( ::Xtl::toString(expected), \
+ * ::Xtl::toString(actual), \
+ * CPPUNIT_SOURCELINE(), \
+ * message )
+ * \endcode
+ *
+ * In the previous example, the user can specify a simple string for \a message,
+ * or a complex Message object.
+ *
+ * \see Message
+ */
+class CPPUNIT_API AdditionalMessage : public Message
+{
+public:
+ typedef Message SuperClass;
+
+ /// Constructs an empty Message.
+ AdditionalMessage();
+
+ /*! \brief Constructs a Message with the specified detail string.
+ * \param detail1 Detail string of the message. If empty, then it is not added.
+ */
+ AdditionalMessage( const std::string &detail1 );
+
+ /*! \brief Constructs a Message with the specified detail string.
+ * \param detail1 Detail string of the message. If empty, then it is not added.
+ */
+ AdditionalMessage( const char *detail1 );
+
+ /*! \brief Constructs a copy of the specified message.
+ * \param other Message to copy.
+ */
+ AdditionalMessage( const CppUnit::Message &other );
+
+ /*! \brief Assignment operator.
+ * \param other Message to copy.
+ * \return Reference on this object.
+ */
+ AdditionalMessage &operator =( const CppUnit::Message &other );
+
+private:
+};
+
+
+} // namespace CppUnit
+
+
+
+#endif // CPPUNIT_ADDITIONALMESSAGE_H
diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h
index c684eb7..40c2a06 100644
--- a/include/cppunit/Portability.h
+++ b/include/cppunit/Portability.h
@@ -44,6 +44,16 @@
#define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
#endif
+// If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used,
+// otherwise, C style cast are used.
+#if defined( CPPUNIT_HAVE_CPP_CAST )
+#define CPPUNIT_CONST_CAST( TargetType, pointer ) \
+ const_cast<TargetType>( pointer )
+#else
+#define CPPUNIT_CONST_CAST( TargetType, pointer ) \
+ ((TargetType)( pointer ))
+#endif
+
/*! Stringize a symbol.
*
diff --git a/include/cppunit/Test.h b/include/cppunit/Test.h
index e457ca1..8e6dba3 100644
--- a/include/cppunit/Test.h
+++ b/include/cppunit/Test.h
@@ -69,7 +69,7 @@ public:
* \return \c true if a test with the specified name is found, \c false otherwise.
*/
virtual bool findTestPath( const std::string &testName,
- TestPath &testPath );
+ TestPath &testPath ) const;
/*! \brief Finds the specified test and its parents test.
* \param test Test to find.
@@ -78,7 +78,7 @@ public:
* \return \c true if the specified test is found, \c false otherwise.
*/
virtual bool findTestPath( const Test *test,
- TestPath &testPath );
+ TestPath &testPath ) const;
/*! \brief Finds the test with the specified name in the hierarchy.
* \param testName Name of the test to find.
@@ -93,7 +93,7 @@ public:
* \exception std::invalid_argument if \a testPath could not be resolved.
* \see TestPath.
*/
- virtual TestPath resolveTestPath( const std::string &testPath );
+ virtual TestPath resolveTestPath( const std::string &testPath ) const;
protected:
/*! Throws an exception if the specified index is invalid.