summaryrefslogtreecommitdiff
path: root/include/cppunit/extensions
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-12 04:59:58 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-12 04:59:58 +0000
commit10c39014e897d43e118e2ddd4f2c90b7de7ec517 (patch)
treeb27b56c7e70c4cd464b18be73aa7f4e416676b2e /include/cppunit/extensions
parent6943d47a76445bbfebc99859ed38698760354642 (diff)
downloadcppunit-10c39014e897d43e118e2ddd4f2c90b7de7ec517.tar.gz
Include/cppunit/config/Portability.
include/cppunit/config/Portability.h: If the compiler does not support namespace (CPPUNIT_HAVE_NAMESPACES=0), define CPPUNIT_NO_STD_NAMESPACE and CPPUNIT_NO_NAMESPACE. If CPPUNIT_NO_STD_NAMESPACE is defined, then CppUnit assumes that STL are in the global namespace. If CPPUNIT_NO_NAMESPACE is defined, then CppUnit classes are placed in the global namespace instead of the CppUnit namespace. * include/cppunit/config/config-bcb5.h: * include/cppunit/config/config-msvc6.h: added definition of macro CPPUNIT_HAVE_NAMESPACES. * include/cppunit/tools/StringTools.h: use CPPUNIT_WRAP_COLUMN as default parameter value for wrap(). * include/cppunit/*/*.h: * src/cppunit/*.cpp: changed all CppUnit namespace declaration to use macros CPPUNIT_NS_BEGIN and CPPUNIT_NS_END. Also, changed reference to CppUnit namespace (essentially in macros) using CPPUNIT_NS macro.
Diffstat (limited to 'include/cppunit/extensions')
-rw-r--r--include/cppunit/extensions/AutoRegisterSuite.h5
-rw-r--r--include/cppunit/extensions/HelperMacros.h104
-rw-r--r--include/cppunit/extensions/Orthodox.h6
-rw-r--r--include/cppunit/extensions/RepeatedTest.h5
-rw-r--r--include/cppunit/extensions/TestDecorator.h6
-rw-r--r--include/cppunit/extensions/TestFactory.h6
-rw-r--r--include/cppunit/extensions/TestFactoryRegistry.h6
-rw-r--r--include/cppunit/extensions/TestNamer.h13
-rw-r--r--include/cppunit/extensions/TestSetUp.h5
-rw-r--r--include/cppunit/extensions/TestSuiteBuilder.h5
-rw-r--r--include/cppunit/extensions/TestSuiteFactory.h6
-rw-r--r--include/cppunit/extensions/TypeInfoHelper.h6
12 files changed, 93 insertions, 80 deletions
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