diff options
| author | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-05-06 16:21:31 +0000 |
|---|---|---|
| committer | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-05-06 16:21:31 +0000 |
| commit | c29893f76ae8c37e14eb99f25d517535c1d37b42 (patch) | |
| tree | e32a57e2fb34631739510a726e3865d3f3db9a32 | |
| parent | 92c488aa6f744a1f0f0bbc92ad485d5cc715736a (diff) | |
| download | cppunit-c29893f76ae8c37e14eb99f25d517535c1d37b42.tar.gz | |
Removed unnecessary #include's of TestSuiteBuilder.h
Removed RTTI dependent stuff from TestSuite and TestSuiteBuilder.
| -rw-r--r-- | examples/msvc6/HostApp/ExampleTestCase.cpp | 13 | ||||
| -rw-r--r-- | include/cppunit/TestCaller.h | 4 | ||||
| -rw-r--r-- | include/cppunit/TestSuite.h | 3 | ||||
| -rw-r--r-- | include/cppunit/extensions/AutoRegisterSuite.h | 2 | ||||
| -rw-r--r-- | include/cppunit/extensions/HelperMacros.h | 8 | ||||
| -rw-r--r-- | include/cppunit/extensions/Orthodox.h | 6 | ||||
| -rw-r--r-- | include/cppunit/extensions/TestSuiteBuilder.h | 6 | ||||
| -rw-r--r-- | include/cppunit/extensions/TestSuiteFactory.h | 2 | ||||
| -rw-r--r-- | src/cppunit/TestFactoryRegistry.cpp | 2 | ||||
| -rw-r--r-- | src/cppunit/TestSuite.cpp | 19 |
10 files changed, 18 insertions, 47 deletions
diff --git a/examples/msvc6/HostApp/ExampleTestCase.cpp b/examples/msvc6/HostApp/ExampleTestCase.cpp index 6cfd562..98089dd 100644 --- a/examples/msvc6/HostApp/ExampleTestCase.cpp +++ b/examples/msvc6/HostApp/ExampleTestCase.cpp @@ -1,12 +1,7 @@ -#include <cppunit/extensions/TestSuiteBuilder.h> - #include "ExampleTestCase.h" - CU_TEST_SUITE_REGISTRATION( ExampleTestCase ); - - void ExampleTestCase::example () { assertDoublesEqual (1.0, 1.1, 0.05); @@ -45,10 +40,10 @@ void ExampleTestCase::testEquals () std::auto_ptr<long> l1 (new long (12)); std::auto_ptr<long> l2 (new long (12)); - assertLongsEqual (12, 12); - assertLongsEqual (12L, 12L); - assertLongsEqual (*l1, *l2); - + assertLongsEqual (12, 12); + assertLongsEqual (12L, 12L); + assertLongsEqual (*l1, *l2); + assert (12L == 12L); assertLongsEqual (12, 13); assertDoublesEqual (12.0, 11.99, 0.5); diff --git a/include/cppunit/TestCaller.h b/include/cppunit/TestCaller.h index 6af6e79..9262b86 100644 --- a/include/cppunit/TestCaller.h +++ b/include/cppunit/TestCaller.h @@ -41,7 +41,7 @@ namespace CppUnit { * \see TestCase */ - template <class Fixture> + template <typename Fixture> class TestCaller : public TestCase { typedef void (Fixture::*TestMethod)(); @@ -89,7 +89,7 @@ namespace CppUnit { * \param testMethod Method called by the TestCaller. * \return TestCaller for the specified method. */ - template<class Fixture> + template<typename Fixture> Test *makeTestCaller( std::string name, void (Fixture::*testMethod)() ) { return new TestCaller<Fixture>( name, testMethod ); diff --git a/include/cppunit/TestSuite.h b/include/cppunit/TestSuite.h index 7934ad4..f61cbf6 100644 --- a/include/cppunit/TestSuite.h +++ b/include/cppunit/TestSuite.h @@ -32,9 +32,6 @@ namespace CppUnit { { public: TestSuite (std::string name = ""); -#ifdef USE_TYPEINFO - TestSuite (const std::type_info &info ); -#endif // USE_TYPEINFO ~TestSuite (); void run (TestResult *result); diff --git a/include/cppunit/extensions/AutoRegisterSuite.h b/include/cppunit/extensions/AutoRegisterSuite.h index e80122f..21ef224 100644 --- a/include/cppunit/extensions/AutoRegisterSuite.h +++ b/include/cppunit/extensions/AutoRegisterSuite.h @@ -17,7 +17,7 @@ namespace CppUnit { * \param TestCaseType Type of the test case which suite is registered. * \see CU_TEST_SUITE_REGISTRATION. */ - template<class TestCaseType> + template<typename TestCaseType> class AutoRegisterSuite { public: diff --git a/include/cppunit/extensions/HelperMacros.h b/include/cppunit/extensions/HelperMacros.h index 0cb3495..126483e 100644 --- a/include/cppunit/extensions/HelperMacros.h +++ b/include/cppunit/extensions/HelperMacros.h @@ -6,6 +6,7 @@ #ifndef CPPUNIT_EXTENSIONS_HELPERMACROS_H #define CPPUNIT_EXTENSIONS_HELPERMACROS_H +#include <string> #include <cppunit/extensions/AutoRegisterSuite.h> #include <cppunit/extensions/TestSuiteBuilder.h> @@ -49,7 +50,7 @@ * You only need to specify the full qualified name of the class. For example: * * \code - * template<class CharType> + * template<typename CharType> * class StringTest : public CppUnit::Testcase { * CU_TEST_SUITE( StringTest<CharType> ); * CU_TEST( testAppend ); @@ -76,11 +77,12 @@ static CppUnit::Test *suite() \ { \ __ThisTestCaseType *test =NULL; \ - CppUnit::TestSuiteBuilder<__ThisTestCaseType> suite; \ + CppUnit::TestSuiteBuilder<__ThisTestCaseType> \ + suite(std::string(#ATestCaseType)); \ __ThisTestCaseType::registerTests( suite, test ); \ return suite.takeSuite(); \ } \ - template<class TestCaseType> \ + template<typename TestCaseType> \ static void \ registerTests( CppUnit::TestSuiteBuilder<TestCaseType> &suite, \ TestCaseType *test ) \ diff --git a/include/cppunit/extensions/Orthodox.h b/include/cppunit/extensions/Orthodox.h index 109afae..e7667d1 100644 --- a/include/cppunit/extensions/Orthodox.h +++ b/include/cppunit/extensions/Orthodox.h @@ -38,7 +38,7 @@ namespace CppUnit { */ -template <class ClassUnderTest> class Orthodox : public TestCase +template <typename ClassUnderTest> class Orthodox : public TestCase { public: Orthodox () : TestCase ("Orthodox") {} @@ -52,7 +52,7 @@ protected: // Run an orthodoxy test -template <class ClassUnderTest> void Orthodox<ClassUnderTest>::runTest () +template <typename ClassUnderTest> void Orthodox<ClassUnderTest>::runTest () { // make sure we have a default constructor ClassUnderTest a, b, c; @@ -82,7 +82,7 @@ template <class ClassUnderTest> void Orthodox<ClassUnderTest>::runTest () // Exercise a call -template <class ClassUnderTest> ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) +template <typename ClassUnderTest> ClassUnderTest Orthodox<ClassUnderTest>::call (ClassUnderTest object) { return object; } diff --git a/include/cppunit/extensions/TestSuiteBuilder.h b/include/cppunit/extensions/TestSuiteBuilder.h index b20d2f9..d85683d 100644 --- a/include/cppunit/extensions/TestSuiteBuilder.h +++ b/include/cppunit/extensions/TestSuiteBuilder.h @@ -7,7 +7,7 @@ namespace CppUnit { - template<class Fixture> + template<typename Fixture> class TestSuiteBuilder { public: @@ -17,11 +17,9 @@ namespace CppUnit { { } -#ifdef USE_TYPEINFO - TestSuiteBuilder() : m_suite( new TestSuite( typeid( Fixture) ) ) + TestSuiteBuilder(std::string name) : m_suite( new TestSuite(name) ) { } -#endif // USE_TYPEINFO TestSuite *suite() const { diff --git a/include/cppunit/extensions/TestSuiteFactory.h b/include/cppunit/extensions/TestSuiteFactory.h index 1df6c70..b1e39c3 100644 --- a/include/cppunit/extensions/TestSuiteFactory.h +++ b/include/cppunit/extensions/TestSuiteFactory.h @@ -7,7 +7,7 @@ namespace CppUnit { class Test; - template<class TestCaseType> + template<typename TestCaseType> class TestSuiteFactory : public AbstractTestFactory { public: diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp index b38cbb4..f73c177 100644 --- a/src/cppunit/TestFactoryRegistry.cpp +++ b/src/cppunit/TestFactoryRegistry.cpp @@ -6,7 +6,6 @@ #include <utility> #include "cppunit/TestSuite.h" #include "cppunit/extensions/TestFactoryRegistry.h" -#include "cppunit/extensions/TestSuiteBuilder.h" #ifdef USE_TYPEINFO #include "TypeInfoHelper.h" @@ -19,7 +18,6 @@ TestFactoryRegistry::TestFactoryRegistry( std::string name ) : { } - TestFactoryRegistry::~TestFactoryRegistry() { for ( Factories::iterator it = m_factories.begin(); it != m_factories.end(); ++it ) diff --git a/src/cppunit/TestSuite.cpp b/src/cppunit/TestSuite.cpp index e776cb2..33ea2ce 100644 --- a/src/cppunit/TestSuite.cpp +++ b/src/cppunit/TestSuite.cpp @@ -1,8 +1,5 @@ #include "cppunit/TestSuite.h" #include "cppunit/TestResult.h" -#ifdef USE_TYPEINFO -#include "TypeInfoHelper.h" -#endif // USE_TYPEINFO namespace CppUnit { @@ -16,7 +13,6 @@ void TestSuite::deleteContents () m_tests.clear(); } - /// Runs the tests and collects their result in a TestResult. void TestSuite::run (TestResult *result) { @@ -47,33 +43,18 @@ int TestSuite::countTestCases () const } - - /// Default constructor TestSuite::TestSuite (std::string name) : m_name (name) { } -#ifdef USE_TYPEINFO -/** Constructs a test suite named after the specified type_info. - * \param info type_info used to name the suite. The 'class' prefix - * is stripped from the name. - */ -TestSuite::TestSuite(const std::type_info &info ) : - m_name( TypeInfoHelper::getClassName( info ) ) -{ -} -#endif // USE_TYPEINFO - - /// Destructor TestSuite::~TestSuite () { deleteContents (); } - /// Adds a test to the suite. void TestSuite::addTest (Test *test) |
