Thread: [Cppunit-cvs] cppunit2/include/cpput assert.h,1.6,1.7 message.h,1.5,1.6 registry.h,1.1.1.1,1.2 strin
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-02-27 10:15:51
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2513/include/cpput Modified Files: assert.h message.h registry.h stringize.h test.h testcase.h testfixture.h testinfo.h testsuite.h translate.h typehelper.h Log Message: * use CppTL::ConstString instead of std::string for thread-safety Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testinfo.h 21 Nov 2004 22:22:24 -0000 1.7 --- testinfo.h 27 Feb 2005 10:15:41 -0000 1.8 *************** *** 99,103 **** bool CPPUT_API testHasFailed(); ! void CPPUT_API log( const std::string &text ); void CPPUT_API appendFaultToResult( const OpenTest::Properties &fault ); --- 99,103 ---- bool CPPUT_API testHasFailed(); ! void CPPUT_API log( const CppTL::ConstString &text ); void CPPUT_API appendFaultToResult( const OpenTest::Properties &fault ); Index: testsuite.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testsuite.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testsuite.h 17 Nov 2004 21:47:09 -0000 1.3 --- testsuite.h 27 Feb 2005 10:15:41 -0000 1.4 *************** *** 13,17 **** AbstractTestSuite(); ! AbstractTestSuite( const std::string &name ); virtual int testCount() const = 0; --- 13,17 ---- AbstractTestSuite(); ! AbstractTestSuite( const CppTL::ConstString &name ); virtual int testCount() const = 0; *************** *** 31,35 **** { public: ! TestSuite( const std::string &name ); void add( const TestPtr &test ); --- 31,35 ---- { public: ! TestSuite( const CppTL::ConstString &name ); void add( const TestPtr &test ); *************** *** 50,54 **** ! TestSuitePtr CPPUT_API makeTestSuite( const std::string &name ); } // namespace CppUT --- 50,54 ---- ! TestSuitePtr CPPUT_API makeTestSuite( const CppTL::ConstString &name ); } // namespace CppUT Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** assert.h 20 Nov 2004 15:06:59 -0000 1.6 --- assert.h 27 Feb 2005 10:15:41 -0000 1.7 *************** *** 25,30 **** const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message = Message() ); --- 25,30 ---- const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message = Message() ); *************** *** 67,72 **** } ! Message CPPUT_API buildUnequalityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message = Message() ); --- 67,72 ---- } ! Message CPPUT_API buildUnequalityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message = Message() ); *************** *** 171,175 **** message.add( "Type: " + \ ::CppUT::extractObjectType( e, "std::exception" ) ); \ ! message.add( std::string("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ --- 171,175 ---- message.add( "Type: " + \ ::CppUT::extractObjectType( e, "std::exception" ) ); \ ! message.add( CppTL::ConstString("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ Index: registry.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/registry.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** registry.h 27 Jan 2004 20:34:28 -0000 1.1.1.1 --- registry.h 27 Feb 2005 10:15:41 -0000 1.2 *************** *** 2,7 **** # define CPPUT_REGISTRY_H_INCLUDED - # include <cpput/config.h> # include <cpput/forwards.h> # include <cpput/functor.h> # include <deque> --- 2,7 ---- # define CPPUT_REGISTRY_H_INCLUDED # include <cpput/forwards.h> + # include <cpptl/conststring.h> # include <cpput/functor.h> # include <deque> *************** *** 19,23 **** { public: ! static std::string defaultParentSuiteName(); static Registry &instance(); --- 19,23 ---- { public: ! static CppTL::ConstString defaultParentSuiteName(); static Registry &instance(); *************** *** 25,35 **** Registry(); ! void addChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ); ! bool removeChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ); ! TestFactoryId add( const std::string &parentSuiteName, const TestFactory &testFactory ); --- 25,35 ---- Registry(); ! void addChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ); ! bool removeChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ); ! TestFactoryId add( const CppTL::ConstString &parentSuiteName, const TestFactory &testFactory ); *************** *** 38,53 **** bool remove( TestFactoryId testFactoryId ); ! TestSuitePtr createTests( const std::string &suiteName ) const; TestSuitePtr createDefaultTests() const; ! void addCreatedTests( const std::string &suiteName, const TestSuitePtr &suite ) const; private: ! void addChildSuite( const std::string &suiteName, const TestSuitePtr &suite ) const; ! void addSuiteRegisteredTests( const std::string &suiteName, const TestSuitePtr &suite ) const; --- 38,53 ---- bool remove( TestFactoryId testFactoryId ); ! TestSuitePtr createTests( const CppTL::ConstString &suiteName ) const; TestSuitePtr createDefaultTests() const; ! void addCreatedTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; private: ! void addChildSuite( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; ! void addSuiteRegisteredTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; *************** *** 57,67 **** typedef std::deque<TestFactoryWithId> TestFactories; ! typedef std::map<std::string,TestFactories> TestFactoryRegistry; TestFactoryRegistry registry_; ! typedef std::multimap<std::string,std::string> ParentChildRelationShips; ParentChildRelationShips relations_; ! typedef std::map<TestFactoryId,std::string> TestFactoryParentSuiteById; TestFactoryParentSuiteById parentSuiteById_; --- 57,67 ---- typedef std::deque<TestFactoryWithId> TestFactories; ! typedef std::map<CppTL::ConstString,TestFactories> TestFactoryRegistry; TestFactoryRegistry registry_; ! typedef std::multimap<CppTL::ConstString,CppTL::ConstString> ParentChildRelationShips; ParentChildRelationShips relations_; ! typedef std::map<TestFactoryId,CppTL::ConstString> TestFactoryParentSuiteById; TestFactoryParentSuiteById parentSuiteById_; *************** *** 81,85 **** { public: ! SuiteRegisterer( const std::string &suiteName = "" ) { registerSuite( suiteName, "" ); --- 81,85 ---- { public: ! SuiteRegisterer( const CppTL::ConstString &suiteName = "" ) { registerSuite( suiteName, "" ); *************** *** 87,92 **** SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const std::string &parentSuiteName, ! const std::string &suiteName = std::string( "" ) ) { registerSuite( suiteName, parentSuiteName ); --- 87,92 ---- SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &suiteName = CppTL::ConstString( "" ) ) { registerSuite( suiteName, parentSuiteName ); *************** *** 99,108 **** protected: ! void registerSuite( const std::string &suiteName, ! const std::string &parentSuiteName ) { ! std::string suiteNameByValue( suiteName ); TestFactory factory = makeFnR0<TestPtr>( ! bindR1( makeCFnR1<TestPtr, std::string>( &SuiteType::suite ), suiteNameByValue ) ); if ( parentSuiteName == "" ) --- 99,108 ---- protected: ! void registerSuite( const CppTL::ConstString &suiteName, ! const CppTL::ConstString &parentSuiteName ) { ! CppTL::ConstString suiteNameByValue( suiteName ); TestFactory factory = makeFnR0<TestPtr>( ! bindR1( makeCFnR1<TestPtr, CppTL::ConstString>( &SuiteType::suite ), suiteNameByValue ) ); if ( parentSuiteName == "" ) *************** *** 144,149 **** { public: ! SuiteRelationshipRegisterer( const std::string &parentSuiteName, ! const std::string &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) --- 144,149 ---- { public: ! SuiteRelationshipRegisterer( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) *************** *** 158,163 **** private: ! std::string parentSuiteName_; ! std::string childSuiteName_; }; --- 158,163 ---- private: ! CppTL::ConstString parentSuiteName_; ! CppTL::ConstString childSuiteName_; }; Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** message.h 23 Feb 2005 21:41:54 -0000 1.5 --- message.h 27 Feb 2005 10:15:41 -0000 1.6 *************** *** 3,8 **** # include <cpput/config.h> ! //# include <opentest/properties.h> ! # include <string> # include <vector> --- 3,7 ---- # include <cpput/config.h> ! # include <cpptl/conststring.h> # include <vector> *************** *** 17,21 **** } ! Message( const std::string &shortDescription ) { add( shortDescription ); --- 16,30 ---- } ! Message( const CppTL::StringBuffer &shortDescription ) ! { ! add( shortDescription ); ! } ! ! Message( const CppTL::StringConcatenator &shortDescription ) ! { ! add( shortDescription ); ! } ! ! Message( const CppTL::ConstString &shortDescription ) { add( shortDescription ); *************** *** 35,43 **** const char *detail ) { ! insertAt( index, std::string(detail) ); } void insertAt( int index, ! const std::string &detail ) { details_.insert( details_.begin() + index, detail ); --- 44,52 ---- const char *detail ) { ! insertAt( index, CppTL::ConstString(detail) ); } void insertAt( int index, ! const CppTL::ConstString &detail ) { details_.insert( details_.begin() + index, detail ); *************** *** 54,66 **** void add( const char *detail ) // needed to solve ambiguity due to implicit constructor { ! add( std::string(detail) ); } ! void add( const std::string &detail ) { details_.push_back( detail ); } ! void add( const Message &other ) { insertAt( details_.size(), other ); --- 63,75 ---- void add( const char *detail ) // needed to solve ambiguity due to implicit constructor { ! add( CppTL::ConstString(detail) ); } ! void add( const CppTL::ConstString &detail ) { details_.push_back( detail ); } ! void extend( const Message &other ) { insertAt( details_.size(), other ); *************** *** 72,83 **** } ! std::string at( int index ) const { return details_.at( index ); } ! std::string toString() const { ! std::string message; Details::const_iterator it = details_.begin(); Details::const_iterator itEnd = details_.end(); --- 81,92 ---- } ! CppTL::ConstString at( int index ) const { return details_.at( index ); } ! CppTL::ConstString toString() const { ! CppTL::ConstString message; Details::const_iterator it = details_.begin(); Details::const_iterator itEnd = details_.end(); *************** *** 110,114 **** //} ! //void setResultType( const std::string &resultType ) //{ // properties().set( "cpput.result_type", resultType ); --- 119,123 ---- //} ! //void setResultType( const CppTL::ConstString &resultType ) //{ // properties().set( "cpput.result_type", resultType ); *************** *** 123,127 **** //Properties properties_; ! typedef std::vector<std::string> Details; Details details_; }; --- 132,136 ---- //Properties properties_; ! typedef std::vector<CppTL::ConstString> Details; Details details_; }; Index: translate.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/translate.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** translate.h 27 Jan 2004 20:34:29 -0000 1.1.1.1 --- translate.h 27 Feb 2005 10:15:41 -0000 1.2 *************** *** 3,7 **** # include <cpput/config.h> ! # include <string> --- 3,7 ---- # include <cpput/config.h> ! # include <cpptl/conststring.h> *************** *** 9,13 **** /// Translate the specified message ! inline std::string CPPUT_API translate( const char *message ) { return message; --- 9,13 ---- /// Translate the specified message ! inline CppTL::ConstString CPPUT_API translate( const char *message ) { return message; Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test.h 20 Nov 2004 16:17:32 -0000 1.4 --- test.h 27 Feb 2005 10:15:41 -0000 1.5 *************** *** 22,26 **** } ! std::string name() const { return info().getValue( "configuration/name", "" ).asString(); --- 22,26 ---- } ! CppTL::ConstString name() const { return info().getValue( "configuration/name", "" ).asString(); *************** *** 29,33 **** /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! void setName( const std::string &name ) { info()["configuration/name"] = name; --- 29,33 ---- /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! void setName( const CppTL::ConstString &name ) { info()["configuration/name"] = name; *************** *** 63,67 **** } ! Test( const std::string &name ) { setName( name ); --- 63,67 ---- } ! Test( const CppTL::ConstString &name ) { setName( name ); Index: stringize.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/stringize.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stringize.h 15 Jun 2004 07:45:42 -0000 1.2 --- stringize.h 27 Feb 2005 10:15:41 -0000 1.3 *************** *** 5,16 **** # include <cpput/config.h> # include <string> namespace CppUT { - // implemented in assertstring.cpp - std::string CPPUT_API quoteString( const std::string &str ); - - template<class ValueType> struct DefaultStringizer --- 5,13 ---- # include <cpput/config.h> # include <string> + # include <cpptl/stringtools.h> namespace CppUT { template<class ValueType> struct DefaultStringizer *************** *** 51,54 **** --- 48,56 ---- } + inline std::string convertToString( const CppTL::ConstString &s ) + { + return s.c_str(); + } + inline NotConvertibleToStdString convertToString( ... ) { *************** *** 75,79 **** std::string stringize( const ValueType &value, const std::string &str ) { ! return quoteString( str ); } --- 77,81 ---- std::string stringize( const ValueType &value, const std::string &str ) { ! return CppTL::quoteString( str ).c_str(); } Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testcase.h 22 Feb 2005 21:14:38 -0000 1.7 --- testcase.h 27 Feb 2005 10:15:41 -0000 1.8 *************** *** 15,19 **** { public: ! AbstractTestCase( const std::string &name ); /// @warning: TestInfo::startNewTest() must be called before each test --- 15,19 ---- { public: ! AbstractTestCase( const CppTL::ConstString &name ); /// @warning: TestInfo::startNewTest() must be called before each test *************** *** 42,51 **** public: TestCase( const Functor0 &run, ! const std::string &name ); TestCase( const Functor0 &setUp, const Functor0 &run, const Functor0 &tearDown, ! const std::string &name ); public: // overridden from AbstractTestCase --- 42,51 ---- public: TestCase( const Functor0 &run, ! const CppTL::ConstString &name ); TestCase( const Functor0 &setUp, const Functor0 &run, const Functor0 &tearDown, ! const CppTL::ConstString &name ); public: // overridden from AbstractTestCase *************** *** 64,68 **** TestPtr CPPUT_API makeTestCase( const Functor0 &run, ! const std::string &name ); --- 64,68 ---- TestPtr CPPUT_API makeTestCase( const Functor0 &run, ! const CppTL::ConstString &name ); *************** *** 70,76 **** const Functor0 &run, const Functor0 &tearDown, ! const std::string &name ); ! TestPtr CPPUT_API makeFailingTestCase( const std::string &name, const Message &message ); --- 70,76 ---- const Functor0 &run, const Functor0 &tearDown, ! const CppTL::ConstString &name ); ! TestPtr CPPUT_API makeFailingTestCase( const CppTL::ConstString &name, const Message &message ); *************** *** 78,82 **** TestPtr makeFixtureTestCase( const CppTL::SharedPtr<FixtureType> &fixture, const Functor0 &run, ! const std::string &name ) { return makeTestCase( makeMemFn0<FixtureType>( fixture, &FixtureType::setUp ), --- 78,82 ---- TestPtr makeFixtureTestCase( const CppTL::SharedPtr<FixtureType> &fixture, const Functor0 &run, ! const CppTL::ConstString &name ) { return makeTestCase( makeMemFn0<FixtureType>( fixture, &FixtureType::setUp ), Index: typehelper.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/typehelper.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** typehelper.h 23 Feb 2005 21:43:44 -0000 1.3 --- typehelper.h 27 Feb 2005 10:15:41 -0000 1.4 *************** *** 11,20 **** namespace Impl { ! inline std::string CPPUT_API extractTypeId( const std::type_info &type, ! const char *hint ) { // VC6 define the macro _CPPRTTI when RTTI is enabled. Is that standard & portable ? ! std::string typeName( type.name() ); const int classKeywordLength = 6; if ( typeName.substr( 0, classKeywordLength ) == "class " ) --- 11,20 ---- namespace Impl { ! inline CppTL::ConstString CPPUT_API extractTypeId( const std::type_info &type, ! const char *hint ) { // VC6 define the macro _CPPRTTI when RTTI is enabled. Is that standard & portable ? ! CppTL::ConstString typeName( type.name() ); const int classKeywordLength = 6; if ( typeName.substr( 0, classKeywordLength ) == "class " ) *************** *** 25,30 **** template<class AType> ! std::string extractType( CppTL::Type<AType>, ! const char *hint ) { return Impl::extractTypeId( typeid( AType ), hint ); --- 25,30 ---- template<class AType> ! CppTL::ConstString extractType( CppTL::Type<AType>, ! const char *hint ) { return Impl::extractTypeId( typeid( AType ), hint ); *************** *** 32,37 **** template<typename Object> ! std::string extractObjectType( const Object &object, ! const char *hint ) { return Impl::extractTypeId( typeid(object), hint ); --- 32,37 ---- template<typename Object> ! CppTL::ConstString extractObjectType( const Object &object, ! const char *hint ) { return Impl::extractTypeId( typeid(object), hint ); Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testfixture.h 17 Nov 2004 08:59:05 -0000 1.5 --- testfixture.h 27 Feb 2005 10:15:41 -0000 1.6 *************** *** 118,122 **** typedef FixtureType CppUT_ThisType; ! static std::string defaultSuiteName() { return ::CppUT::extractType<CppUT_ThisType>( #FixtureType ); --- 118,122 ---- typedef FixtureType CppUT_ThisType; ! static CppTL::ConstString defaultSuiteName() { return ::CppUT::extractType<CppUT_ThisType>( #FixtureType ); *************** *** 160,164 **** # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! std::string( #FixtureType ) # endif // if CPPUT_USE_RTTI_TO_NAME_SUITE --- 160,164 ---- # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! CppTL::ConstString( #FixtureType ) # endif // if CPPUT_USE_RTTI_TO_NAME_SUITE *************** *** 169,173 **** typedef FixtureType CppUT_ThisType; \ \ ! static std::string defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ --- 169,173 ---- typedef FixtureType CppUT_ThisType; \ \ ! static CppTL::ConstString defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ *************** *** 188,192 **** } \ \ ! static ::CppUT::TestPtr suite( std::string suiteName = std::string("") ) \ { \ if ( suiteName.empty() ) \ --- 188,192 ---- } \ \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = CppTL::ConstString("") ) \ { \ if ( suiteName.empty() ) \ *************** *** 215,219 **** { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! std::string suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ --- 215,219 ---- { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! CppTL::ConstString suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ |