[Cppunit-cvs] cppunit2/include/opentest properties.h,1.10,1.11 testrunner.h,1.3,1.4 texttestdriver.h
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-02-27 10:16:25
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2583/include/opentest Modified Files: properties.h testrunner.h texttestdriver.h Log Message: * use CppTL::ConstString instead of std::string for thread-safety Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/testrunner.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testrunner.h 19 Nov 2004 21:39:13 -0000 1.3 --- testrunner.h 27 Feb 2005 10:15:57 -0000 1.4 *************** *** 34,41 **** } ! virtual TestId beginSuite( const std::string &name, const Properties &data ) = 0; ! virtual TestId addTest( const std::string &name, const Properties &data ) = 0; --- 34,41 ---- } ! virtual TestId beginSuite( const CppTL::ConstString &name, const Properties &data ) = 0; ! virtual TestId addTest( const CppTL::ConstString &name, const Properties &data ) = 0; Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** texttestdriver.h 26 Feb 2005 11:45:06 -0000 1.7 --- texttestdriver.h 27 Feb 2005 10:15:57 -0000 1.8 *************** *** 76,88 **** TextTestDriver( TestRunner &runner ); ! // void selectTest( const std::string &name ); bool run(); private: // overriden from TestDeclarator ! TestId beginSuite( const std::string &name, const Properties &data ); ! TestId addTest( const std::string &name, const Properties &data ); --- 76,88 ---- TextTestDriver( TestRunner &runner ); ! // void selectTest( const CppTL::ConstString &name ); bool run(); private: // overriden from TestDeclarator ! TestId beginSuite( const CppTL::ConstString &name, const Properties &data ); ! TestId addTest( const CppTL::ConstString &name, const Properties &data ); *************** *** 123,127 **** { TestInfo( TestId id, ! const std::string &name, const Properties &info, const ParentSuites &parents ) --- 123,127 ---- { TestInfo( TestId id, ! const CppTL::ConstString &name, const Properties &info, const ParentSuites &parents ) *************** *** 134,138 **** TestId id_; ! std::string name_; Properties info_; ParentSuites parents_; --- 134,138 ---- TestId id_; ! CppTL::ConstString name_; Properties info_; ParentSuites parents_; *************** *** 152,159 **** void declareTestOrSuite( TestId id, ! const std::string &name, const Properties &data ); ! std::string getTestPath( TestId test, unsigned int maxParent = (unsigned int)-1 ) const; void reportFailure( const TestResult &testResult, --- 152,159 ---- void declareTestOrSuite( TestId id, ! const CppTL::ConstString &name, const Properties &data ); ! CppTL::ConstString getTestPath( TestId test, unsigned int maxParent = (unsigned int)-1 ) const; void reportFailure( const TestResult &testResult, *************** *** 318,322 **** inline TestId ! TextTestDriver::beginSuite( const std::string &name, const Properties &data ) { --- 318,322 ---- inline TestId ! TextTestDriver::beginSuite( const CppTL::ConstString &name, const Properties &data ) { *************** *** 330,334 **** inline TestId ! TextTestDriver::addTest( const std::string &name, const Properties &data ) { --- 330,334 ---- inline TestId ! TextTestDriver::addTest( const CppTL::ConstString &name, const Properties &data ) { *************** *** 349,353 **** void TextTestDriver::declareTestOrSuite( TestId id, ! const std::string &name, const Properties &data ) { --- 349,353 ---- void TextTestDriver::declareTestOrSuite( TestId id, ! const CppTL::ConstString &name, const Properties &data ) { *************** *** 423,427 **** PropertiesAccessor status = result.accessor()["result"]["status"]; bool succeeded = status.getValue( "success", false ).asBool(); ! std::string statusInfo = succeeded ? "OK" : "FAIL"; if ( succeeded ) successes_.push_back( results_.size() - 1 ); --- 423,427 ---- PropertiesAccessor status = result.accessor()["result"]["status"]; bool succeeded = status.getValue( "success", false ).asBool(); ! CppTL::ConstString statusInfo = succeeded ? "OK" : "FAIL"; if ( succeeded ) successes_.push_back( results_.size() - 1 ); *************** *** 429,433 **** failures_.push_back( results_.size() - 1 ); ! std::string resultType = status.getValue( "type", "" ).asString(); if ( !resultType.empty() ) statusInfo += " (" + resultType + ")"; --- 429,433 ---- failures_.push_back( results_.size() - 1 ); ! CppTL::ConstString resultType = status.getValue( "type", "" ).asString(); if ( !resultType.empty() ) statusInfo += " (" + resultType + ")"; *************** *** 506,514 **** std::cout << getTestPath( testResult.test() ) << std::endl; ! std::string failureType = info["result"]["status"].getValue("type","").asString(); if ( !failureType.empty() ) std::cout << "Failure type : " << failureType << std::endl; ! std::string message = info["result"]["status"].getValue("message","").asString(); if ( !message.empty() ) std::cout << message << std::endl; --- 506,514 ---- std::cout << getTestPath( testResult.test() ) << std::endl; ! CppTL::ConstString failureType = info["result"]["status"].getValue("type","").asString(); if ( !failureType.empty() ) std::cout << "Failure type : " << failureType << std::endl; ! CppTL::ConstString message = info["result"]["status"].getValue("message","").asString(); if ( !message.empty() ) std::cout << message << std::endl; *************** *** 540,544 **** std::cout << getTestPath( testResult.test() ) << std::endl; ! std::string failureType = failure.getValue( "failure_type", isAssertion ? "assertion" : "fault" ).asString(); --- 540,544 ---- std::cout << getTestPath( testResult.test() ) << std::endl; ! CppTL::ConstString failureType = failure.getValue( "failure_type", isAssertion ? "assertion" : "fault" ).asString(); *************** *** 549,553 **** while ( enumMessages.hasNext() ) { // @todo check type ! std::string message = enumMessages.next().asString(); std::cout << message << std::endl; } --- 549,553 ---- while ( enumMessages.hasNext() ) { // @todo check type ! CppTL::ConstString message = enumMessages.next().asString(); std::cout << message << std::endl; } *************** *** 558,562 **** while ( enumLogs.hasNext() ) { // @todo check type ! std::string log = enumLogs.next().asString(); std::cout << log << std::endl; } --- 558,562 ---- while ( enumLogs.hasNext() ) { // @todo check type ! CppTL::ConstString log = enumLogs.next().asString(); std::cout << log << std::endl; } *************** *** 565,572 **** } ! inline std::string TextTestDriver::getTestPath( TestId test, unsigned int maxParent ) const { ! std::string path; const TestInfo &info = getTestInfo( test ); path = "/" + info.name_; --- 565,572 ---- } ! inline CppTL::ConstString TextTestDriver::getTestPath( TestId test, unsigned int maxParent ) const { ! CppTL::ConstString path; const TestInfo &info = getTestInfo( test ); path = "/" + info.name_; Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** properties.h 23 Feb 2005 21:40:13 -0000 1.10 --- properties.h 27 Feb 2005 10:15:57 -0000 1.11 *************** *** 3,10 **** # include <opentest/forwards.h> # include <cpptl/enumerator.h> # include <stdexcept> # include <deque> - # include <string> # include <vector> # include <typeinfo> // for std::bad_cast --- 3,10 ---- # include <opentest/forwards.h> + # include <cpptl/conststring.h> # include <cpptl/enumerator.h> # include <stdexcept> # include <deque> # include <vector> # include <typeinfo> // for std::bad_cast *************** *** 12,18 **** namespace OpenTest { - /// @todo For thread-safety, std::string need to be replaced with an implementation - /// that guaranty that the copy constructor is thread-safe. - class OPENTEST_API ValueBadCast : public std::bad_cast { --- 12,15 ---- *************** *** 74,78 **** Value( const char *value ); ! Value( const std::string &value ); Value( const Properties &value ); --- 71,75 ---- Value( const char *value ); ! Value( const CppTL::ConstString &value ); Value( const Properties &value ); *************** *** 100,104 **** long double asReal() const; ! std::string asString() const; const Properties &asProperties() const; --- 97,101 ---- long double asReal() const; ! CppTL::ConstString asString() const; const Properties &asProperties() const; *************** *** 141,145 **** Properties &append( const Value &value ); ! std::string toString() const; private: --- 138,142 ---- Properties &append( const Value &value ); ! CppTL::ConstString toString() const; private: *************** *** 169,175 **** { public: ! typedef CppTL::AnyEnumerator<std::string> NamesEnum; ! PropertyPath( const std::string &path, char separator = '/' ); --- 166,172 ---- { public: ! typedef CppTL::AnyEnumerator<CppTL::ConstString> NamesEnum; ! PropertyPath( const CppTL::ConstString &path, char separator = '/' ); *************** *** 179,183 **** NamesEnum names() const; ! PropertyPath &add( const std::string &name ); PropertyPath &addPath( const PropertyPath &path ); --- 176,180 ---- NamesEnum names() const; ! PropertyPath &add( const CppTL::ConstString &name ); PropertyPath &addPath( const PropertyPath &path ); *************** *** 185,194 **** PropertyPath parent() const; ! const std::string &name() const; bool isEmpty() const; private: ! typedef std::deque<std::string> PropertyNames; PropertyPath( const PropertyNames &names ); --- 182,191 ---- PropertyPath parent() const; ! const CppTL::ConstString &name() const; bool isEmpty() const; private: ! typedef std::deque<CppTL::ConstString> PropertyNames; PropertyPath( const PropertyNames &names ); *************** *** 204,211 **** { public: ! Property( const std::string &name, const Value &value ); ! const std::string &name() const; const Value &value() const; --- 201,208 ---- { public: ! Property( const CppTL::ConstString &name, const Value &value ); ! const CppTL::ConstString &name() const; const Value &value() const; *************** *** 214,218 **** private: ! std::string name_; Value value_; }; --- 211,215 ---- private: ! CppTL::ConstString name_; Value value_; }; *************** *** 232,236 **** typedef CppTL::AnyEnumerator<Value> ValueEnum; typedef CppTL::AnyEnumerator<Property> PropertyEnum; ! typedef CppTL::AnyEnumerator<std::string> NameEnum; Properties(); --- 229,233 ---- typedef CppTL::AnyEnumerator<Value> ValueEnum; typedef CppTL::AnyEnumerator<Property> PropertyEnum; ! typedef CppTL::AnyEnumerator<CppTL::ConstString> NameEnum; Properties(); *************** *** 250,259 **** Properties &set( const Property &property ); ! Properties &set( const std::string &name, const Value &value ); Properties &setIfNew( const Property &property ); ! Properties &setIfNew( const std::string &name, const Value &value ); --- 247,256 ---- Properties &set( const Property &property ); ! Properties &set( const CppTL::ConstString &name, const Value &value ); Properties &setIfNew( const Property &property ); ! Properties &setIfNew( const CppTL::ConstString &name, const Value &value ); *************** *** 304,308 **** PropertyEnum properties() const; ! std::string toString() const; private: --- 301,305 ---- PropertyEnum properties() const; ! CppTL::ConstString toString() const; private: *************** *** 314,320 **** struct NameAdaptor { ! typedef std::string result_type; ! std::string operator()( const Property &property ) const { return property.name(); --- 311,317 ---- struct NameAdaptor { ! typedef CppTL::ConstString result_type; ! CppTL::ConstString operator()( const Property &property ) const { return property.name(); *************** *** 322,328 **** }; ! PropertyList::iterator find( const std::string &name ); ! PropertyList::const_iterator find( const std::string &name ) const; PropertyList::const_iterator resolvePath( const PropertyPath &path ) const; --- 319,325 ---- }; ! PropertyList::iterator find( const CppTL::ConstString &name ); ! PropertyList::const_iterator find( const CppTL::ConstString &name ) const; PropertyList::const_iterator resolvePath( const PropertyPath &path ) const; *************** *** 336,340 **** void checkPathNotEmpty( const PropertyPath &path ) const; ! std::string toString( const std::string &prefix ) const; PropertyList properties_; --- 333,337 ---- void checkPathNotEmpty( const PropertyPath &path ) const; ! CppTL::ConstString toString( const CppTL::ConstString &prefix ) const; PropertyList properties_; |