diff options
Diffstat (limited to 'include/cppunit')
58 files changed, 412 insertions, 380 deletions
diff --git a/include/cppunit/AdditionalMessage.h b/include/cppunit/AdditionalMessage.h index 7c9096a..917d754 100644 --- a/include/cppunit/AdditionalMessage.h +++ b/include/cppunit/AdditionalMessage.h @@ -4,8 +4,7 @@ #include <cppunit/Message.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN /*! \brief An additional Message for assertions. @@ -58,19 +57,19 @@ public: /*! \brief Constructs a copy of the specified message. * \param other Message to copy. */ - AdditionalMessage( const CppUnit::Message &other ); + AdditionalMessage( const Message &other ); /*! \brief Assignment operator. * \param other Message to copy. * \return Reference on this object. */ - AdditionalMessage &operator =( const CppUnit::Message &other ); + AdditionalMessage &operator =( const Message &other ); private: }; -} // namespace CppUnit +CPPUNIT_NS_END diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h index 45cd4b7..5a10236 100644 --- a/include/cppunit/Asserter.h +++ b/include/cppunit/Asserter.h @@ -5,8 +5,8 @@ #include <cppunit/SourceLine.h> #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Message; @@ -133,7 +133,9 @@ namespace Asserter std::string shortDescription = "equality assertion failed" ); } // namespace Asserter -} // namespace CppUnit + + +CPPUNIT_NS_END #endif // CPPUNIT_ASSERTER_H diff --git a/include/cppunit/BriefTestProgressListener.h b/include/cppunit/BriefTestProgressListener.h index 5d87e05..137ca44 100644 --- a/include/cppunit/BriefTestProgressListener.h +++ b/include/cppunit/BriefTestProgressListener.h @@ -4,8 +4,8 @@ #include <cppunit/TestListener.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief TestListener that prints the name of each test before running it. * \ingroup TrackingTestExecution @@ -38,8 +38,6 @@ private: }; - -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_BRIEFTESTPROGRESSLISTENER_H diff --git a/include/cppunit/CompilerOutputter.h b/include/cppunit/CompilerOutputter.h index a87cabd..1660887 100644 --- a/include/cppunit/CompilerOutputter.h +++ b/include/cppunit/CompilerOutputter.h @@ -6,8 +6,8 @@ #include <vector> #include <iostream> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Exception; class SourceLine; @@ -141,8 +141,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_COMPILERTESTRESULTOUTPUTTER_H diff --git a/include/cppunit/Exception.h b/include/cppunit/Exception.h index d4792fc..da53cda 100644 --- a/include/cppunit/Exception.h +++ b/include/cppunit/Exception.h @@ -7,7 +7,8 @@ #include <exception> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /*! \brief Exceptions thrown by failed assertions. * \ingroup BrowsingCollectedTestResult @@ -79,7 +80,8 @@ protected: }; -} // namespace CppUnit +CPPUNIT_NS_END + #endif // CPPUNIT_EXCEPTION_H diff --git a/include/cppunit/Message.h b/include/cppunit/Message.h index 64395a4..e3d8639 100644 --- a/include/cppunit/Message.h +++ b/include/cppunit/Message.h @@ -12,8 +12,8 @@ #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + #if CPPUNIT_NEED_DLL_DECL // template class CPPUNIT_API std::deque<std::string>; @@ -142,8 +142,7 @@ private: }; - -} // namespace CppUnit +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/Outputter.h b/include/cppunit/Outputter.h index 1f28652..f31d681 100644 --- a/include/cppunit/Outputter.h +++ b/include/cppunit/Outputter.h @@ -4,8 +4,8 @@ #include <cppunit/Portability.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Abstract outputter to print test result summary. * \ingroup WritingTestResult @@ -20,12 +20,7 @@ public: }; - -// Inlines methods for Outputter: -// ------------------------------ - - -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_OUTPUTTER_H diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h index 40c2a06..70f9e05 100644 --- a/include/cppunit/Portability.h +++ b/include/cppunit/Portability.h @@ -10,6 +10,11 @@ # include <cppunit/config-auto.h> #endif +// Version number of package +#ifndef CPPUNIT_VERSION +#define CPPUNIT_VERSION "1.9.9" +#endif + #include <cppunit/config/CppUnitApi.h> // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL #include <cppunit/config/SelectDllLoader.h> @@ -37,6 +42,17 @@ #define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1 #endif +/* Assumes that STL and CppUnit are in global space if the compiler does not + support namespace. */ +#if !defined(CPPUNIT_HAVE_NAMESPACES) +#ifndef CPPUNIT_NO_NAMESPACE +#define CPPUNIT_NO_NAMESPACE 1 +#endif // CPPUNIT_NO_NAMESPACE +#ifndef CPPUNIT_NO_STD_NAMESPACE +#define CPPUNIT_NO_STD_NAMESPACE 1 +#endif // CPPUNIT_NO_STD_NAMESPACE +#endif // !defined(CPPUNIT_HAVE_NAMESPACES) + // Compiler error location format for CompilerOutputter // If not define, assumes that it's gcc // See class CompilerOutputter for format. @@ -54,6 +70,24 @@ ((TargetType)( pointer )) #endif +// If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space. +// => Define macro 'std' to nothing +#if defined(CPPUNIT_NO_STD_NAMESPACE) +#undef std +#define std +#endif // defined(CPPUNIT_NO_STD_NAMESPACE) + +// If CPPUNIT_NO_NAMESPACE is defined, then put CppUnit classes in the +// global namespace: the compiler does not support namespace. +#if defined(CPPUNIT_NO_NAMESPACE) +#define CPPUNIT_NS_BEGIN +#define CPPUNIT_NS_END +#define CPPUNIT_NS(symbol) symbol +#else // defined(CPPUNIT_NO_NAMESPACE) +#define CPPUNIT_NS_BEGIN namespace CppUnit { +#define CPPUNIT_NS_END } +#define CPPUNIT_NS(symbol) ::CppUnit::symbol +#endif // defined(CPPUNIT_NO_NAMESPACE) /*! Stringize a symbol. * diff --git a/include/cppunit/SourceLine.h b/include/cppunit/SourceLine.h index 5d2a3c1..bb538cc 100644 --- a/include/cppunit/SourceLine.h +++ b/include/cppunit/SourceLine.h @@ -10,11 +10,11 @@ * Used to write your own assertion macros. * \see Asserter for example of usage. */ -#define CPPUNIT_SOURCELINE() ::CppUnit::SourceLine( __FILE__, __LINE__ ) +#define CPPUNIT_SOURCELINE() CPPUNIT_NS(SourceLine)( __FILE__, __LINE__ ) -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Represents a source line location. * \ingroup CreatingNewAssertions @@ -53,8 +53,6 @@ private: }; -} // namespace CppUnit - - +CPPUNIT_NS_END #endif // CPPUNIT_SOURCELINE_H diff --git a/include/cppunit/SynchronizedObject.h b/include/cppunit/SynchronizedObject.h index 7ee8447..0f7d094 100644 --- a/include/cppunit/SynchronizedObject.h +++ b/include/cppunit/SynchronizedObject.h @@ -4,8 +4,8 @@ #include <cppunit/Portability.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Base class for synchronized object. * @@ -75,8 +75,6 @@ private: }; - -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_SYNCHRONIZEDOBJECT_H diff --git a/include/cppunit/Test.h b/include/cppunit/Test.h index 8e6dba3..a56be0f 100644 --- a/include/cppunit/Test.h +++ b/include/cppunit/Test.h @@ -4,7 +4,8 @@ #include <cppunit/Portability.h> #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class TestResult; class TestPath; @@ -110,7 +111,7 @@ protected: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TEST_H diff --git a/include/cppunit/TestAssert.h b/include/cppunit/TestAssert.h index 835fe9f..e726d40 100644 --- a/include/cppunit/TestAssert.h +++ b/include/cppunit/TestAssert.h @@ -6,107 +6,108 @@ #include <cppunit/Asserter.h> -namespace CppUnit { - - /*! \brief Traits used by CPPUNIT_ASSERT_EQUAL(). - * - * Here is an example of specialization of that traits: - * - * \code - * template<> - * struct assertion_traits<std::string> // specialization for the std::string type - * { - * static bool equal( const std::string& x, const std::string& y ) - * { - * return x == y; - * } - * - * static std::string toString( const std::string& x ) - * { - * std::string text = '"' + x + '"'; // adds quote around the string to see whitespace - * OStringStream ost; - * ost << text; - * return ost.str(); - * } - * }; - * \endcode - */ +CPPUNIT_NS_BEGIN + + +/*! \brief Traits used by CPPUNIT_ASSERT_EQUAL(). + * + * Here is an example of specialization of that traits: + * + * \code + * template<> + * struct assertion_traits<std::string> // specialization for the std::string type + * { + * static bool equal( const std::string& x, const std::string& y ) + * { + * return x == y; + * } + * + * static std::string toString( const std::string& x ) + * { + * std::string text = '"' + x + '"'; // adds quote around the string to see whitespace + * OStringStream ost; + * ost << text; + * return ost.str(); + * } + * }; + * \endcode + */ +template <class T> +struct assertion_traits +{ + static bool equal( const T& x, const T& y ) + { + return x == y; + } + + static std::string toString( const T& x ) + { + OStringStream ost; + ost << x; + return ost.str(); + } +}; + + +namespace TestAssert +{ +#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED + void CPPUNIT_API assertImplementation( bool condition, + std::string conditionExpression = "", + long lineNumber, + std::string fileName ); + + void CPPUNIT_API assertNotEqualImplementation( std::string expected, + std::string actual, + long lineNumber, + std::string fileName ); + + template <class T> - struct assertion_traits - { - static bool equal( const T& x, const T& y ) - { - return x == y; - } - - static std::string toString( const T& x ) - { - OStringStream ost; - ost << x; - return ost.str(); - } - }; - - - namespace TestAssert + void assertEquals( const T& expected, + const T& actual, + long lineNumber, + std::string fileName ) { -#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED - void CPPUNIT_API assertImplementation( bool condition, - std::string conditionExpression = "", - long lineNumber, - std::string fileName ); - - void CPPUNIT_API assertNotEqualImplementation( std::string expected, - std::string actual, - long lineNumber, - std::string fileName ); - - - template <class T> - void assertEquals( const T& expected, - const T& actual, - long lineNumber, - std::string fileName ) + if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... { - if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... - { - assertNotEqualImplementation( assertion_traits<T>::toString(expected), - assertion_traits<T>::toString(actual), - lineNumber, - fileName ); - } + assertNotEqualImplementation( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + lineNumber, + fileName ); } + } - void CPPUNIT_API assertEquals( double expected, - double actual, - double delta, - long lineNumber, - std::string fileName ); + void CPPUNIT_API assertEquals( double expected, + double actual, + double delta, + long lineNumber, + std::string fileName ); #else // using SourceLine - template <class T> - void assertEquals( const T& expected, - const T& actual, - SourceLine sourceLine, - const std::string &message ="" ) + template <class T> + void assertEquals( const T& expected, + const T& actual, + SourceLine sourceLine, + const std::string &message ="" ) + { + if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... { - if ( !assertion_traits<T>::equal(expected,actual) ) // lazy toString conversion... - { - Asserter::failNotEqual( assertion_traits<T>::toString(expected), - assertion_traits<T>::toString(actual), - sourceLine, - message ); - } + Asserter::failNotEqual( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + sourceLine, + message ); } + } - void CPPUNIT_API assertDoubleEquals( double expected, - double actual, - double delta, - SourceLine sourceLine ); + void CPPUNIT_API assertDoubleEquals( double expected, + double actual, + double delta, + SourceLine sourceLine ); #endif - } +} /* A set of macros which allow us to get the line number @@ -118,16 +119,16 @@ namespace CppUnit { /** Assertions that a condition is \c true. * \ingroup Assertions */ -#define CPPUNIT_ASSERT(condition) \ - ( ::CppUnit::Asserter::failIf( !(condition), \ - ::CppUnit::Message( "assertion failed", \ - "Expression: " #condition), \ +#define CPPUNIT_ASSERT(condition) \ + ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ + CPPUNIT_NS(Message)( "assertion failed", \ + "Expression: " #condition), \ CPPUNIT_SOURCELINE() ) ) #else -#define CPPUNIT_ASSERT(condition) \ - ( ::CppUnit::Asserter::failIf( !(condition), \ - ::CppUnit::Message( "assertion failed" ), \ - CPPUNIT_SOURCELINE() ) ) +#define CPPUNIT_ASSERT(condition) \ + ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ + CPPUNIT_NS(Message)( "assertion failed" ), \ + CPPUNIT_SOURCELINE() ) ) #endif /** Assertion with a user specified message. @@ -138,25 +139,25 @@ namespace CppUnit { * test failed. */ #define CPPUNIT_ASSERT_MESSAGE(message,condition) \ - ( ::CppUnit::Asserter::failIf( !(condition), \ - (message), \ - CPPUNIT_SOURCELINE() ) ) + ( CPPUNIT_NS(Asserter)::failIf( !(condition), \ + (message), \ + CPPUNIT_SOURCELINE() ) ) /** Fails with the specified message. * \ingroup Assertions * \param message Message reported in diagnostic. */ -#define CPPUNIT_FAIL( message ) \ - ( ::CppUnit::Asserter::fail( ::CppUnit::Message( "forced failure", \ - message ), \ - CPPUNIT_SOURCELINE() ) ) +#define CPPUNIT_FAIL( message ) \ + ( CPPUNIT_NS(Asserter)::fail( CPPUNIT_NS(Message)( "forced failure", \ + message ), \ + CPPUNIT_SOURCELINE() ) ) #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED /// Generalized macro for primitive value comparisons -#define CPPUNIT_ASSERT_EQUAL(expected,actual) \ - ( ::CppUnit::TestAssert::assertEquals( (expected), \ - (actual), \ - __LINE__, __FILE__ ) ) +#define CPPUNIT_ASSERT_EQUAL(expected,actual) \ + ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + (actual), \ + __LINE__, __FILE__ ) ) #else /** Asserts that two values are equals. * \ingroup Assertions @@ -174,10 +175,10 @@ namespace CppUnit { * The last two requirements (serialization and comparison) can be * removed by specializing the CppUnit::assertion_traits. */ -#define CPPUNIT_ASSERT_EQUAL(expected,actual) \ - ( ::CppUnit::TestAssert::assertEquals( (expected), \ - (actual), \ - CPPUNIT_SOURCELINE() ) ) +#define CPPUNIT_ASSERT_EQUAL(expected,actual) \ + ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE() ) ) /** Asserts that two values are equals, provides additional messafe on failure. * \ingroup Assertions @@ -197,21 +198,21 @@ namespace CppUnit { * The last two requirements (serialization and comparison) can be * removed by specializing the CppUnit::assertion_traits. */ -#define CPPUNIT_ASSERT_EQUAL_MESSAGE(message,expected,actual) \ - ( ::CppUnit::TestAssert::assertEquals( (expected), \ - (actual), \ - CPPUNIT_SOURCELINE(), \ - (message) ) ) +#define CPPUNIT_ASSERT_EQUAL_MESSAGE(message,expected,actual) \ + ( CPPUNIT_NS(TestAssert)::assertEquals( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE(), \ + (message) ) ) #endif /*! \brief Macro for primitive value comparisons * \ingroup Assertions */ -#define CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual,delta) \ - ( ::CppUnit::TestAssert::assertDoubleEquals( (expected), \ - (actual), \ - (delta), \ - CPPUNIT_SOURCELINE() ) ) +#define CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual,delta) \ + ( CPPUNIT_NS(TestAssert)::assertDoubleEquals( (expected), \ + (actual), \ + (delta), \ + CPPUNIT_SOURCELINE() ) ) // Backwards compatibility @@ -226,6 +227,6 @@ namespace CppUnit { #endif -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTASSERT_H diff --git a/include/cppunit/TestCaller.h b/include/cppunit/TestCaller.h index 481aec6..f9f6516 100644 --- a/include/cppunit/TestCaller.h +++ b/include/cppunit/TestCaller.h @@ -10,7 +10,8 @@ #endif -namespace CppUnit { +CPPUNIT_NS_BEGIN + /*! \brief Marker class indicating that no exception is expected by TestCaller. * This class is an implementation detail. You should never use this class directly. @@ -199,6 +200,6 @@ private: -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTCALLER_H diff --git a/include/cppunit/TestCase.h b/include/cppunit/TestCase.h index 0d319dc..bd1529e 100644 --- a/include/cppunit/TestCase.h +++ b/include/cppunit/TestCase.h @@ -8,7 +8,8 @@ #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class TestResult; @@ -50,6 +51,6 @@ private: const std::string m_name; }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTCASE_H diff --git a/include/cppunit/TestComposite.h b/include/cppunit/TestComposite.h index 2d86d5e..0ded95f 100644 --- a/include/cppunit/TestComposite.h +++ b/include/cppunit/TestComposite.h @@ -4,7 +4,7 @@ #include <cppunit/Test.h> #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN /*! \brief A Composite of Tests. @@ -40,6 +40,6 @@ private: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTCOMPSITE_H diff --git a/include/cppunit/TestFailure.h b/include/cppunit/TestFailure.h index 798d0c5..6419979 100644 --- a/include/cppunit/TestFailure.h +++ b/include/cppunit/TestFailure.h @@ -4,7 +4,8 @@ #include <cppunit/Portability.h> #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Exception; class SourceLine; @@ -52,6 +53,6 @@ private: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTFAILURE_H diff --git a/include/cppunit/TestFixture.h b/include/cppunit/TestFixture.h index eb2264b..1223adb 100644 --- a/include/cppunit/TestFixture.h +++ b/include/cppunit/TestFixture.h @@ -3,7 +3,7 @@ #include <cppunit/Portability.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN /*! \brief Wraps a test case with setUp and tearDown methods. @@ -93,6 +93,7 @@ public: }; -} +CPPUNIT_NS_END + #endif diff --git a/include/cppunit/TestLeaf.h b/include/cppunit/TestLeaf.h index 393dda7..c83b075 100644 --- a/include/cppunit/TestLeaf.h +++ b/include/cppunit/TestLeaf.h @@ -4,7 +4,8 @@ #include <cppunit/Test.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /*! \brief A single test object. * @@ -38,6 +39,6 @@ public: Test *doGetChildTestAt( int index ) const; }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTLEAF_H diff --git a/include/cppunit/TestListener.h b/include/cppunit/TestListener.h index 71d591b..d110b30 100644 --- a/include/cppunit/TestListener.h +++ b/include/cppunit/TestListener.h @@ -4,7 +4,8 @@ #include <cppunit/Portability.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Exception; class Test; @@ -140,7 +141,7 @@ public: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTLISTENER_H diff --git a/include/cppunit/TestPath.h b/include/cppunit/TestPath.h index a24e0ff..65f974c 100644 --- a/include/cppunit/TestPath.h +++ b/include/cppunit/TestPath.h @@ -10,7 +10,8 @@ #include <deque> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Test; @@ -203,7 +204,7 @@ protected: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TESTPATH_H diff --git a/include/cppunit/TestResult.h b/include/cppunit/TestResult.h index e18d358..faed1dc 100644 --- a/include/cppunit/TestResult.h +++ b/include/cppunit/TestResult.h @@ -11,7 +11,8 @@ #include <cppunit/SynchronizedObject.h> #include <deque> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Exception; class Test; @@ -83,7 +84,7 @@ private: }; -} // namespace CppUnit +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL diff --git a/include/cppunit/TestResultCollector.h b/include/cppunit/TestResultCollector.h index 56e1604..8465297 100644 --- a/include/cppunit/TestResultCollector.h +++ b/include/cppunit/TestResultCollector.h @@ -12,9 +12,7 @@ #include <deque> -namespace CppUnit -{ - +CPPUNIT_NS_BEGIN #if CPPUNIT_NEED_DLL_DECL // template class CPPUNIT_API std::deque<TestFailure *>; @@ -77,8 +75,7 @@ private: -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/TestRunner.h b/include/cppunit/TestRunner.h index b6c539c..3a853e9 100644 --- a/include/cppunit/TestRunner.h +++ b/include/cppunit/TestRunner.h @@ -4,8 +4,8 @@ #include <cppunit/TestSuite.h> #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Test; class TestResult; @@ -128,7 +128,6 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_TESTRUNNER_H diff --git a/include/cppunit/TestSuccessListener.h b/include/cppunit/TestSuccessListener.h index e9a0c90..60c5ff5 100644 --- a/include/cppunit/TestSuccessListener.h +++ b/include/cppunit/TestSuccessListener.h @@ -5,8 +5,8 @@ #include <cppunit/TestListener.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief TestListener that checks if any test case failed. * \ingroup TrackingTestExecution @@ -34,7 +34,6 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_TESTSUCCESSLISTENER_H diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index a63082b..7abea67 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -11,7 +11,8 @@ #include <cppunit/TestComposite.h> #include <vector> -namespace CppUnit { +CPPUNIT_NS_BEGIN + #if CPPUNIT_NEED_DLL_DECL // template class CPPUNIT_API std::vector<Test *>; @@ -70,8 +71,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/TextOutputter.h b/include/cppunit/TextOutputter.h index db09575..767a48e 100644 --- a/include/cppunit/TextOutputter.h +++ b/include/cppunit/TextOutputter.h @@ -5,8 +5,8 @@ #include <cppunit/Outputter.h> #include <iostream> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Exception; class SourceLine; @@ -54,7 +54,6 @@ private: -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_TEXTOUTPUTTER_H diff --git a/include/cppunit/TextTestProgressListener.h b/include/cppunit/TextTestProgressListener.h index 2aa230b..7521c40 100644 --- a/include/cppunit/TextTestProgressListener.h +++ b/include/cppunit/TextTestProgressListener.h @@ -4,8 +4,8 @@ #include <cppunit/TestListener.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! * \brief TestListener that show the status of each TestCase test result. @@ -39,7 +39,6 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_TEXTTESTPROGRESSLISTENER_H diff --git a/include/cppunit/TextTestResult.h b/include/cppunit/TextTestResult.h index bce2fbd..53d1021 100644 --- a/include/cppunit/TextTestResult.h +++ b/include/cppunit/TextTestResult.h @@ -5,7 +5,8 @@ #include <cppunit/TestResultCollector.h> #include <iostream> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class SourceLine; class Exception; @@ -31,7 +32,7 @@ public: std::ostream &operator <<( std::ostream &stream, TextTestResult &result ); -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TEXTTESTRESULT_H diff --git a/include/cppunit/TextTestRunner.h b/include/cppunit/TextTestRunner.h index 82f2710..417dfab 100644 --- a/include/cppunit/TextTestRunner.h +++ b/include/cppunit/TextTestRunner.h @@ -3,15 +3,16 @@ #include <cppunit/ui/text/TestRunner.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /*! * \brief A text mode test runner. * \ingroup ExecutingTest * \deprecated Use CppUnit::TextUi::TestRunner instead. */ -typedef CppUnit::TextUi::TestRunner TextTestRunner; +typedef CPPUNIT_NS(TextUi::TestRunner) TextTestRunner; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TEXTTESTRUNNER_H diff --git a/include/cppunit/XmlOutputter.h b/include/cppunit/XmlOutputter.h index bae2dac..3b733ac 100644 --- a/include/cppunit/XmlOutputter.h +++ b/include/cppunit/XmlOutputter.h @@ -14,8 +14,8 @@ #include <map> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Test; class TestFailure; @@ -148,12 +148,11 @@ private: }; - -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) #endif + #endif // CPPUNIT_XMLTESTRESULTOUTPUTTER_H diff --git a/include/cppunit/XmlOutputterHook.h b/include/cppunit/XmlOutputterHook.h index 57d1440..b9ba23b 100644 --- a/include/cppunit/XmlOutputterHook.h +++ b/include/cppunit/XmlOutputterHook.h @@ -4,8 +4,8 @@ #include <cppunit/Portability.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Test; class TestFailure; @@ -72,8 +72,6 @@ public: }; - -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_XMLOUTPUTTERHOOK_H diff --git a/include/cppunit/config/config-bcb5.h b/include/cppunit/config/config-bcb5.h index 0a6bcd8..d491452 100644 --- a/include/cppunit/config/config-bcb5.h +++ b/include/cppunit/config/config-bcb5.h @@ -6,6 +6,11 @@ /* include/cppunit/config-bcb5.h. Manually adapted from include/cppunit/config-auto.h */ +/* define to 1 if the compiler implements namespaces */ +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 +#endif + /* define if library uses std::string::compare(string,pos,n) */ #ifndef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #define CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 0 @@ -37,12 +42,6 @@ #ifndef CPPUNIT_PACKAGE #define CPPUNIT_PACKAGE "cppunit" #endif - -/* Version number of package */ -#ifndef CPPUNIT_VERSION -#define CPPUNIT_VERSION "1.5.5" -#endif - /* _INCLUDE_CPPUNIT_CONFIG_BCB5_H */ #endif diff --git a/include/cppunit/config/config-mac.h b/include/cppunit/config/config-mac.h index 990163a..4ace906 100644 --- a/include/cppunit/config/config-mac.h +++ b/include/cppunit/config/config-mac.h @@ -8,7 +8,6 @@ know a suitable preprocessor symbol that will distinguish MacOS X from other MacOS versions. Email us if you know the answer. */ - /* define if library uses std::string::compare(string,pos,n) */ #ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h index 7f194db..32a9e26 100644 --- a/include/cppunit/config/config-msvc6.h +++ b/include/cppunit/config/config-msvc6.h @@ -10,6 +10,11 @@ /* include/cppunit/config-msvc6.h. Manually adapted from include/cppunit/config-auto.h */ +/* define to 1 if the compiler implements namespaces */ +#ifndef CPPUNIT_HAVE_NAMESPACES +#define CPPUNIT_HAVE_NAMESPACES 1 +#endif + /* define if library uses std::string::compare(string,pos,n) */ #ifdef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST diff --git a/include/cppunit/extensions/AutoRegisterSuite.h b/include/cppunit/extensions/AutoRegisterSuite.h index 24c2f2c..b690801 100644 --- a/include/cppunit/extensions/AutoRegisterSuite.h +++ b/include/cppunit/extensions/AutoRegisterSuite.h @@ -5,7 +5,8 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /** Automatically register the test suite of the specified type. (Implementation) * @@ -76,7 +77,7 @@ public: } }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_AUTOREGISTERSUITE_H diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index bd3510b..5d63f8b 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -11,8 +11,9 @@ #include <cppunit/extensions/TestSuiteBuilder.h> #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + + class TestFixture; /*! \brief Abstract TestFixture factory. @@ -21,9 +22,10 @@ namespace CppUnit { public: //! Creates a new TestFixture instance. - virtual CppUnit::TestFixture *makeFixture() =0; + virtual CPPUNIT_NS(TestFixture) *makeFixture() =0; }; -} // namespace CppUnit + +CPPUNIT_NS_END @@ -109,44 +111,44 @@ namespace CppUnit * \see CPPUNIT_TEST_SUB_SUITE, CPPUNIT_TEST, CPPUNIT_TEST_SUITE_END, * \see CPPUNIT_TEST_SUITE_REGISTRATION, CPPUNIT_TEST_EXCEPTION, CPPUNIT_TEST_FAIL. */ -#define CPPUNIT_TEST_SUITE( ATestFixtureType ) \ - private: \ - typedef ATestFixtureType ThisTestFixtureType; \ - class __ThisTestFixtureFactory : public CppUnit::TestFixtureFactory \ - { \ - virtual CppUnit::TestFixture *makeFixture() \ - { \ - return new ATestFixtureType(); \ - } \ - }; \ - static const CppUnit::TestNamer &__getTestNamer() \ - { \ - static CPPUNIT_TESTNAMER_DECL( testNamer, ATestFixtureType ); \ - return testNamer; \ - } \ - public: \ - class ThisTestFixtureFactory \ - { \ - public: \ - ThisTestFixtureFactory( CppUnit::TestFixtureFactory *factory ) \ - : m_factory( factory ) \ - { \ - } \ - ThisTestFixtureType *makeFixture() const \ - { \ - return (ThisTestFixtureType *)m_factory->makeFixture(); \ - } \ - private: \ - CppUnit::TestFixtureFactory *m_factory; \ - }; \ - \ - static void \ - __registerTests( CppUnit::TestSuite *suite, \ - CppUnit::TestFixtureFactory *fixtureFactory, \ - const CppUnit::TestNamer &namer ) \ - { \ - const ThisTestFixtureFactory factory( fixtureFactory ); \ - CppUnit::TestSuiteBuilder<ThisTestFixtureType> builder( suite, namer ) +#define CPPUNIT_TEST_SUITE( ATestFixtureType ) \ + private: \ + typedef ATestFixtureType ThisTestFixtureType; \ + class __ThisTestFixtureFactory : public CPPUNIT_NS(TestFixtureFactory) \ + { \ + virtual CPPUNIT_NS(TestFixture) *makeFixture() \ + { \ + return new ATestFixtureType(); \ + } \ + }; \ + static const CPPUNIT_NS(TestNamer) &__getTestNamer() \ + { \ + static CPPUNIT_TESTNAMER_DECL( testNamer, ATestFixtureType ); \ + return testNamer; \ + } \ + public: \ + class ThisTestFixtureFactory \ + { \ + public: \ + ThisTestFixtureFactory( CPPUNIT_NS(TestFixtureFactory) *factory ) \ + : m_factory( factory ) \ + { \ + } \ + ThisTestFixtureType *makeFixture() const \ + { \ + return (ThisTestFixtureType *)m_factory->makeFixture(); \ + } \ + private: \ + CPPUNIT_NS(TestFixtureFactory) *m_factory; \ + }; \ + \ + static void \ + __registerTests( CPPUNIT_NS(TestSuite) *suite, \ + CPPUNIT_NS(TestFixtureFactory) *fixtureFactory, \ + const CPPUNIT_NS(TestNamer) &namer ) \ + { \ + const ThisTestFixtureFactory factory( fixtureFactory ); \ + CPPUNIT_NS(TestSuiteBuilder)<ThisTestFixtureType> builder( suite, namer ) /*! \brief Begin test suite (includes parent suite) @@ -270,7 +272,7 @@ namespace CppUnit * method. */ #define CPPUNIT_TEST_EXCEPTION( testMethod, ExceptionType ) \ - CPPUNIT_TEST_ADD( (new CppUnit::TestCaller<ThisTestFixtureType, \ + CPPUNIT_TEST_ADD( (new CPPUNIT_NS(TestCaller)<ThisTestFixtureType, \ ExceptionType>( \ namer.getTestNameFor( #testMethod ), \ &ThisTestFixtureType::testMethod, \ @@ -292,7 +294,7 @@ namespace CppUnit * \see CreatingNewAssertions. */ #define CPPUNIT_TEST_FAIL( testMethod ) \ - CPPUNIT_TEST_EXCEPTION( testMethod, CppUnit::Exception ) + CPPUNIT_TEST_EXCEPTION( testMethod, CPPUNIT_NS(Exception) ) /*! \brief Adds a custom test case. * @@ -396,10 +398,10 @@ namespace CppUnit #define CPPUNIT_TEST_SUITE_END() \ builder.takeSuite(); \ } \ - static CppUnit::TestSuite *suite() \ + static CPPUNIT_NS(TestSuite) *suite() \ { \ - const CppUnit::TestNamer &namer = __getTestNamer(); \ - CppUnit::TestSuiteBuilder<ThisTestFixtureType> builder( namer ); \ + const CPPUNIT_NS(TestNamer) &namer = __getTestNamer(); \ + CPPUNIT_NS(TestSuiteBuilder)<ThisTestFixtureType> builder( namer ); \ __ThisTestFixtureFactory factory; \ ThisTestFixtureType::__registerTests( builder.suite(), &factory, namer ); \ return builder.takeSuite(); \ @@ -429,7 +431,7 @@ namespace CppUnit * CppUnit::TestFactoryRegistry. */ #define CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ) \ - static CppUnit::AutoRegisterSuite< ATestFixtureType > \ + static CPPUNIT_NS(AutoRegisterSuite)< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite ) @@ -471,7 +473,7 @@ namespace CppUnit * CppUnit::TestFactoryRegistry.. */ #define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, suiteName ) \ - static CppUnit::AutoRegisterSuite< ATestFixtureType > \ + static CPPUNIT_NS(AutoRegisterSuite)< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(__autoRegisterSuite )(suiteName) /*! Adds that the specified registry suite to another registry suite. @@ -502,7 +504,7 @@ namespace CppUnit * \see CPPUNIT_REGISTRY_ADD_TO_DEFAULT, CPPUNIT_TEST_SUITE_NAMED_REGISTRATION. */ #define CPPUNIT_REGISTRY_ADD( which, to ) \ - static CppUnit::AutoRegisterRegistry \ + static CPPUNIT_NS(AutoRegisterRegistry) \ CPPUNIT_MAKE_UNIQUE_NAME( __autoRegisterRegistry )( which, to ) /*! Adds that the specified registry suite to the default registry suite. @@ -515,7 +517,7 @@ namespace CppUnit * \see CPPUNIT_REGISTRY_ADD. */ #define CPPUNIT_REGISTRY_ADD_TO_DEFAULT( which ) \ - static CppUnit::AutoRegisterRegistry \ + static CPPUNIT_NS(AutoRegisterRegistry) \ CPPUNIT_MAKE_UNIQUE_NAME( __autoRegisterRegistry )( which ) // Backwards compatibility diff --git a/include/cppunit/extensions/Orthodox.h b/include/cppunit/extensions/Orthodox.h index 08c6dd1..7221259 100644 --- a/include/cppunit/extensions/Orthodox.h +++ b/include/cppunit/extensions/Orthodox.h @@ -3,7 +3,8 @@ #include <cppunit/TestCase.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /* * Orthodox performs a simple set of tests on an arbitary @@ -88,6 +89,7 @@ ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) return object; } -} // namespace CppUnit + +CPPUNIT_NS_END #endif diff --git a/include/cppunit/extensions/RepeatedTest.h b/include/cppunit/extensions/RepeatedTest.h index 5db7dc2..390ce48 100644 --- a/include/cppunit/extensions/RepeatedTest.h +++ b/include/cppunit/extensions/RepeatedTest.h @@ -4,7 +4,8 @@ #include <cppunit/Portability.h> #include <cppunit/extensions/TestDecorator.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Test; class TestResult; @@ -36,7 +37,7 @@ private: }; +CPPUNIT_NS_END -} // namespace CppUnit #endif // CPPUNIT_EXTENSIONS_REPEATEDTEST_H diff --git a/include/cppunit/extensions/TestDecorator.h b/include/cppunit/extensions/TestDecorator.h index bceca07..408c743 100644 --- a/include/cppunit/extensions/TestDecorator.h +++ b/include/cppunit/extensions/TestDecorator.h @@ -4,7 +4,8 @@ #include <cppunit/Portability.h> #include <cppunit/Test.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class TestResult; @@ -89,7 +90,8 @@ TestDecorator::doGetChildTestAt( int index ) const return m_test->getChildTestAt( index ); } -} // namespace CppUnit + +CPPUNIT_NS_END #endif diff --git a/include/cppunit/extensions/TestFactory.h b/include/cppunit/extensions/TestFactory.h index 3a964b6..214d353 100644 --- a/include/cppunit/extensions/TestFactory.h +++ b/include/cppunit/extensions/TestFactory.h @@ -3,7 +3,8 @@ #include <cppunit/Portability.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Test; @@ -20,6 +21,7 @@ public: virtual Test* makeTest() = 0; }; -} // namespace CppUnit + +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTFACTORY_H diff --git a/include/cppunit/extensions/TestFactoryRegistry.h b/include/cppunit/extensions/TestFactoryRegistry.h index 6603959..1164bf3 100644 --- a/include/cppunit/extensions/TestFactoryRegistry.h +++ b/include/cppunit/extensions/TestFactoryRegistry.h @@ -12,7 +12,8 @@ #include <set> #include <string> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class TestSuite; @@ -171,8 +172,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/extensions/TestNamer.h b/include/cppunit/extensions/TestNamer.h index 91262b9..6267604 100644 --- a/include/cppunit/extensions/TestNamer.h +++ b/include/cppunit/extensions/TestNamer.h @@ -28,16 +28,16 @@ */ #if CPPUNIT_USE_TYPEINFO_NAME # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CppUnit::TestNamer variableName( typeid(FixtureType) ) + CPPUNIT_NS(TestNamer) variableName( typeid(FixtureType) ) #else # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CppUnit::TestNamer variableName( std::string(#FixtureType) ) + CPPUNIT_NS(TestNamer) variableName( std::string(#FixtureType) ) #endif -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Names a test or a fixture suite. * @@ -78,9 +78,6 @@ protected: }; - -} // namespace CppUnit - - +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H
\ No newline at end of file diff --git a/include/cppunit/extensions/TestSetUp.h b/include/cppunit/extensions/TestSetUp.h index 0fe2663..3561262 100644 --- a/include/cppunit/extensions/TestSetUp.h +++ b/include/cppunit/extensions/TestSetUp.h @@ -3,7 +3,8 @@ #include <cppunit/extensions/TestDecorator.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Test; class TestResult; @@ -26,7 +27,7 @@ private: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTSETUP_H diff --git a/include/cppunit/extensions/TestSuiteBuilder.h b/include/cppunit/extensions/TestSuiteBuilder.h index ae1c6df..fb017ac 100644 --- a/include/cppunit/extensions/TestSuiteBuilder.h +++ b/include/cppunit/extensions/TestSuiteBuilder.h @@ -8,7 +8,8 @@ #include <memory> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /*! \brief Helper to add tests to a TestSuite. * \ingroup WritingTestFixture @@ -85,6 +86,6 @@ private: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTSUITEBUILDER_H diff --git a/include/cppunit/extensions/TestSuiteFactory.h b/include/cppunit/extensions/TestSuiteFactory.h index 11605a5..260b483 100644 --- a/include/cppunit/extensions/TestSuiteFactory.h +++ b/include/cppunit/extensions/TestSuiteFactory.h @@ -3,7 +3,8 @@ #include <cppunit/extensions/TestFactory.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Test; @@ -20,6 +21,7 @@ namespace CppUnit { } }; -} // namespace CppUnit + +CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTSUITEFACTORY_H diff --git a/include/cppunit/extensions/TypeInfoHelper.h b/include/cppunit/extensions/TypeInfoHelper.h index e12d4c0..0c087af 100644 --- a/include/cppunit/extensions/TypeInfoHelper.h +++ b/include/cppunit/extensions/TypeInfoHelper.h @@ -8,7 +8,8 @@ #include <typeinfo> -namespace CppUnit { +CPPUNIT_NS_BEGIN + /** Helper to use type_info. */ @@ -24,7 +25,8 @@ namespace CppUnit { static std::string getClassName( const std::type_info &info ); }; -} // namespace CppUnit + +CPPUNIT_NS_END #endif // CPPUNIT_HAVE_RTTI diff --git a/include/cppunit/plugin/DynamicLibraryManager.h b/include/cppunit/plugin/DynamicLibraryManager.h index 3b4f30b..afb0b4a 100644 --- a/include/cppunit/plugin/DynamicLibraryManager.h +++ b/include/cppunit/plugin/DynamicLibraryManager.h @@ -5,8 +5,7 @@ #if !defined(CPPUNIT_NO_TESTPLUGIN) -namespace CppUnit -{ +CPPUNIT_NS_BEGIN /*! \brief Manages dynamic libraries. @@ -114,8 +113,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // !defined(CPPUNIT_NO_TESTPLUGIN) diff --git a/include/cppunit/plugin/DynamicLibraryManagerException.h b/include/cppunit/plugin/DynamicLibraryManagerException.h index e0a1283..42e180f 100644 --- a/include/cppunit/plugin/DynamicLibraryManagerException.h +++ b/include/cppunit/plugin/DynamicLibraryManagerException.h @@ -8,8 +8,8 @@ #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Exception thrown by DynamicLibraryManager when a failure occurs. * @@ -42,8 +42,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #endif // !defined(CPPUNIT_NO_TESTPLUGIN) diff --git a/include/cppunit/plugin/Parameters.h b/include/cppunit/plugin/Parameters.h index 8175235..54a26d2 100644 --- a/include/cppunit/plugin/Parameters.h +++ b/include/cppunit/plugin/Parameters.h @@ -8,13 +8,13 @@ #include <deque> #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + typedef std::deque<std::string> Parameters; -} // namespace CppUnit +CPPUNIT_NS_END #endif // !defined(CPPUNIT_NO_TESTPLUGIN) diff --git a/include/cppunit/plugin/PlugInManager.h b/include/cppunit/plugin/PlugInManager.h index f349ab1..87455f0 100644 --- a/include/cppunit/plugin/PlugInManager.h +++ b/include/cppunit/plugin/PlugInManager.h @@ -13,8 +13,8 @@ #include <cppunit/plugin/Parameters.h> struct CppUnitTestPlugIn; -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class DynamicLibraryManager; class TestResult; @@ -99,8 +99,7 @@ private: }; -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/plugin/TestPlugIn.h b/include/cppunit/plugin/TestPlugIn.h index b77d50b..568293e 100644 --- a/include/cppunit/plugin/TestPlugIn.h +++ b/include/cppunit/plugin/TestPlugIn.h @@ -7,8 +7,9 @@ #include <cppunit/plugin/Parameters.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + + class Test; class TestFactoryRegistry; class TestResult; @@ -53,8 +54,8 @@ struct CppUnitTestPlugIn * N.B.: Parameters interface is not define yet, and the plug-in runner does * not yet support plug-in parameter. */ - virtual void initialize( CppUnit::TestFactoryRegistry *registry, - const CppUnit::Parameters ¶meters ) =0; + virtual void initialize( CPPUNIT_NS(TestFactoryRegistry) *registry, + const CPPUNIT_NS(Parameters) ¶meters ) =0; /*! Gives a chance to the plug-in to register TestListener. * @@ -63,17 +64,17 @@ struct CppUnitTestPlugIn * setUp some global resource: listen to TestListener::startTestRun(), * and TestListener::endTestRun(). */ - virtual void addListener( CppUnit::TestResult *eventManager ) =0; + virtual void addListener( CPPUNIT_NS(TestResult) *eventManager ) =0; /*! Gives a chance to the plug-in to remove its registered TestListener. * * Override this method to remove a TestListener that has been added. */ - virtual void removeListener( CppUnit::TestResult *eventManager ) =0; + virtual void removeListener( CPPUNIT_NS(TestResult) *eventManager ) =0; /*! Provides a way for the plug-in to register some XmlOutputterHook. */ - virtual void addXmlOutputterHooks( CppUnit::XmlOutputter *outputter ) =0; + virtual void addXmlOutputterHooks( CPPUNIT_NS(XmlOutputter) *outputter ) =0; /*! Called when the XmlOutputter is destroyed. * @@ -89,7 +90,7 @@ struct CppUnitTestPlugIn * reference on test that are no longer available if they are not * unregistered. */ - virtual void uninitialize( CppUnit::TestFactoryRegistry *registry ) =0; + virtual void uninitialize( CPPUNIT_NS(TestFactoryRegistry) *registry ) =0; }; @@ -185,7 +186,7 @@ typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); * \see CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL(), CPPUNIT_PLUGIN_IMPLEMENT_MAIN(). */ #define CPPUNIT_PLUGIN_IMPLEMENT() \ - CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CppUnit::TestPlugInDefaultImpl ); \ + CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS(TestPlugInDefaultImpl) ); \ CPPUNIT_PLUGIN_IMPLEMENT_MAIN() diff --git a/include/cppunit/plugin/TestPlugInDefaultImpl.h b/include/cppunit/plugin/TestPlugInDefaultImpl.h index 90d4398..a6cc09e 100644 --- a/include/cppunit/plugin/TestPlugInDefaultImpl.h +++ b/include/cppunit/plugin/TestPlugInDefaultImpl.h @@ -7,8 +7,8 @@ #include <cppunit/plugin/TestPlugIn.h> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class TestSuite; @@ -45,7 +45,7 @@ public: }; -} // namespace CppUnit +CPPUNIT_NS_END #endif // !defined(CPPUNIT_NO_TESTPLUGIN) diff --git a/include/cppunit/tools/StringTools.h b/include/cppunit/tools/StringTools.h index cc325dc..d08c6e0 100644 --- a/include/cppunit/tools/StringTools.h +++ b/include/cppunit/tools/StringTools.h @@ -6,30 +6,29 @@ #include <vector> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + /*! \brief Tool functions to manipulate string. */ -namespace StringTools +struct StringTools { typedef std::vector<std::string> Strings; - std::string CPPUNIT_API toString( int value ); - - std::string CPPUNIT_API toString( double value ); + static std::string CPPUNIT_API toString( int value ); - Strings CPPUNIT_API split( const std::string &text, - char separator ); + static std::string CPPUNIT_API toString( double value ); - std::string CPPUNIT_API wrap( const std::string &text, - int wrapColumn = 79 ); + static Strings CPPUNIT_API split( const std::string &text, + char separator ); -} // namespace StringTools + static std::string CPPUNIT_API wrap( const std::string &text, + int wrapColumn = CPPUNIT_WRAP_COLUMN ); +}; -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_TOOLS_STRINGTOOLS_H diff --git a/include/cppunit/tools/XmlDocument.h b/include/cppunit/tools/XmlDocument.h index 564fb20..005c736 100644 --- a/include/cppunit/tools/XmlDocument.h +++ b/include/cppunit/tools/XmlDocument.h @@ -11,8 +11,8 @@ #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class XmlElement; @@ -64,7 +64,6 @@ protected: #endif -} // namespace CppUnit - +CPPUNIT_NS_END #endif // CPPUNIT_TOOLS_XMLDOCUMENT_H diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h index 760002d..8d4d504 100644 --- a/include/cppunit/tools/XmlElement.h +++ b/include/cppunit/tools/XmlElement.h @@ -12,8 +12,8 @@ #include <string> -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class XmlElement; @@ -139,9 +139,7 @@ private: }; - -} // namespace CppUnit - +CPPUNIT_NS_END #if CPPUNIT_NEED_DLL_DECL #pragma warning( pop ) diff --git a/include/cppunit/ui/mfc/TestRunner.h b/include/cppunit/ui/mfc/TestRunner.h index b58ee42..7186bf6 100644 --- a/include/cppunit/ui/mfc/TestRunner.h +++ b/include/cppunit/ui/mfc/TestRunner.h @@ -24,8 +24,8 @@ - export class using AFX_EXT_CLASS */ -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + class Test; class TestSuite; @@ -61,23 +61,24 @@ public: void run(); - void addTest( CppUnit::Test *test ); + void addTest( Test *test ); - void addTests( const std::vector<CppUnit::Test *> &tests ); + void addTests( const std::vector<Test *> &tests ); protected: - CppUnit::Test *getRootTest(); + Test *getRootTest(); - CppUnit::TestSuite *m_suite; + TestSuite *m_suite; - typedef std::vector<CppUnit::Test *> Tests; + typedef std::vector<Test *> Tests; Tests m_tests; }; } // namespace MfcUi -} // namespace CppUnit + +CPPUNIT_NS_END #endif // CPPUNITUI_MFC_TESTRUNNER_H diff --git a/include/cppunit/ui/qt/TestRunner.h b/include/cppunit/ui/qt/TestRunner.h index d293b08..d58772b 100644 --- a/include/cppunit/ui/qt/TestRunner.h +++ b/include/cppunit/ui/qt/TestRunner.h @@ -9,8 +9,9 @@ #include <vector> #include "Config.h" -namespace CppUnit -{ +CPPUNIT_NS_BEGIN + + class Test; class TestSuite; @@ -51,7 +52,7 @@ public: void run( bool autoRun =false ); - void addTest( CppUnit::Test *test ); + void addTest( Test *test ); private: /// Prevents the use of the copy constructor. @@ -70,12 +71,6 @@ private: }; - -// Inlines methods for TestRunner: -// ------------------------------- - - - } // namespace QtUi -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_QTUI_TESTRUNNER_H diff --git a/include/cppunit/ui/text/TestRunner.h b/include/cppunit/ui/text/TestRunner.h index 93c7352..13bb8b0 100644 --- a/include/cppunit/ui/text/TestRunner.h +++ b/include/cppunit/ui/text/TestRunner.h @@ -8,7 +8,8 @@ #include <vector> #include <cppunit/TestRunner.h> -namespace CppUnit { +CPPUNIT_NS_BEGIN + class Outputter; class Test; @@ -62,11 +63,11 @@ namespace TextUi * * \see CompilerOutputter, XmlOutputter, TextOutputter. */ -class CPPUNIT_API TestRunner : public CppUnit::TestRunner +class CPPUNIT_API TestRunner : public CPPUNIT_NS(TestRunner) { public: // Work around VC++ bug (class has same name as parent) - typedef CppUnit::TestRunner SuperClass; + typedef CPPUNIT_NS(TestRunner) SuperClass; TestRunner( Outputter *outputter =NULL ); @@ -95,6 +96,6 @@ protected: } // namespace TextUi -} // namespace CppUnit +CPPUNIT_NS_END #endif // CPPUNIT_UI_TEXT_TESTRUNNER_H |
