cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 23)
Brought to you by:
blep
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(94) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(114) |
Mar
(80) |
Apr
|
May
|
Jun
(36) |
Jul
(67) |
Aug
(37) |
Sep
(33) |
Oct
(28) |
Nov
(91) |
Dec
(16) |
2006 |
Jan
(1) |
Feb
(7) |
Mar
(45) |
Apr
|
May
|
Jun
(36) |
Jul
(7) |
Aug
|
Sep
(32) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
(29) |
Feb
(11) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(13) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(15) |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:47:47
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18666/cpptl Modified Files: config.h Log Message: added CPPTL_MIN & CPPTL_MAX macros. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** config.h 7 Mar 2005 21:34:45 -0000 1.17 --- config.h 24 Jun 2005 19:47:39 -0000 1.18 *************** *** 189,192 **** --- 189,195 ---- #define CPPTL_MAKE_UNIQUE_NAME( prefix ) CPPTL_JOIN( prefix, __LINE__ ) + #define CPPTL_MIN( a, b ) ((a) < (b) ? a : b) + #define CPPTL_MAX( a, b ) ((a) > (b) ? a : b) + /////////////////////////////////////////////////////////////////////////// |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:45:58
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17727/src/cpput Modified Files: properties.cpp Log Message: removed support for 'long double'. Not much support for that type in the standard library => it would raise too much portability issue. Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** properties.cpp 5 Mar 2005 12:29:11 -0000 1.10 --- properties.cpp 24 Jun 2005 19:45:49 -0000 1.11 *************** *** 67,77 **** - Value::Value( long double value ) - { - guts_.type_ = vtReal; - guts_.realValue_ = value; - } - - Value::Value( const char *value ) { --- 67,70 ---- *************** *** 253,257 **** # endif // ifndef CPPTL_NO_INT64 ! long double Value::asReal() const { --- 246,250 ---- # endif // ifndef CPPTL_NO_INT64 ! double Value::asReal() const { *************** *** 263,269 **** #ifndef CPPTL_NO_INT64_TO_DOUBLE case vtSignedInteger: ! return (long double)(guts_.intValue_); case vtUnsignedInteger: ! return (long double)(guts_.uintValue_); #endif case vtReal: --- 256,262 ---- #ifndef CPPTL_NO_INT64_TO_DOUBLE case vtSignedInteger: ! return (double)(guts_.intValue_); case vtUnsignedInteger: ! return (double)(guts_.uintValue_); #endif case vtReal: |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:45:57
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17727/include/opentest Modified Files: properties.h Log Message: removed support for 'long double'. Not much support for that type in the standard library => it would raise too much portability issue. Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** properties.h 27 Feb 2005 10:15:57 -0000 1.11 --- properties.h 24 Jun 2005 19:45:49 -0000 1.12 *************** *** 67,72 **** Value( double value ); - Value( long double value ); - Value( const char *value ); --- 67,70 ---- *************** *** 95,99 **** # endif ! long double asReal() const; CppTL::ConstString asString() const; --- 93,97 ---- # endif ! double asReal() const; CppTL::ConstString asString() const; *************** *** 151,155 **** StorageInt intValue_; StorageUInt uintValue_; ! long double realValue_; char *stringValue_; Properties *propertiesValue_; --- 149,153 ---- StorageInt intValue_; StorageUInt uintValue_; ! double realValue_; char *stringValue_; Properties *propertiesValue_; |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:43:31
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16515/src/opentest Added Files: interfaces.cpp Log Message: TestRunner / TestDriver communication interface --- NEW FILE: interfaces.cpp --- #include <opentest/interfaces.h> #include <opentest/serializer.h> namespace OpenTest { Stream & TestDescriptionCommon::serialize( Stream &stream ) const { return stream << id_ << name_ << description_ << descriptionSpecific_; } Stream & TestDescriptionCommon::unserialize( Stream &stream ) { return stream >> id_ >> name_ >> description_ >> descriptionSpecific_; } Stream & TestCaseDescription::serialize( Stream &stream ) const { TestDescriptionCommon::serialize( stream ); return stream << inputFormatName_ << inputFormat_ << outputFormatName_ << outputFormat_; } Stream & TestCaseDescription::unserialize( Stream &stream ) { TestDescriptionCommon::unserialize( stream ); return stream >> inputFormatName_ >> inputFormat_ >> outputFormatName_ >> outputFormat_; } Stream & TestSuiteDescription::serialize( Stream &stream ) const { TestDescriptionCommon::serialize( stream ); return serializeSTLSequence( stream, children_ ); } Stream & TestSuiteDescription::unserialize( Stream &stream ) { TestDescriptionCommon::unserialize( stream ); return unserializeSTLSequence( stream, children_ ); } Stream & TestDescriptions::serialize( Stream &stream ) const { serializeSTLSequence( stream, testCases_ ); return serializeSTLSequence( stream, testSuites_ ); } Stream & TestDescriptions::unserialize( Stream &stream ) { unserializeSTLSequence( stream, testCases_ ); return unserializeSTLSequence( stream, testSuites_ ); } Stream & TestPlan::serialize( Stream &stream ) const { TestCaseDescription::serialize( stream ); return stream << testCase_ << input_ << expectedOutput_; } Stream & TestPlan::unserialize( Stream &stream ) { TestCaseDescription::unserialize( stream ); return stream >> testCase_ >> input_ >> expectedOutput_; } Stream & TestPlans::serialize( Stream &stream ) const { return serializeSTLSequence( stream, testPlans_ ); } Stream & TestPlans::unserialize( Stream &stream ) { return unserializeSTLSequence( stream, testPlans_ ); } Stream & ResultLog::serialize( Stream &stream ) const { return stream << log_ << logSpecific_; } Stream & ResultLog::unserialize( Stream &stream ) { return stream >> log_ >> logSpecific_; } Stream & ResultAssertion::serialize( Stream &stream ) const { return stream << assertionType_ << assertionFormat_ << message_ << expectedSpecific_ << actualSpecific_; } Stream & ResultAssertion::unserialize( Stream &stream ) { return stream >> assertionType_ >> assertionFormat_ >> message_ >> expectedSpecific_ >> actualSpecific_; } Stream & ResultInputOutput::serialize( Stream &stream ) const { return stream << inputFormat_ << outputFormat_ << input_ << expected_ << actual_; } Stream & ResultInputOutput::unserialize( Stream &stream ) { return stream >> inputFormat_ >> outputFormat_ >> input_ >> expected_ >> actual_; } Stream & ResultStatus::serialize( Stream &stream ) const { return stream << status_ << subStatus_ << statusSpecific_ << statistics_; } Stream & ResultStatus::unserialize( Stream &stream ) { return stream >> status_ >> subStatus_ >> statusSpecific_ >> statistics_; } } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:43:30
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16515/include/opentest Added Files: interfaces.h Log Message: TestRunner / TestDriver communication interface --- NEW FILE: interfaces.h --- #ifndef OPENTEST_INTERFACES_H_INCLUDED # define OPENTEST_INTERFACES_H_INCLUDED # include <opentest/forwards.h> # include <opentest/properties.h> # include <map> # include <vector> namespace OpenTest { class OPENTEST_API TestRunnerInterface { public: virtual ~TestRunnerInterface() {} virtual void getTestDescriptions() = 0; virtual void getTestPlans() = 0; virtual void runTests( const TestPlan &plan ) = 0; virtual void stopTests() = 0; }; class OPENTEST_API TestDriverInterface { public: virtual ~TestDriverInterface() {} virtual void setTestDescriptions( TestDescriptions &tests ) = 0; virtual void setDefaultTestPlan( const TestPlan &plan ) = 0; virtual void startTesting( TestId testPlan ) = 0; virtual void addResultLog( TestId testPlan, const ResultLog &log ) = 0; virtual void addResultAssertion( TestId testPlan, const ResultAssertion &assertion ) = 0; virtual void setResultInputActualOutput( TestId testPlan, const ResultInputOutput &output ) = 0; virtual void setTestResult( TestId testPlan, ResultStatus &status ) = 0; virtual void testPlanDone( TestPlanId id ) = 0; }; class OPENTEST_API TestDescriptionCommon { public: TestId id_; String name_; String description_; Properties descriptionSpecific_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API TestCaseDescription : public TestDescriptionCommon { public: String inputFormatName_; Properties inputFormat_; String outputFormatName_; Properties outputFormat_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API TestSuiteDescription : public TestDescriptionCommon { public: std::deque<TestId> children_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API TestDescriptions { public: std::deque<TestCaseDescription> testCases_; std::deque<TestSuiteDescription> testSuites_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API TestPlan : public TestCaseDescription { public: TestId testCase_; Properties input_; Properties expectedOutput_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API TestPlans { public: std::deque<TestPlan> testPlans_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API ResultLog { public: String log_; Properties logSpecific_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API ResultAssertion { public: String assertionType_; String assertionFormat_; String message_; Properties expectedSpecific_; Properties actualSpecific_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API ResultInputOutput { public: String inputFormat_; String outputFormat_; Properties input_; Properties expected_; Properties actual_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; class OPENTEST_API ResultStatus { public: String status_; String subStatus_; Properties statusSpecific_; Properties statistics_; Stream &serialize( Stream &stream ) const; Stream &unserialize( Stream &stream ); }; inline Stream &OPENTEST_API operator <<( Stream &stream, const TestDescriptionCommon &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestDescriptionCommon &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const TestCaseDescription &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestCaseDescription &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const TestSuiteDescription &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestSuiteDescription &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const TestDescriptions &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestDescriptions &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const TestPlan &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestPlan &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const TestPlans &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, TestPlans &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const ResultLog &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, ResultLog &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const ResultAssertion &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, ResultAssertion &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const ResultInputOutput &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, ResultInputOutput &v ) { return v.unserialize( stream ); } inline Stream &OPENTEST_API operator <<( Stream &stream, const ResultStatus &v ) { return v.serialize( stream ); } inline Stream &OPENTEST_API operator >>( Stream &stream, ResultStatus &v ) { return v.unserialize( stream ); } } // namespace OpenTest #endif // OPENTEST_INTERFACES_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-06-24 19:42:06
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16055/include/opentest Modified Files: serializer.h Log Message: Fixed serialization of stl sequence. Index: serializer.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/serializer.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** serializer.h 24 Jun 2005 08:23:49 -0000 1.1 --- serializer.h 24 Jun 2005 19:41:50 -0000 1.2 *************** *** 98,103 **** Stream &serializeSTLSequence( Stream &stream, const SequenceType &sequence ) { ! typedef CPPTL_TYPENAME SequenceType::const_iterator it = sequence.begin(); ! typedef CPPTL_TYPENAME SequenceType::const_iterator itEnd = sequence.end(); unsigned int size = itEnd - it; stream << size; --- 98,103 ---- Stream &serializeSTLSequence( Stream &stream, const SequenceType &sequence ) { ! CPPTL_TYPENAME SequenceType::const_iterator it = sequence.begin(); ! CPPTL_TYPENAME SequenceType::const_iterator itEnd = sequence.end(); unsigned int size = itEnd - it; stream << size; *************** *** 108,118 **** template<class SequenceType> ! Stream &unserializeSTLSequence( Stream &stream, const SequenceType &sequence ) { unsigned int size; stream >> size; sequence.resize( size ); ! typedef CPPTL_TYPENAME SequenceType::const_iterator it = sequence.begin(); ! typedef CPPTL_TYPENAME SequenceType::const_iterator itEnd = sequence.end(); for ( ; it != itEnd; ++it ) stream >> *it; --- 108,118 ---- template<class SequenceType> ! Stream &unserializeSTLSequence( Stream &stream, SequenceType &sequence ) { unsigned int size; stream >> size; sequence.resize( size ); ! CPPTL_TYPENAME SequenceType::iterator it = sequence.begin(); ! CPPTL_TYPENAME SequenceType::iterator itEnd = sequence.end(); for ( ; it != itEnd; ++it ) stream >> *it; |
From: Baptiste L. <bl...@us...> - 2005-06-24 08:24:03
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9787/src/opentest Added Files: serializer.cpp Log Message: - serialization layer on top of growing buffer for one way communication. --- NEW FILE: serializer.cpp --- #include <opentest/serializer.h> #include <float.h> // For struct assertion_traits<double> #include <stdio.h> namespace OpenTest { /* 0x20: 0x21:! 0x22:" 0x23:# 0x24:$ 0x25:% 0x26:& 0x27:' 0x28:( 0x29:) 0x2a:* 0x2b:+ 0x2c:, 0x2d:- 0x2e:. 0x2f:/ 0x30:0 0x31:1 0x32:2 0x33:3 0x34:4 0x35:5 0x36:6 0x37:7 0x38:8 0x39:9 0x3a:: 0x3b:; 0x3c:< 0x3d:= 0x3e:> 0x3f:? 0x40:@ 0x41:A 0x42:B 0x43:C 0x44:D 0x45:E 0x46:F 0x47:G 0x48:H 0x49:I 0x4a:J 0x4b:K 0x4c:L 0x4d:M 0x4e:N 0x4f:O 0x50:P 0x51:Q 0x52:R 0x53:S 0x54:T 0x55:U 0x56:V 0x57:W 0x58:X 0x59:Y 0x5a:Z 0x5b:[ 0x5c:\ 0x5d:] 0x5e:^ 0x5f:_ 0x60:` 0x61:a 0x62:b 0x63:c 0x64:d 0x65:e 0x66:f 0x67:g 0x68:h 0x69:i 0x6a:j 0x6b:k 0x6c:l 0x6d:m 0x6e:n 0x6f:o 0x70:p 0x71:q 0x72:r 0x73:s 0x74:t 0x75:u 0x76:v 0x77:w 0x78:x 0x79:y 0x7a:z 0x7b:{ 0x7c:| 0x7d:} 0x7e:~ 0x7f: Encoding: 0x20-0x30: stream control character 0x30-0xff: stream content character Notes: encoding real number that way is too complicated. It also does not handle +-inf and nan. */ enum ControlChar { ccBooleanTrue = 0x21, // '!' ccString = 0x22, // '"' ccBooleanFalse = 0x23, // '#' ccLookUpDictionnaryEntry = 0x24, // '$' ccEndBuffer = 0x25, // '%' ccNoneValue = 0x26, // '&' ccNewDictionnaryEntry = 0x27, // "'" ccPropertyList = 0x28, // '(' ccNamedPropertiesEnd = 0x29, // ')' ccPositiveReal = 0x2a, // '*' ccPositiveInteger = 0x2b, // '+' ccNegativeInteger = 0x2d, // '-' ccRealDot = 0x2e, // '.' ccNegativeReal = 0x2f, // '/' ccIntegerZero = 0x30, // integer shift for encoding ccIntegerBaseShift = 6 // power of 2 for encoding base (0x40 = 1 << 6) }; Stream::Stream() : current_( buffers_.begin() ) , currentData_( 0 ) , endData_( 0 ) , writeBufferSize_( 16384 ) , error_( 0 ) { } Stream::~Stream() { while ( !buffers_.empty() ) { delete[] (unsigned char *)buffers_.back().data_; buffers_.pop_back(); } } bool Stream::inError() const { return error_ != 0; } Stream & Stream::setError( const char *errorMessage ) { if ( !error_ ) error_ = errorMessage; return *this; } void Stream::addBuffer( unsigned int length, const void *data ) { write( data, length ); current_ = buffers_.begin(); currentData_ = current_->data_; endData_ = currentData_ + length; } unsigned char Stream::readNextByte() { if ( currentData_ != endData_ ) return *currentData_++; if ( current_ != buffers_.end() ) { ++current_; if ( current_ != buffers_.end() ) { currentData_ = current_->data_; endData_ = currentData_ + current_->length_; CPPTL_ASSERT_MESSAGE( currentData_ != endData_, "invariant violation: 0 length data buffer" ); return *currentData_++; } } return ccEndBuffer; } void Stream::ungetLastByte() { if ( current_ != buffers_.end() ) { if ( current_->data_ != currentData_ ) { --currentData_; return; } CPPTL_ASSERT_MESSAGE( current_ != buffers_.begin(), "No byte to 'unput'" ); --current_; endData_ = current_->data_ + current_->length_; currentData_ = endData_ - 1; } } void Stream::read( void *buffer, unsigned int length ) { unsigned char *target = static_cast<unsigned char *>( buffer ); unsigned int lengthToCopy = CPPTL_MIN( length, endData_ - currentData_ ); memcpy( target, currentData_, lengthToCopy ); length -= lengthToCopy; currentData_ += lengthToCopy; if ( length != 0 ) // there was not enough data, use next buffers { target += lengthToCopy; ++current_; while ( current_ != buffers_.end() ) { lengthToCopy = CPPTL_MIN( length, current_->length_ ); memcpy( target, current_->data_, lengthToCopy ); target += lengthToCopy; length -= lengthToCopy; if ( length == 0 ) { currentData_ = current_->data_ + lengthToCopy; endData_ = current_->data_ + current_->length_; break; } ++current_; } if ( length != 0 ) { setError( "Attempted to read beyond buffer end." ); currentData_ = endData_; } } } void Stream::write( unsigned char byte ) { if ( currentData_ != endData_ ) *currentData_++ = byte; else write( &byte, 1 ); } void Stream::write( const void *buffer, unsigned int length ) { if ( length == 0 ) return; const unsigned char *source = static_cast<const unsigned char *>( buffer ); unsigned int availableLength = endData_ - currentData_; if ( availableLength < length ) { memcpy( currentData_, source, availableLength ); source += availableLength; length -= availableLength; } unsigned int newBufferLength = length + writeBufferSize_; BufferData dataBuffer; dataBuffer.length_ = newBufferLength; typedef unsigned char BufferElementType; unsigned char *newData = new BufferElementType[ newBufferLength ]; memcpy( newData, source, length ); dataBuffer.data_ = newData; buffers_.push_back( dataBuffer ); current_ = buffers_.end() - 1; currentData_ = newData + length; endData_ = newData + newBufferLength; } Stream & Stream::operator <<( bool value ) { write( value ? ccBooleanTrue : ccBooleanFalse ); return *this; } Stream & Stream::operator <<( int value ) { return *this << CppTL::int64_t( value ); } Stream & Stream::operator <<( unsigned int value ) { doSerializeInteger( ccPositiveInteger, value ); return *this; } #ifndef CPPTL_NO_INT64 Stream & Stream::operator <<( CppTL::int64_t value ) { if ( value >= 0 ) doSerializeInteger( ccPositiveInteger, value ); else doSerializeInteger( ccNegativeInteger, -value ); return *this; } Stream & Stream::operator <<( CppTL::uint64_t value ) { doSerializeInteger( ccPositiveInteger, value ); return *this; } #endif void Stream::doSerializeInteger( unsigned char kind, LargestUnsignedInt value ) { unsigned char buffer[ (sizeof(value) + ccIntegerBaseShift - 1) / ccIntegerBaseShift ]; unsigned char *current = buffer + sizeof(buffer); do { unsigned char reminder = value & ((1 << ccIntegerBaseShift) - 1); *--current = reminder + ccIntegerZero; value >>= ccIntegerBaseShift; } while ( value != 0 ); CPPTL_ASSERT_MESSAGE( current >= &buffer[0], "buffer underrun" ); write( kind ); write( current, buffer + sizeof(buffer) - current ); } Stream & Stream::operator <<( double value ) { #ifdef DBL_DIG const int precision = DBL_DIG; #else const int precision = 15; #endif // #ifdef DBL_DIG char buffer[precision * 2 + 32]; int length = sprintf(buffer, "%.*g", precision, value); char *end = buffer + length; for ( char *current = &buffer[0]; current != end; ++current ) { if ( *current == ccPositiveInteger ) *current = ccPositiveReal; else if ( *current == ccNegativeInteger ) *current = ccNegativeReal; else if ( *current == ccRealDot ) { // do nothing } else { CPPTL_ASSERT_MESSAGE( (unsigned char)*current >= ccIntegerZero, "Real number conversion produced stream control characters!" ); } } if ( buffer[0] == ccNegativeReal ) { write( ccNegativeReal ); write( buffer + 1, length-1 ); } else { write( ccPositiveReal ); write( buffer, length ); } return *this; } Stream & Stream::operator <<( const String &str ) { doSerializeInteger( ccString, str.length() ); write( str.c_str(), str.length() ); return *this; } void Stream::saveDictionnaryEntry( const String &str ) { IndexesByString::const_iterator it = indexesByString_.find( str ); if ( it == indexesByString_.end() ) { unsigned int index = indexesByString_.size(); indexesByString_[ str ] = index; doSerializeInteger( ccNewDictionnaryEntry, str.length() ); write( str.c_str(), str.length() ); } else { doSerializeInteger( ccLookUpDictionnaryEntry, it->second ); } } void Stream::doUnserializeInteger( LargestUnsignedInt &value ) { value = 0; unsigned char digit; while ( (digit = readNextByte()) < ccIntegerZero ) { // if ( value >= maxInt ) // should we detect overflow ? value <<= ccIntegerBaseShift; value |= LargestUnsignedInt(digit-ccIntegerZero); } ungetLastByte(); } Stream & Stream::operator >>( bool &value ) { if ( inError() ) return *this; unsigned char control = readNextByte(); if ( control == ccBooleanTrue ) value = true; else if ( control == ccBooleanFalse ) value = false; else setError( "Boolean expected" ); return *this; } #ifdef CPPTL_NO_INT64 Stream & Stream::operator >>( int &value ) { LargestInt temp; *this >> temp; value = temp; return *this; } Stream & Stream::operator >>( unsigned int &value ) { LargestUnsignedInt temp; *this >> temp; value = temp; return *this; } #endif Stream & Stream::operator >>( LargestInt &value ) { if ( inError() ) return *this; unsigned char control = readNextByte(); LargestUnsignedInt unsignedValue; if ( control == ccPositiveInteger ) { doUnserializeInteger( unsignedValue ); value = unsignedValue; } else if ( control == ccNegativeInteger ) { doUnserializeInteger( unsignedValue ); value = -unsignedValue; } else setError( "Integer expected" ); return *this; } Stream & Stream::operator >>( LargestUnsignedInt &value ) { if ( inError() ) return *this; unsigned char control = readNextByte(); if ( control == ccPositiveInteger ) doUnserializeInteger( value ); else setError( "Unsigned integer expected" ); return *this; } Stream & Stream::operator >>( double &value ) { if ( inError() ) return *this; CppTL::StringBuffer buffer; unsigned char control = readNextByte(); if ( control == ccNegativeReal ) buffer += "-"; else if ( control != ccPositiveReal ) return setError( "Unsigned integer expected" ); char digits[2]; digits[1] = 0; while ( true ) { unsigned char digit = readNextByte(); if ( digit == ccPositiveReal ) buffer += "+"; else if ( digit == ccNegativeReal ) buffer += "-"; else if ( digit == ccRealDot || digit >= ccIntegerZero ) { digits[0] = digit; buffer += digits; } else // control char break; } ungetLastByte(); char *actualEnd = 0; value = strtod( buffer.c_str(), &actualEnd ); if ( actualEnd != buffer.c_str() + buffer.length() ) setError( "Unable to unserialize real number correctly." ); return *this; } Stream & Stream::operator >>( String &str ) { if ( inError() ) return *this; unsigned char control = readNextByte(); if ( control == ccString ) readString( str ); else setError( "String expected" ); return *this; } void Stream::readDictionnaryEntry ( unsigned char control, String &str ) { if ( control == ccLookUpDictionnaryEntry ) { LargestUnsignedInt index; doUnserializeInteger( index ); if ( index >= stringsByIndex_.size() ) setError( "Invalid dictionnary look-up index" ); else str = stringsByIndex_[index]; } else if ( control == ccNewDictionnaryEntry ) { readString( str ); stringsByIndex_.push_back( str ); } else setError( "Dictionnary string expected" ); } void Stream::readString( String &str ) { LargestUnsignedInt length; doUnserializeInteger( length ); if ( length <= sizeof(stringBuffer_) ) { read( stringBuffer_, length ); str = String( stringBuffer_, stringBuffer_ + length ); } else { CppTL::StringBuffer largeBuffer; largeBuffer.truncate( length ); read( &largeBuffer[0], length ); str = String( largeBuffer ); } } Stream & Stream::operator <<( const Properties &properties ) { if ( properties.hasList() ) { doSerializeInteger( ccPropertyList, properties.listSize() ); for ( unsigned int valueIndex =0; valueIndex < properties.listSize(); ++valueIndex ) *this << properties.at( valueIndex ); } Properties::PropertyEnum enumProperties = properties.properties(); if ( enumProperties.hasNext() ) { do { const Property &property = enumProperties.next(); saveDictionnaryEntry( property.name() ); *this << property.value(); } while ( enumProperties.hasNext() ); write( ccNamedPropertiesEnd ); } return *this; } bool Stream::isNamedPropertyControl( unsigned char control ) { return control == ccLookUpDictionnaryEntry || control == ccNewDictionnaryEntry; } Stream & Stream::operator >>( Properties &properties ) { unsigned char control = readNextByte(); if ( control == ccPropertyList ) { LargestUnsignedInt length; doUnserializeInteger( length ); while ( length-- ) { Value value; *this >> value; properties.append( value ); } control = readNextByte(); } if ( !isNamedPropertyControl(control) ) { if ( !properties.hasList() ) setError( "Expected Properties." ); else ungetLastByte(); return *this; } do { String name; readDictionnaryEntry( control, name ); Value value; *this >> value; properties.set( name, value ); control = readNextByte(); } while ( isNamedPropertyControl(control) ); if ( control != ccNamedPropertiesEnd ) setError( "Unexpected end of named property list." ); return *this; } Stream & Stream::operator <<( const Value &value ) { switch ( value.type() ) { case Value::vtNone: write( ccNoneValue ); break; case Value::vtBoolean: *this << value.asBool(); break; #ifndef CPPTL_NO_INT64 case Value::vtSignedInteger: *this << value.asInt64(); break; case Value::vtUnsignedInteger: *this << value.asUInt64(); break; #else case Value::vtSignedInteger: *this << value.asInt(); break; case Value::vtUnsignedInteger: *this << value.asUInt(); break; #endif case Value::vtReal: *this << value.asReal(); break; case Value::vtString: *this << value.asString(); break; case Value::vtProperties: *this << value.asProperties(); break; default: CPPTL_ASSERT_MESSAGE( false, "Unmanaged value type." ); break; } return *this; } Stream & Stream::operator >>( Value &value ) { unsigned char control = readNextByte(); switch ( control ) { case ccBooleanTrue: value = Value( true ); break; case ccBooleanFalse: value = Value( false ); break; case ccString: { String str; readString( str ); value = Value( str ); } break; case ccLookUpDictionnaryEntry: case ccNewDictionnaryEntry: case ccPropertyList: { ungetLastByte(); value = Value( Properties() ); *this >> value.asProperties(); } break; case ccNoneValue: value = Value(); break; case ccPositiveReal: case ccNegativeReal: { double real; ungetLastByte(); *this >> real; value = Value( real ); } break; case ccPositiveInteger: { LargestUnsignedInt integer; ungetLastByte(); *this >> integer; value = Value( integer ); } break; case ccNegativeInteger: { LargestInt integer; ungetLastByte(); *this >> integer; value = Value( integer ); } break; default: CPPTL_ASSERT_MESSAGE( false, "Unmanaged value type." ); break; } return *this; } } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2005-06-24 08:24:02
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9787/include/opentest Added Files: serializer.h Log Message: - serialization layer on top of growing buffer for one way communication. --- NEW FILE: serializer.h --- #ifndef OPENTEST_SERIALIZER_H_INCLUDED # define OPENTEST_SERIALIZER_H_INCLUDED # include <opentest/forwards.h> # include <opentest/properties.h> # include <map> # include <vector> namespace OpenTest { #ifndef CPPTL_NO_INT64 typedef CppTL::int64_t LargestInt; typedef CppTL::uint64_t LargestUnsignedInt; #else typedef int LargestInt; typedef unsigned int LargestUnsignedInt; #endif class Stream { public: Stream(); virtual ~Stream(); // Call this to add buffer to be "read". Reset read cursor on the first buffer. void addBuffer( unsigned int length, const void *data ); void startsWriteNewMessage(); Stream &operator <<( bool value ); Stream &operator <<( int value ); Stream &operator <<( unsigned int value ); #ifndef CPPTL_NO_INT64 Stream &operator <<( CppTL::int64_t value ); Stream &operator <<( CppTL::uint64_t value ); #endif Stream &operator <<( double value ); Stream &operator <<( const String &str ); Stream &operator <<( const Properties &properties ); Stream &operator <<( const Value &value ); Stream &operator >>( bool &value ); Stream &operator >>( int &value ); Stream &operator >>( unsigned int &value ); #ifndef CPPTL_NO_INT64 Stream &operator >>( LargestInt &value ); Stream &operator >>( LargestUnsignedInt &value ); #endif Stream &operator >>( double &value ); Stream &operator >>( String &str ); Stream &operator >>( Properties &properties ); Stream &operator >>( Value &value ); bool inError() const; Stream &setError( const char *errorMessage ); private: void doSerializeInteger( unsigned char kind, LargestUnsignedInt value ); void doUnserializeInteger( LargestUnsignedInt &value ); void saveDictionnaryEntry( const String &str ); void readDictionnaryEntry( unsigned char control, String &str ); void readString( String &str ); unsigned char readNextByte(); void ungetLastByte(); void read( void *buffer, unsigned int length ); void write( const void *buffer, unsigned int length ); void write( unsigned char byte ); static bool isNamedPropertyControl( unsigned char control ); private: struct BufferData { unsigned int length_; unsigned char *data_; }; typedef std::vector<BufferData> Buffers; Buffers buffers_; Buffers::iterator current_; unsigned char *currentData_; unsigned char *endData_; unsigned int writeBufferSize_; typedef std::map<String,unsigned int> IndexesByString; typedef std::deque<String> StringsByIndex; IndexesByString indexesByString_; StringsByIndex stringsByIndex_; char stringBuffer_[4096]; const char *error_; }; template<class SequenceType> Stream &serializeSTLSequence( Stream &stream, const SequenceType &sequence ) { typedef CPPTL_TYPENAME SequenceType::const_iterator it = sequence.begin(); typedef CPPTL_TYPENAME SequenceType::const_iterator itEnd = sequence.end(); unsigned int size = itEnd - it; stream << size; for ( ; it != itEnd; ++it ) stream << *it; return stream; } template<class SequenceType> Stream &unserializeSTLSequence( Stream &stream, const SequenceType &sequence ) { unsigned int size; stream >> size; sequence.resize( size ); typedef CPPTL_TYPENAME SequenceType::const_iterator it = sequence.begin(); typedef CPPTL_TYPENAME SequenceType::const_iterator itEnd = sequence.end(); for ( ; it != itEnd; ++it ) stream >> *it; return stream; } } // namespace OpenTest #endif // OPENTEST_SERIALIZER_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:59:43
|
Update of /cvsroot/cppunit/cppunit/contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10632/contrib Modified Files: readme.txt Log Message: * contrib/xml-xsl/cppunit2junit.txt * contrib/xml-xsl/cppunit2junit.xsl * contrib/readme.txt: XSLT for compatibility with Ant junit xml formatter. Patch #1112053 contributed by Norbert Barbosa. Index: readme.txt =================================================================== RCS file: /cvsroot/cppunit/cppunit/contrib/readme.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** readme.txt 21 Apr 2002 12:32:12 -0000 1.3 --- readme.txt 14 Jun 2005 21:59:34 -0000 1.4 *************** *** 22,24 **** (http://sourceforge.jp/projects/cuppa/) to transform CppUnit XML output into HTML. Windows user can test it by running tests.xml (require Internet Explorer ! 5.0+). \ No newline at end of file --- 22,28 ---- (http://sourceforge.jp/projects/cuppa/) to transform CppUnit XML output into HTML. Windows user can test it by running tests.xml (require Internet Explorer ! 5.0+). ! ! * cppunit2junit.xsl: XSLT for compatibility with Ant junit xml formatter ! (patch #1112053 contributed by BARBOSA Norbert. ! See cppunit2junit.txt for details). \ No newline at end of file |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:57:31
|
Update of /cvsroot/cppunit/cppunit/contrib/xml-xsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9184/contrib/xml-xsl Added Files: cppunit2junit.txt cppunit2junit.xsl Log Message: * contrib/xml-xsl/cppunit2junit.txt * contrib/xml-xsl/cppunit2junit.xsl * contrib/readme.txt: XSLT for compatibility with Ant junit xml formatter. Patch #1112053 contributed by Norbert Barbosa. --- NEW FILE: cppunit2junit.xsl --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <testsuite> <xsl:attribute name="errors"> <xsl:value-of select="TestRun/Statistics/Errors"/> </xsl:attribute> <xsl:attribute name="failures"> <xsl:value-of select="TestRun/Statistics/Failures"/> </xsl:attribute> <xsl:attribute name="tests"> <xsl:value-of select="TestRun/Statistics/Tests"/> </xsl:attribute> <xsl:attribute name="name">from cppunit</xsl:attribute> <xsl:apply-templates/> </testsuite> </xsl:template> <xsl:template match="/TestRun/SuccessfulTests/Test"> <testcase> <xsl:attribute name="classname" ><xsl:value-of select="substring-before(Name, '::')"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="substring-after(Name, '::')"/></xsl:attribute> </testcase> </xsl:template> <xsl:template match="/TestRun/FailedTests/FailedTest"> <testcase> <xsl:attribute name="classname" ><xsl:value-of select="substring-before(Name, '::')"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="substring-after(Name, '::')"/></xsl:attribute> <error> <xsl:attribute name="message"> <xsl:value-of select=" normalize-space(Message)"/> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="FailureType"/> </xsl:attribute> <xsl:value-of select="Message"/> File:<xsl:value-of select="Location/File"/> Line:<xsl:value-of select="Location/Line"/> </error> </testcase> </xsl:template> <!-- skip all text --> <xsl:template match="text()|@*"/> </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2001 eXcelon Corp. <metaInformation> <scenarios ><scenario default="yes" name="test" userelativepaths="yes" url="..\..\..\..\..\Tmp\xml\cppunit.xml" htmlbaseurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="..\..\..\..\..\Tmp\xml\cppunit.xml" srcSchemaRoot="TestRun" srcSchemaPathIsRelative="yes" destSchemaPath="..\..\..\..\..\Tmp\xml\TEST-test.osmoose.license.TestUtils.xml" destSchemaRoot="testsuite" destSchemaPathIsRelative="yes" /> </metaInformation> --> --- NEW FILE: cppunit2junit.txt --- A simple XSLT file to transform cppunit XmlOutputer result file, to the same format that the apache Ant junit task produce: <target name="test"> <junit printsummary="no" forkmode="once" fork="true"> <formatter type="xml"/> ... This format allows to manage result file with the Ant junitreport task. example usage inside a ant task: task similar to the junit task: <target name = "test.cxx"> <!-- assume that the exe take a '-xml filename', and exit with code error 1 if failed --> <exec dir = "${dev.build}/bin" executable = "${dev.build}/bin/test.exe" failonerror = "true" failifexecutionfails = "true" resultproperty = "test.ret" > <arg line = "-xml ${dev.build}/test/data/temp-cxx-results.xml" /> </exec> <condition property = "test.failed"> <equals arg1="${test.ret}" arg2="1"/> </condition> <!-- transform the cppunit xml file to junit xml file --> <xslt in="${dev.build}/test/data/temp-cxx-results.xml" out="${dev.build}/test/data/TEST-cxx-results.xml" style="${dev.lib}/cxx/cppunit/cppunit2junit.xsl"/> <fail if="test.failed"> Unit tests failed. For error messages, check the log files in ${dev.build}/test/data or run "ant test-reports" to generate reports at ${test.dir}/reports.</fail> </target> task that use generated xml result, to produce html report: <target name="test-reports" description="Generate test reports from data collected after a running test"> <mkdir dir="${dev.build}/test/reports"/> <junitreport todir="${dev.build}/test"> <fileset dir="${dev.build}/test/data"> <include name="TEST-*.xml"/> </fileset> <report format="frames" todir="${dev.build}/test/reports"/> </junitreport> </target> BARBOSA Norbert - patch #1112053 http://sourceforge.net/tracker/index.php?func=detail&aid=1112053&group_id=11795&atid=311795 |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:57:31
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9184 Modified Files: ChangeLog NEWS Log Message: * contrib/xml-xsl/cppunit2junit.txt * contrib/xml-xsl/cppunit2junit.xsl * contrib/readme.txt: XSLT for compatibility with Ant junit xml formatter. Patch #1112053 contributed by Norbert Barbosa. Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** NEWS 14 Jun 2005 21:44:00 -0000 1.89 --- NEWS 14 Jun 2005 21:57:22 -0000 1.90 *************** *** 75,78 **** --- 75,84 ---- is not (usually on reference count based implementation). + * Contrib: + + - added XSLT for compatibility with Ant junit xml formatter. + Patch #1112053 contributed by Norbert Barbosa. + See xml-xsl/cppunit2junit.xsl and cppunit2junit.txt for details. + * (Possible) Compatiblity break: Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.228 retrieving revision 1.229 diff -C2 -d -r1.228 -r1.229 *** ChangeLog 14 Jun 2005 21:44:00 -0000 1.228 --- ChangeLog 14 Jun 2005 21:57:22 -0000 1.229 *************** *** 10,13 **** --- 10,18 ---- version number comparison in AM_PATH_CPPUNIT. + * contrib/xml-xsl/cppunit2junit.txt + * contrib/xml-xsl/cppunit2junit.xsl + * contrib/readme.txt: XSLT for compatibility with Ant junit xml formatter. + Patch #1112053 contributed by Norbert Barbosa. + 2005-02-23 Baptiste Lepilleur <gai...@fr...> |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:44:09
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3083 Modified Files: ChangeLog cppunit.m4 NEWS Log Message: * cppunit.m4: applied patch #1076398 contributed by Henner Sudek. Fix version number comparison in AM_PATH_CPPUNIT. Index: cppunit.m4 =================================================================== RCS file: /cvsroot/cppunit/cppunit/cppunit.m4,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cppunit.m4 19 Jun 2004 11:33:42 -0000 1.3 --- cppunit.m4 14 Jun 2005 21:44:00 -0000 1.4 *************** *** 2,6 **** dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl ! AC_DEFUN(AM_PATH_CPPUNIT, [ --- 2,6 ---- dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl ! AC_DEFUN([AM_PATH_CPPUNIT], [ *************** *** 45,52 **** --- 45,63 ---- cppunit_major_min=`echo $cppunit_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + if test "x${cppunit_major_min}" = "x" ; then + cppunit_major_min=0 + fi + cppunit_minor_min=`echo $cppunit_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + if test "x${cppunit_minor_min}" = "x" ; then + cppunit_minor_min=0 + fi + cppunit_micro_min=`echo $cppunit_version_min | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x${cppunit_micro_min}" = "x" ; then + cppunit_micro_min=0 + fi cppunit_version_proper=`expr \ Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** NEWS 14 Jun 2005 21:32:05 -0000 1.88 --- NEWS 14 Jun 2005 21:44:00 -0000 1.89 *************** *** 58,61 **** --- 58,69 ---- patch #1194394 contributed by Stéphane Fillod. + - autotool: applied patch #1076398 contributed by Henner Sudek. Quote: + "This patch allows AM_PATH_CPPUNIT to accept version + numbers without minor and micro version. + Now you can do: + AM_PATH_CPPUNIT(1.9) + instead of + AM_PATH_CPPUNIT(1.9.0)" + * Bug Fix: Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.227 retrieving revision 1.228 diff -C2 -d -r1.227 -r1.228 *** ChangeLog 14 Jun 2005 21:32:04 -0000 1.227 --- ChangeLog 14 Jun 2005 21:44:00 -0000 1.228 *************** *** 7,10 **** --- 7,13 ---- libtool. patch #1194394 contributed by Stéphane Fillod. + * cppunit.m4: applied patch #1076398 contributed by Henner Sudek. Fix + version number comparison in AM_PATH_CPPUNIT. + 2005-02-23 Baptiste Lepilleur <gai...@fr...> |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:32:26
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29213 Modified Files: ChangeLog NEWS Log Message: MinGW, cygwin: enable build of shared library when using libtool. patch #1194394 contributed by Stéphane Fillod. Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** NEWS 14 Jun 2005 21:14:35 -0000 1.87 --- NEWS 14 Jun 2005 21:32:05 -0000 1.88 *************** *** 55,58 **** --- 55,61 ---- Win32DynamicLibraryManager.cpp. + - MinGW, cygwin: enable build of shared library when using libtool. + patch #1194394 contributed by Stéphane Fillod. + * Bug Fix: Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.226 retrieving revision 1.227 diff -C2 -d -r1.226 -r1.227 *** ChangeLog 14 Jun 2005 21:08:44 -0000 1.226 --- ChangeLog 14 Jun 2005 21:32:04 -0000 1.227 *************** *** 3,6 **** --- 3,10 ---- (use system color for border instead of hard-coded color). + * src/cppunit/Makefile.am: + * configure.in: MinGW, cygwin: enable build of shared library when using + libtool. patch #1194394 contributed by Stéphane Fillod. + 2005-02-23 Baptiste Lepilleur <gai...@fr...> |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:29:04
|
Update of /cvsroot/cppunit/cppunit/src/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27544/src/cppunit Modified Files: Makefile.am Log Message: MinGW, cygwin: enable build of shared library when using libtool. patch #1194394 contributed by Stéphane Fillod. Index: Makefile.am =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/cppunit/Makefile.am,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Makefile.am 7 May 2003 20:07:17 -0000 1.43 --- Makefile.am 14 Jun 2005 21:28:46 -0000 1.44 *************** *** 63,67 **** libcppunit_la_LDFLAGS= \ ! -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -release $(LT_RELEASE) --- 63,67 ---- libcppunit_la_LDFLAGS= \ ! -no-undefined -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -release $(LT_RELEASE) |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:29:04
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27544 Modified Files: configure.in Log Message: MinGW, cygwin: enable build of shared library when using libtool. patch #1194394 contributed by Stéphane Fillod. Index: configure.in =================================================================== RCS file: /cvsroot/cppunit/cppunit/configure.in,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** configure.in 19 Jun 2004 11:30:32 -0000 1.78 --- configure.in 14 Jun 2005 21:28:46 -0000 1.79 *************** *** 58,61 **** --- 58,62 ---- AC_LANG(C++) + AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:15:33
|
Update of /cvsroot/cppunit/cppunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19267/doc Modified Files: cookbook.dox Log Message: * fixed post-build step for running test in vc++ Index: cookbook.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit/doc/cookbook.dox,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cookbook.dox 1 Jun 2002 11:38:59 -0000 1.5 --- cookbook.dox 14 Jun 2005 21:15:15 -0000 1.6 *************** *** 512,516 **** With Visual C++, this is done in <em>Project Settings/Post-Build step</em>, ! by adding the following command: <tt>$(TargetPath)</tt>. It is expanded to the application executable path. Look up the project <tt>examples/cppunittest/CppUnitTestMain.dsp</tt> which --- 512,516 ---- With Visual C++, this is done in <em>Project Settings/Post-Build step</em>, ! by adding the following command: <tt>"$(TargetPath)"</tt>. It is expanded to the application executable path. Look up the project <tt>examples/cppunittest/CppUnitTestMain.dsp</tt> which |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:14:53
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18823 Modified Files: NEWS Log Message: * src/msvc6/testrunner/ProgressBar.cpp: applied patch from bug #1165875, (use system color for border instead of hard-coded color). Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** NEWS 14 Jun 2005 21:08:45 -0000 1.86 --- NEWS 14 Jun 2005 21:14:35 -0000 1.87 *************** *** 48,52 **** - Progress bar: now use system color to draw border ! (patch from bug #1165875). * Compilation: --- 48,52 ---- - Progress bar: now use system color to draw border ! (patch from bug #1165875 contributed by Pieter Van Dyck). * Compilation: |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:09:27
|
Update of /cvsroot/cppunit/cppunit/src/msvc6/testrunner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15733/src/msvc6/testrunner Modified Files: ProgressBar.cpp Log Message: * src/msvc6/testrunner/ProgressBar.cpp: applied patch from bug #1165875, (use system color for border instead of hard-coded color). Index: ProgressBar.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/msvc6/testrunner/ProgressBar.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ProgressBar.cpp 13 Jun 2002 23:25:55 -0000 1.3 --- ProgressBar.cpp 14 Jun 2005 21:08:47 -0000 1.4 *************** *** 53,58 **** { CBrush brshBackground; ! CPen penGray( PS_SOLID, 1, RGB (128, 128, 128) ); ! CPen penWhite( PS_SOLID, 1, RGB (255, 255, 255) ); VERIFY( brshBackground.CreateSolidBrush( ::GetSysColor (COLOR_BTNFACE) ) ); --- 53,58 ---- { CBrush brshBackground; ! CPen penShade( PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW) ); ! CPen penLight( PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT) ); VERIFY( brshBackground.CreateSolidBrush( ::GetSysColor (COLOR_BTNFACE) ) ); *************** *** 60,64 **** dc.FillRect( m_bounds, &brshBackground ); ! CPen *pOldPen = dc.SelectObject( &penGray ); int xRight = m_bounds.left + m_bounds.Width() -1; int yBottom = m_bounds.top + m_bounds.Height() -1; --- 60,64 ---- dc.FillRect( m_bounds, &brshBackground ); ! CPen *pOldPen = dc.SelectObject( &penShade ); int xRight = m_bounds.left + m_bounds.Width() -1; int yBottom = m_bounds.top + m_bounds.Height() -1; *************** *** 71,75 **** } ! dc.SelectObject( &penWhite ); { dc.MoveTo( xRight, m_bounds.top ); --- 71,75 ---- } ! dc.SelectObject( &penLight ); { dc.MoveTo( xRight, m_bounds.top ); |
From: Baptiste L. <bl...@us...> - 2005-06-14 21:09:04
|
Update of /cvsroot/cppunit/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15733 Modified Files: ChangeLog NEWS Log Message: * src/msvc6/testrunner/ProgressBar.cpp: applied patch from bug #1165875, (use system color for border instead of hard-coded color). Index: NEWS =================================================================== RCS file: /cvsroot/cppunit/cppunit/NEWS,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** NEWS 19 Nov 2004 20:04:35 -0000 1.85 --- NEWS 14 Jun 2005 21:08:45 -0000 1.86 *************** *** 47,50 **** --- 47,53 ---- This was contributed by Max Quatember and Andreas Pfaffenbichler. + - Progress bar: now use system color to draw border + (patch from bug #1165875). + * Compilation: Index: ChangeLog =================================================================== RCS file: /cvsroot/cppunit/cppunit/ChangeLog,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** ChangeLog 23 Feb 2005 07:35:03 -0000 1.225 --- ChangeLog 14 Jun 2005 21:08:44 -0000 1.226 *************** *** 1,2 **** --- 1,6 ---- + 2005-06-14 Baptiste Lepilleur <gai...@fr...> + * src/msvc6/testrunner/ProgressBar.cpp: applied patch from bug #1165875, + (use system color for border instead of hard-coded color). + 2005-02-23 Baptiste Lepilleur <gai...@fr...> |
From: Baptiste L. <bl...@us...> - 2005-03-10 08:23:56
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12038/include/cpput Modified Files: equality.h Log Message: * added mecanism similar to stringize to allow overload of equality testing. Index: equality.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/equality.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** equality.h 17 Nov 2004 08:59:05 -0000 1.3 --- equality.h 10 Mar 2005 08:23:45 -0000 1.4 *************** *** 25,34 **** template<typename AType, typename BType> bool equalityTest( const AType &a, const BType &b ) { ! return EqualityTraits<AType,BType>::equals( a, b ); } ! # ifdef CPPUT_HAS_TEMPLATE_PARTIAL_SPECIALIZATION template<typename AType, typename BType> --- 25,60 ---- + struct NoSpecificEqualityTest + { + }; + + + inline NoSpecificEqualityTest isEqual( ... ) + { + return NoSpecificEqualityTest(); + }; + + + namespace Impl { + template<typename AType, typename BType> + bool testIsEqual( const AType &, const BType &, bool isEqual ) + { + return isEqual; + } + + template<typename AType, typename BType> + bool testIsEqual( const AType &a, const BType &b, NoSpecificEqualityTest ) + { + return EqualityTraits<AType,BType>::equals( a, b ); + } + + } // namespace Impl + template<typename AType, typename BType> bool equalityTest( const AType &a, const BType &b ) { ! return Impl::testIsEqual( a, b, isEqual( &a, &b ) ); } ! # ifdef CPPUT_HAS_TEMPLATE_PARTIAL_SPECIALIZATION template<typename AType, typename BType> |
From: Baptiste L. <bl...@us...> - 2005-03-07 21:34:59
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24464/src/cpputtest Modified Files: main.cpp Log Message: * added global define to indicate if atomic counter is thread-safe * removed vacpp specific atomic counter implementation (couldn't get it to compile) * added pthread mutex based atomic counter implementation Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** main.cpp 6 Mar 2005 21:12:39 -0000 1.20 --- main.cpp 7 Mar 2005 21:34:45 -0000 1.21 *************** *** 51,60 **** // Atomic counter implementation config += "Atomic counter API: "; ! #if CPPTL_HAS_VACPP_CHECKLOCK ! config += "Visual Age C++ built-in __check_lock()"; ! #elif CPPTL_USE_LINUX_ATOMIC config += "linux atomic operations (limited to 24 bits)"; ! #elif CPPTL_USE_WIN32_ATOMIC config += "win32"; #else config += "none (not thread-safe)"; --- 51,64 ---- // Atomic counter implementation config += "Atomic counter API: "; ! #if CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER ! # if CPPTL_USE_LINUX_ATOMIC config += "linux atomic operations (limited to 24 bits)"; ! # elif CPPTL_USE_WIN32_ATOMIC config += "win32"; + # elif CPPTL_USE_PTHREAD_ATOMIC + config += "pthread mutex"; + # else + config += "???"; + # endif #else config += "none (not thread-safe)"; |
From: Baptiste L. <bl...@us...> - 2005-03-07 21:34:57
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24464/include/cpptl Modified Files: atomiccounter.h config.h Log Message: * added global define to indicate if atomic counter is thread-safe * removed vacpp specific atomic counter implementation (couldn't get it to compile) * added pthread mutex based atomic counter implementation Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** config.h 6 Mar 2005 21:12:39 -0000 1.16 --- config.h 7 Mar 2005 21:34:45 -0000 1.17 *************** *** 135,138 **** --- 135,147 ---- # endif + # if !CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER + # if CPPTL_USE_PTHREAD_THREAD && !CPPTL_USE_WIN32_ATOMIC && !CPPTL_USE_LINUX_ATOMIC + # define CPPTL_USE_PTHREAD_ATOMIC 1 + # endif + # if CPPTL_USE_PTHREAD_ATOMIC || CPPTL_USE_WIN32_ATOMIC || CPPTL_USE_LINUX_ATOMIC + # define CPPTL_HAS_THREAD_SAFE_ATOMIC_COUNTER 1 + # endif + # endif + // auto-link specification Index: atomiccounter.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/atomiccounter.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** atomiccounter.h 6 Mar 2005 21:12:38 -0000 1.7 --- atomiccounter.h 7 Mar 2005 21:34:44 -0000 1.8 *************** *** 5,15 **** # if CPPTL_USE_LINUX_ATOMIC # include <asm/atomic.h> # endif // Notes: linux implementation only guaranty a 24 bits range for the atomic integer. - // For AIX implementation, see bulit-in function __check_lock_mp, __check_lock_up: - // http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/rubifunc.htm - # if CPPTL_USE_WIN32_ATOMIC // Forwards declaration for WIN32 (avoid including windows.h) --- 5,14 ---- # if CPPTL_USE_LINUX_ATOMIC # include <asm/atomic.h> + # elif CPPTL_USE_PTHREAD_ATOMIC + # include <pthread.h> # endif // Notes: linux implementation only guaranty a 24 bits range for the atomic integer. # if CPPTL_USE_WIN32_ATOMIC // Forwards declaration for WIN32 (avoid including windows.h) *************** *** 23,59 **** namespace CppTL { - # if CPPTL_HAS_VACPP_CHECKLOCK - typedef int AtomicCounterIntegerType; - typedef volatile AtomicCounterIntegerType AtomicCounterStorageType; - # elif CPPTL_USE_LINUX_ATOMIC - typedef long AtomicCounterIntegerType; - typedef atomic_t AtomicCounterStorageType; - # else - typedef long AtomicCounterIntegerType; - typedef volatile AtomicCounterIntegerType AtomicCounterStorageType; - # endif - - class CPPTL_API AtomicCounter : public NonCopyable - { - public: - AtomicCounter( AtomicCounterIntegerType count = 0 ); - - void increment(); - - /// Decrements the count - /// @returns true if count is non null. - bool decrement(); - - /// Should returns the current value of the count. - /// \warning this method is only defined for debugging and testing - /// purpose, you should not rely on it in production code path. - AtomicCounterIntegerType count() const; - - private: - AtomicCounterStorageType count_; - }; - - - // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// --- 22,25 ---- *************** *** 63,141 **** # if CPPTL_USE_WIN32_ATOMIC ! inline ! AtomicCounter::AtomicCounter( AtomicCounterIntegerType count ) ! : count_( count ) { ! } ! ! inline void ! AtomicCounter::increment() ! { ! InterlockedIncrement( const_cast< AtomicCounterIntegerType * >( &count_ ) ); ! } ! inline bool ! AtomicCounter::decrement() ! { ! return InterlockedDecrement( const_cast< AtomicCounterIntegerType * >( &count_ ) ) != 0; ! } - inline AtomicCounterIntegerType - AtomicCounter::count() const - { - return count_; - } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // AtomicCounter implementation for Visual Age C++ // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! #elif CPPTL_HAS_VACPP_CHECKLOCK ! ! // __check_lock( void *p, old_value, new_value ) ! // it is a compare and swap built-in. The implementation below spins ! // until the old_value matches the value we just read. ! inline ! AtomicCounter::AtomicCounter( AtomicCounterIntegerType count ) ! : count_( count ) { ! } ! ! inline void ! AtomicCounter::increment() ! { ! AtomicCounterIntegerType value; ! do ! value = count_; ! while ( __check_lock( &count_, value, value+1 ) ); ! } ! inline bool ! AtomicCounter::decrement() ! { ! AtomicCounterIntegerType value; ! do ! value = count_; ! while ( __check_lock( &count_, value, value-1 ) ); ! return value == 1; ! } ! inline AtomicCounterIntegerType ! AtomicCounter::count() const ! { ! AtomicCounterIntegerType value; ! do ! value = count_; ! while ( __check_lock( &count_, value, value ) ); ! return value; ! } // ////////////////////////////////////////////////////////////////// --- 29,118 ---- # if CPPTL_USE_WIN32_ATOMIC ! class CPPTL_API AtomicCounter : public NonCopyable { ! public: ! AtomicCounter( long count = 0 ) ! : count_( count ) ! { ! } ! void increment() ! { ! InterlockedIncrement( const_cast< long * >( &count_ ) ); ! } + /// Decrements the count + /// @returns true if count is non null. + bool decrement() + { + return InterlockedDecrement( const_cast< long * >( &count_ ) ) != 0; + } ! /// Should returns the current value of the count. ! /// \warning this method is only defined for debugging and testing ! /// purpose, you should not rely on it in production code path. ! long count() const ! { ! return count_; ! } + private: + volatile long count_; + }; // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // AtomicCounter implementation using pthread mutex // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! #elif CPPTL_USE_PTHREAD_ATOMIC ! class CPPTL_API AtomicCounter : public NonCopyable { ! public: ! AtomicCounter( long count = 0 ) ! : count_( count ) ! { ! pthread_mutex_init( &lock_, 0 ); ! } ! ~AtomicCounter() ! { ! pthread_mutex_destroy( &lock_ ); ! } + void increment() + { + pthread_mutex_lock( &lock_ ); + ++count_; + pthread_mutex_unlock( &lock_ ); + } ! /// Decrements the count ! /// @returns true if count is non null. ! bool decrement() ! { ! pthread_mutex_lock( &lock_ ); ! bool isNotNull = --count_ != 0; ! pthread_mutex_unlock( &lock_ ); ! return isNotNull; ! } + /// Should returns the current value of the count. + /// \warning this method is only defined for debugging and testing + /// purpose, you should not rely on it in production code path. + long count() const + { + pthread_mutex_lock( &lock_ ); + long value = count_; + pthread_mutex_unlock( &lock_ ); + return value; + } ! private: ! mutable pthread_mutex_t lock_; ! volatile long count_; ! }; // ////////////////////////////////////////////////////////////////// *************** *** 146,176 **** #elif CPPTL_USE_LINUX_ATOMIC ! inline ! AtomicCounter::AtomicCounter( AtomicCounterIntegerType count ) { ! atomic_t value = ATOMIC_INIT(count); ! count_ = value; ! } ! inline void ! AtomicCounter::increment() ! { ! atomic_inc( &count_ ); ! } ! inline bool ! AtomicCounter::decrement() ! { ! return !atomic_dec_and_test( &count_ ); ! } ! inline AtomicCounterIntegerType ! AtomicCounter::count() const ! { ! return atomic_read( &count_ ); ! } --- 123,157 ---- #elif CPPTL_USE_LINUX_ATOMIC ! ! class CPPTL_API AtomicCounter : public NonCopyable { ! public: ! AtomicCounter( long count = 0 ) ! { ! atomic_t value = ATOMIC_INIT(count); ! count_ = value; ! } ! void increment() ! { ! atomic_inc( &count_ ); ! } ! bool decrement() ! { ! return !atomic_dec_and_test( &count_ ); ! } ! long count() const ! { ! return atomic_read( &count_ ); ! } ! ! private: ! atomic_t count_; ! }; *************** *** 182,211 **** #else ! inline ! AtomicCounter::AtomicCounter( AtomicCounterIntegerType count ) ! : count_( count ) ! { ! } ! ! ! inline AtomicCounterIntegerType ! AtomicCounter::increment() { ! return ++count_; ! } ! inline AtomicCounterIntegerType ! AtomicCounter::decrement() ! { ! return --count_; ! } ! inline AtomicCounterIntegerType ! AtomicCounter::count() const ! { ! return count_; ! } # endif // ifdef CPPTL_USE_WIN32_ATOMIC --- 163,192 ---- #else ! class CPPTL_API AtomicCounter : public NonCopyable { ! public: ! AtomicCounter( long count = 0 ); ! : count_( count ) ! { ! } + void increment() + { + return ++count_; + } ! bool decrement() ! { ! return --count_ != 0; ! } + long count() const + { + return count_; + } ! private: ! long count_; ! }; # endif // ifdef CPPTL_USE_WIN32_ATOMIC |
From: Baptiste L. <bl...@us...> - 2005-03-07 08:46:49
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27927/include/cpptl Modified Files: thread.h Log Message: * removed thread creation code. It is not required for core CppUnit. * exposed only processThreadExitHandlers(), other at exit handlers are implementation details. * modified RawThreadStorage::onThreadExit so that it may be called multiple time in the same thread without advert effects. Index: thread.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/thread.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** thread.h 6 Mar 2005 20:12:31 -0000 1.2 --- thread.h 7 Mar 2005 08:46:38 -0000 1.3 *************** *** 10,18 **** namespace CppTL { - void CPPTL_API addThreadExitHandler( const Functor0 &handler, - const void *tag = 0 ); - - void CPPTL_API removeThreadExitHandler( const void *tag ); - void CPPTL_API processThreadExitHandlers(); --- 10,13 ---- *************** *** 158,199 **** }; - - class CPPTL_API Thread - { - public: - typedef unsigned long ThreadIdType; - - // Thread( Functor0 threadFunction ); - - // void join(); - - static ThreadIdType currentId(); - - // static void sleep( unsigned long durationInMillisecond ); - - private: - void *data_; - }; - # endif // # ifndef CPPTL_THREAD_SAFE - - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // Implementation of thread API common to all thread-safety mode - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - - /* - - class Thread; - typedef CppTL::SharedPtr<Thread> ThreadPtr; - - inline ThreadPtr createThread( Functor0 threadFunction ) - { - return ThreadPtr( new Thread( threadFunction ) ); - } - */ - } // namespace CppTL --- 153,158 ---- |
From: Baptiste L. <bl...@us...> - 2005-03-07 08:46:48
|
Update of /cvsroot/cppunit/cppunit2/src/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27927/src/cpptl Modified Files: thread.cpp Log Message: * removed thread creation code. It is not required for core CppUnit. * exposed only processThreadExitHandlers(), other at exit handlers are implementation details. * modified RawThreadStorage::onThreadExit so that it may be called multiple time in the same thread without advert effects. Index: thread.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpptl/thread.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** thread.cpp 6 Mar 2005 21:22:46 -0000 1.3 --- thread.cpp 7 Mar 2005 08:46:37 -0000 1.4 *************** *** 56,59 **** --- 56,199 ---- #else + + + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // Common Thread API implementation + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + + // class ThreadExitHandler + // ////////////////////////////////////////////////////////////////////// + + namespace Impl { + + class ThreadExitHandler : public NonCopyable + { + public: + static ThreadExitHandler &instance() + { + // This static is instantiated at static construction time + // so it's thread-safe + static ThreadExitHandler handler; + return handler; + } + + ThreadExitHandler() + : magic1_( 0x1a9cd67f ) // magic number are used to protect against + , magic2_( 0x3e4a3c9d ) // possible race condition on shutdown. + { + } + + ~ThreadExitHandler() + { + Mutex::ScopedLockGuard guard( lock_ ); + while ( !handlers_.empty() ) + { + handlers_.begin()->first(); + handlers_.erase( handlers_.begin() ); + } + magic1_ = 0xdeadbeef; + magic2_ = 0xdeadbeef; + } + + void add( const Functor0 &handler, + const void *tag ) + { + if ( !isValid() ) + return; + Mutex::ScopedLockGuard guard( lock_ ); + Handlers::iterator it = find( tag ); + if ( it == handlers_.end() ) + handlers_.push_back( HandlerInfo( handler, tag ) ); + else + *it = HandlerInfo( handler, tag ); + } + + void remove( const void *tag ) + { + if ( !isValid() ) + return; + Mutex::ScopedLockGuard guard( lock_ ); + Handlers::iterator it = find( tag ); + if ( it != handlers_.end() ) + { + it->first(); + handlers_.erase( it ); + } + } + + void process() + { + if ( !isValid() ) + return; + Mutex::ScopedLockGuard guard( lock_ ); + Handlers::iterator it = handlers_.begin(); + for ( ; it != handlers_.end(); ++it ) + it->first(); + } + + private: + typedef std::pair<Functor0,const void *> HandlerInfo; + typedef std::vector<HandlerInfo> Handlers; + + Handlers::iterator find( const void *tag ) + { + Handlers::iterator it = handlers_.begin(); + for ( ; it != handlers_.end(); ++it ) + if ( it->second == tag ) + return it; + return handlers_.end(); + } + + bool isValid() const + { + return magic1_ == 0x1a9cd67f && magic2_ == 0x3e4a3c9d; + } + + Handlers handlers_; + Mutex lock_; + unsigned int magic1_; + unsigned int magic2_; + }; + + } // namespace Impl + + + class ThreadExitHandlerInitializer + { + public: + ThreadExitHandlerInitializer() + { + Impl::ThreadExitHandler::instance(); + } + }; + + // This force a call to ThreadExitHandler::instance(), + // and ensure it is properly initialized. + static ThreadExitHandlerInitializer threadExitInitializer; + + void addThreadExitHandler( const Functor0 &handler, + const void *tag ) + { + Impl::ThreadExitHandler::instance().add( handler, tag ); + } + + void removeThreadExitHandler( const void *tag ) + { + Impl::ThreadExitHandler::instance().remove( tag ); + } + + /// This fonction must be called at the end of each thread + /// to ensure ThreadLocalStorage are properly cleaned-up. + void processThreadExitHandlers() + { + Impl::ThreadExitHandler::instance().process(); + } + + + # if CPPTL_USE_WIN32_THREAD *************** *** 128,131 **** --- 268,272 ---- { deallocator_( getRawThreadStorage( this ) ); + setRawThreadStorage( this, 0 ); } *************** *** 161,196 **** } // namespace Impl - // class Thread (win32) - // ////////////////////////////////////////////////////////////////////// - - /* - Thread::Thread( Functor0 threadFunction ) - { - // threadFunction(); - } - - - void - Thread::join() - { - } - */ - - Thread::ThreadIdType - Thread::currentId() - { - return ThreadIdType( ::GetCurrentThreadId() ); - } - - /* - void - Thread::sleep( unsigned long durationInMillisecond ) - { - ::Sleep( durationInMillisecond ); - } - */ - - - # elif defined(CPPTL_USE_PTHREAD_THREAD) --- 302,305 ---- *************** *** 274,277 **** --- 383,387 ---- { deallocator_( getRawThreadStorage( this ) ); + setRawThreadStorage( this, 0 ); } *************** *** 309,448 **** # endif // # elif defined(CPPTL_USE_PTHREAD_THREAD) - - - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // Common Thread API implementation - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - // ////////////////////////////////////////////////////////////////// - - // class ThreadExitHandler (win32) - // ////////////////////////////////////////////////////////////////////// - - namespace Impl { - - class ThreadExitHandler : public NonCopyable - { - public: - static ThreadExitHandler &instance() - { - // This static is instantiated at static construction time - // so it's thread-safe - static ThreadExitHandler handler; - return handler; - } - - ThreadExitHandler() - : magic1_( 0x1a9cd67f ) // magic number are used to protect against - , magic2_( 0x3e4a3c9d ) // possible race condition on shutdown. - { - } - - ~ThreadExitHandler() - { - Mutex::ScopedLockGuard guard( lock_ ); - while ( !handlers_.empty() ) - { - handlers_.begin()->first(); - handlers_.erase( handlers_.begin() ); - } - magic1_ = 0xdeadbeef; - magic2_ = 0xdeadbeef; - } - - void add( const Functor0 &handler, - const void *tag ) - { - if ( !isValid() ) - return; - Mutex::ScopedLockGuard guard( lock_ ); - Handlers::iterator it = find( tag ); - if ( it == handlers_.end() ) - handlers_.push_back( HandlerInfo( handler, tag ) ); - else - *it = HandlerInfo( handler, tag ); - } - - void remove( const void *tag ) - { - if ( !isValid() ) - return; - Mutex::ScopedLockGuard guard( lock_ ); - Handlers::iterator it = find( tag ); - if ( it != handlers_.end() ) - { - it->first(); - handlers_.erase( it ); - } - } - - void process() - { - if ( !isValid() ) - return; - Mutex::ScopedLockGuard guard( lock_ ); - Handlers::iterator it = handlers_.begin(); - for ( ; it != handlers_.end(); ++it ) - it->first(); - } - - private: - typedef std::pair<Functor0,const void *> HandlerInfo; - typedef std::vector<HandlerInfo> Handlers; - - Handlers::iterator find( const void *tag ) - { - Handlers::iterator it = handlers_.begin(); - for ( ; it != handlers_.end(); ++it ) - if ( it->second == tag ) - return it; - return handlers_.end(); - } - - bool isValid() const - { - return magic1_ == 0x1a9cd67f && magic2_ == 0x3e4a3c9d; - } - - Handlers handlers_; - Mutex lock_; - unsigned int magic1_; - unsigned int magic2_; - }; - - } // namespace Impl - - - class ThreadExitHandlerInitializer - { - public: - ThreadExitHandlerInitializer() - { - Impl::ThreadExitHandler::instance(); - } - }; - - // This force a call to ThreadExitHandler::instance(), - // and ensure it is properly initialized. - static ThreadExitHandlerInitializer threadExitInitializer; - - void addThreadExitHandler( const Functor0 &handler, - const void *tag ) - { - Impl::ThreadExitHandler::instance().add( handler, tag ); - } - - void removeThreadExitHandler( const void *tag ) - { - Impl::ThreadExitHandler::instance().remove( tag ); - } - - void processThreadExitHandlers() - { - Impl::ThreadExitHandler::instance().process(); - } - #endif // #ifdef CPPTL_HAS_THREAD --- 419,422 ---- |
From: Baptiste L. <bl...@us...> - 2005-03-06 21:44:29
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29224 Modified Files: sconstruct Log Message: fixed env_testing construction Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** sconstruct 6 Mar 2005 21:27:12 -0000 1.11 --- sconstruct 6 Mar 2005 21:44:18 -0000 1.12 *************** *** 77,81 **** LIBPATH = lib_dir ) ! env_testing = env.Copy( LIBS = ['cpput','opentest','cpptl'] ) def buildCppUnitExample( env, target_sources, target_name ): --- 77,82 ---- LIBPATH = lib_dir ) ! env_testing = env.Copy( ) ! env_testing.Append( LIBS = ['cpput','opentest','cpptl'] ) def buildCppUnitExample( env, target_sources, target_name ): |