diff options
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | NEWS | 5 | ||||
| -rw-r--r-- | include/cppunit/extensions/TestSuiteBuilderContext.h | 11 | ||||
| -rw-r--r-- | src/cppunit/TestSuiteBuilderContext.cpp | 30 |
4 files changed, 47 insertions, 7 deletions
@@ -1,3 +1,11 @@ +2004-06-18 Baptiste Lepilleur <gaiacrtn@free.fr> + + * include/cppunit/extension/TestSuiteBuilderContext.h: + * src/cppunit/TestSuiteBuilderContext.cpp: fixed bug #921843. This bug + was caused by a known STL bug in VC++ 6. + See http://www.dinkumware.com/vc_fixes.html <xtree> issue with shared + std::map in dll. As a work-around the map has been replaced by a vector. + 2004-06-17 Baptiste Lepilleur <gaiacrtn@free.fr> * include/cppunit/Portability.h: @@ -7,6 +7,11 @@ - Memory checker: bug #938753, array bound read in splitPathString() with substr if an empty string is passed. + - Crash when using CPPUNIT_TEST_SUITE_REGISTRATION with cppunit dll. + Bug #921843. This bug was caused by a known STL bug in VC++ 6. + See http://www.dinkumware.com/vc_fixes.html <xtree> issue with shared + std::map in dll. + * Compilation: - Compilation: mingw & cigwin, bug #930338 & #945737 fixed. diff --git a/include/cppunit/extensions/TestSuiteBuilderContext.h b/include/cppunit/extensions/TestSuiteBuilderContext.h index 171455b..db26926 100644 --- a/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -10,6 +10,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif + CPPUNIT_NS_BEGIN class TestSuite; @@ -37,6 +38,8 @@ public: const TestNamer &namer, TestFixtureFactory &factory ); + virtual ~TestSuiteBuilderContextBase(); + /*! \brief Adds a test to the fixture suite. * * \param test Test to add to the fixture suite. Must not be \c NULL. @@ -74,11 +77,17 @@ public: protected: TestFixture *makeTestFixture() const; - typedef CppUnitMap<std::string,std::string> Properties; + // Notes: we use a vector here instead of a map to work-around the + // shared std::map in dll bug in VC6. + // See http://www.dinkumware.com/vc_fixes.html for detail. + typedef std::pair<std::string,std::string> Property; + typedef CppUnitVector<Property> Properties; TestSuite &m_suite; const TestNamer &m_namer; TestFixtureFactory &m_factory; + +private: Properties m_properties; }; diff --git a/src/cppunit/TestSuiteBuilderContext.cpp b/src/cppunit/TestSuiteBuilderContext.cpp index 06aa12e..ff71b52 100644 --- a/src/cppunit/TestSuiteBuilderContext.cpp +++ b/src/cppunit/TestSuiteBuilderContext.cpp @@ -17,6 +17,11 @@ TestSuiteBuilderContextBase::TestSuiteBuilderContextBase( } +TestSuiteBuilderContextBase::~TestSuiteBuilderContextBase() +{ +} + + void TestSuiteBuilderContextBase::addTest( Test *test ) { @@ -50,17 +55,30 @@ void TestSuiteBuilderContextBase::addProperty( const std::string &key, const std::string &value ) { - m_properties[ key ] = value; + Properties::iterator it = m_properties.begin(); + for ( ; it != m_properties.end(); ++it ) + { + if ( (*it).first == key ) + { + (*it).second = value; + return; + } + } + + Property property( key, value ); + m_properties.push_back( property ); } const std::string TestSuiteBuilderContextBase::getStringProperty( const std::string &key ) const { - Properties::const_iterator itFound = m_properties.find( key ); - if ( itFound == m_properties.end() ) - return ""; - - return (*itFound).second; + Properties::const_iterator it = m_properties.begin(); + for ( ; it != m_properties.end(); ++it ) + { + if ( (*it).first == key ) + return (*it).second; + } + return ""; } |
