Thread: [Cppunit-cvs] cppunit2/include/cpput assert.h,1.13,1.14 forwards.h,1.18,1.19 message.h,1.10,1.11 reg
Brought to you by:
blep
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802/include/cpput Modified Files: assert.h forwards.h message.h registry.h test.h testcase.h testfixture.h testinfo.h testsuite.h translate.h Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** testinfo.h 8 Nov 2005 20:25:49 -0000 1.15 --- testinfo.h 8 Nov 2005 21:44:54 -0000 1.16 *************** *** 70,83 **** const Message &messages() const; ! void setTestDataType( const CppTL::ConstString &type ); ! const CppTL::ConstString &testDataType() const; ! void setTestData( const CppTL::ConstString &name, const Json::Value &value, ! const CppTL::ConstString &type = "basic" ); const Json::Value &testData() const; ! CppTL::ConstString toString() const; private: --- 70,83 ---- const Message &messages() const; ! void setTestDataType( const std::string &type ); ! std::string testDataType() const; ! void setTestData( const std::string &name, const Json::Value &value, ! const std::string &type = "basic" ); const Json::Value &testData() const; ! std::string toString() const; private: *************** *** 109,117 **** bool hasFailed() const; ! void setStatistics( const CppTL::ConstString &name, const Json::Value &value ); ! //Json::Value getStatistics( const CppTL::ConstString &name ); ! void addSpecific( const CppTL::ConstString &type, const Json::Value &value ); private: --- 109,117 ---- bool hasFailed() const; ! void setStatistics( const std::string &name, const Json::Value &value ); ! //Json::Value getStatistics( const std::string &name ); ! void addSpecific( const std::string &type, const Json::Value &value ); private: *************** *** 213,216 **** --- 213,218 ---- void CPPUT_API log( const Json::Value &log ); + void CPPUT_API log( const std::string &log ); + // This overload allows usage of StringConcatenator... void CPPUT_API log( const CppTL::ConstString &log ); Index: testsuite.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testsuite.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testsuite.h 20 Jul 2005 21:06:49 -0000 1.5 --- testsuite.h 8 Nov 2005 21:44:54 -0000 1.6 *************** *** 13,17 **** AbstractTestSuite(); ! AbstractTestSuite( const CppTL::ConstString &name ); virtual int testCount() const = 0; --- 13,17 ---- AbstractTestSuite(); ! AbstractTestSuite( const std::string &name ); virtual int testCount() const = 0; *************** *** 31,35 **** { public: ! TestSuite( const CppTL::ConstString &name ); void add( const TestPtr &test ); --- 31,35 ---- { public: ! TestSuite( const std::string &name ); void add( const TestPtr &test ); *************** *** 48,52 **** ! TestSuitePtr CPPUT_API makeTestSuite( const CppTL::ConstString &name ); } // namespace CppUT --- 48,52 ---- ! TestSuitePtr CPPUT_API makeTestSuite( const std::string &name ); } // namespace CppUT Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** assert.h 6 Sep 2005 07:17:36 -0000 1.13 --- assert.h 8 Nov 2005 21:44:54 -0000 1.14 *************** *** 25,30 **** const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message = Message() ); --- 25,30 ---- const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( 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() ); --- 67,72 ---- } ! Message CPPUT_API buildUnequalityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message = Message() ); *************** *** 221,225 **** message.add( "Type: " + \ ::CppTL::getObjectTypeName( e, "std::exception" ) ); \ ! message.add( CppTL::ConstString("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ --- 221,225 ---- message.add( "Type: " + \ ::CppTL::getObjectTypeName( e, "std::exception" ) ); \ ! message.add( std::string("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ Index: registry.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/registry.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** registry.h 3 Mar 2005 20:57:14 -0000 1.4 --- registry.h 8 Nov 2005 21:44:54 -0000 1.5 *************** *** 19,23 **** { public: ! static CppTL::ConstString defaultParentSuiteName(); static Registry &instance(); --- 19,23 ---- { public: ! static std::string defaultParentSuiteName(); static Registry &instance(); *************** *** 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 ); --- 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 ); *************** *** 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; --- 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; *************** *** 81,85 **** { public: ! SuiteRegisterer( const CppTL::ConstString &suiteName = "" ) { registerSuite( suiteName, "" ); --- 81,85 ---- { public: ! SuiteRegisterer( const std::string &suiteName = "" ) { registerSuite( suiteName, "" ); *************** *** 87,92 **** SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &suiteName = CppTL::ConstString( "" ) ) { registerSuite( suiteName, parentSuiteName ); --- 87,92 ---- SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const std::string &parentSuiteName, ! const std::string &suiteName = std::string( "" ) ) { registerSuite( suiteName, parentSuiteName ); *************** *** 99,110 **** protected: ! void registerSuite( const CppTL::ConstString &suiteName, ! const CppTL::ConstString &parentSuiteName ) { CppTL::ConstString suiteNameByValue( suiteName ); TestFactory factory = CppTL::bind_cfnr<TestPtr>( &SuiteType::suite, suiteNameByValue ); - if ( parentSuiteName == "" ) - parentSuiteName == Registry::defaultParentSuiteName(); testFactoryId_ = Registry::instance().add( parentSuiteName, factory ); } --- 99,108 ---- protected: ! void registerSuite( const std::string &suiteName, ! const std::string &parentSuiteName ) { CppTL::ConstString suiteNameByValue( suiteName ); TestFactory factory = CppTL::bind_cfnr<TestPtr>( &SuiteType::suite, suiteNameByValue ); testFactoryId_ = Registry::instance().add( parentSuiteName, factory ); } *************** *** 143,148 **** { public: ! SuiteRelationshipRegisterer( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) --- 141,146 ---- { public: ! SuiteRelationshipRegisterer( const std::string &parentSuiteName, ! const std::string &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) *************** *** 153,157 **** ~SuiteRelationshipRegisterer() { ! Registry::instance().removeChild( parentSuiteName_, childSuiteName_ ); } --- 151,156 ---- ~SuiteRelationshipRegisterer() { ! Registry::instance().removeChild( parentSuiteName_.str(), ! childSuiteName_.str() ); } Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** message.h 8 Nov 2005 20:25:49 -0000 1.10 --- message.h 8 Nov 2005 21:44:54 -0000 1.11 *************** *** 32,35 **** --- 32,40 ---- } + Message( const std::string &shortDescription ) + { + add( shortDescription ); + } + Message( const char *shortDescription ) { *************** *** 45,53 **** const char *detail ) { ! insertAt( index, CppTL::ConstString(detail) ); } void insertAt( int index, ! const CppTL::ConstString &detail ) { details_.insert( details_.begin() + index, detail ); --- 50,58 ---- const char *detail ) { ! insertAt( index, std::string(detail) ); } void insertAt( int index, ! const std::string &detail ) { details_.insert( details_.begin() + index, detail ); *************** *** 67,70 **** --- 72,80 ---- } + void add( const std::string &detail ) + { + details_.push_back( detail ); + } + void add( const CppTL::ConstString &detail ) { *************** *** 82,91 **** } ! CppTL::ConstString at( int index ) const { ! return CPPTL_AT( details_, index ); } ! CppTL::ConstString toString() const { CppTL::StringBuffer message; --- 92,101 ---- } ! std::string at( int index ) const { ! return CPPTL_AT( details_, index ).str(); } ! std::string toString() const { CppTL::StringBuffer message; *************** *** 102,116 **** } ! return message; ! } ! /* ! OpenTest::Properties asProperties() const ! { ! OpenTest::Properties messages; ! for ( int index =0; index < details_.size(); ++index ) ! messages.append( details_[index] ); ! return messages; } ! */ private: typedef std::vector<CppTL::ConstString> Details; --- 112,118 ---- } ! return message.c_str(); } ! private: typedef std::vector<CppTL::ConstString> Details; Index: translate.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/translate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** translate.h 27 Feb 2005 10:15:41 -0000 1.2 --- translate.h 8 Nov 2005 21:44:54 -0000 1.3 *************** *** 9,13 **** /// Translate the specified message ! inline CppTL::ConstString CPPUT_API translate( const char *message ) { return message; --- 9,13 ---- /// Translate the specified message ! inline std::string CPPUT_API translate( const char *message ) { return message; Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test.h 8 Nov 2005 20:25:49 -0000 1.9 --- test.h 8 Nov 2005 21:44:54 -0000 1.10 *************** *** 24,40 **** } ! void setDescription( const CppTL::ConstString &description ) { info_["configuration/description"] = description; } ! CppTL::ConstString description() const { ! return info_.get("configuration/description", "" ).asConstString(); } ! CppTL::ConstString name() const { ! return info_.get( "configuration/name", "" ).asConstString(); } --- 24,40 ---- } ! void setDescription( const std::string &description ) { info_["configuration/description"] = description; } ! std::string description() const { ! return info_.get("configuration/description", "" ).asString(); } ! std::string name() const { ! return info_.get( "configuration/name", "" ).asString(); } *************** *** 51,55 **** /// @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; --- 51,55 ---- /// @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; *************** *** 85,89 **** } ! Test( const CppTL::ConstString &name ) { setName( name ); --- 85,89 ---- } ! Test( const std::string &name ) { setName( name ); Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** forwards.h 10 Aug 2005 21:34:29 -0000 1.18 --- forwards.h 8 Nov 2005 21:44:54 -0000 1.19 *************** *** 32,38 **** - TestSuitePtr CPPUT_API makeTestSuite( const CppTL::ConstString &name ); - - } // namespace CppUT --- 32,35 ---- Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testcase.h 6 Sep 2005 07:14:49 -0000 1.11 --- testcase.h 8 Nov 2005 21:44:54 -0000 1.12 *************** *** 14,18 **** { public: ! AbstractTestCase( const CppTL::ConstString &name ); bool runTest(); --- 14,18 ---- { public: ! AbstractTestCase( const std::string &name ); bool runTest(); *************** *** 45,54 **** public: TestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ); TestCase( const CppTL::Functor0 &setUp, const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ); public: // overridden from AbstractTestCase --- 45,54 ---- public: TestCase( const CppTL::Functor0 &run, ! const std::string &name ); TestCase( const CppTL::Functor0 &setUp, const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ); public: // overridden from AbstractTestCase *************** *** 67,71 **** TestPtr CPPUT_API makeTestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ); --- 67,71 ---- TestPtr CPPUT_API makeTestCase( const CppTL::Functor0 &run, ! const std::string &name ); *************** *** 73,79 **** const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ); ! TestPtr CPPUT_API makeFailingTestCase( const CppTL::ConstString &name, const Message &message ); --- 73,79 ---- const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ); ! TestPtr CPPUT_API makeFailingTestCase( const std::string &name, const Message &message ); *************** *** 82,86 **** TestPtr makeFixtureTestCase( const CppTL::IntrusivePtr<FixtureType> &fixture, const CppTL::Functor0 &run, ! const CppTL::ConstString &name ) { return makeTestCase( CppTL::memfn0( fixture, &FixtureType::setUp ), --- 82,86 ---- TestPtr makeFixtureTestCase( const CppTL::IntrusivePtr<FixtureType> &fixture, const CppTL::Functor0 &run, ! const std::string &name ) { return makeTestCase( CppTL::memfn0( fixture, &FixtureType::setUp ), Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testfixture.h 6 Aug 2005 22:24:53 -0000 1.10 --- testfixture.h 8 Nov 2005 21:44:54 -0000 1.11 *************** *** 130,134 **** typedef FixtureType CppUT_ThisType; ! static CppTL::ConstString defaultSuiteName() { return ::CppTL::getTypeName<CppUT_ThisType>( #FixtureType ); --- 130,134 ---- typedef FixtureType CppUT_ThisType; ! static std::string defaultSuiteName() { return ::CppTL::getTypeName<CppUT_ThisType>( #FixtureType ); *************** *** 172,176 **** # 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 --- 172,176 ---- # 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 *************** *** 181,185 **** typedef FixtureType CppUT_ThisType; \ \ ! static CppTL::ConstString defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ --- 181,185 ---- typedef FixtureType CppUT_ThisType; \ \ ! static std::string defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ *************** *** 200,208 **** } \ \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = CppTL::ConstString("") ) \ { \ if ( suiteName.empty() ) \ suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName ); \ ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ addTests_( testSuite, factory ); \ --- 200,208 ---- } \ \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = std::string("") ) \ { \ if ( suiteName.empty() ) \ suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName.str() ); \ ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ addTests_( testSuite, factory ); \ *************** *** 237,241 **** { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! CppTL::ConstString suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ --- 237,241 ---- { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! std::string suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ |