cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 17)
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-09-06 07:46:04
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18992/src/cpput Removed Files: cpput.dsp cpput.vcproj Log Message: * moved project files to cppunit2/makefiles/vs71 --- cpput.dsp DELETED --- --- cpput.vcproj DELETED --- |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:46:03
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18992/src Removed Files: cpput_lib.dsw cpput_lib.sln cpput_lib.suo Log Message: * moved project files to cppunit2/makefiles/vs71 --- cpput_lib.sln DELETED --- --- cpput_lib.suo DELETED --- --- cpput_lib.dsw DELETED --- |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:56
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18498/include/opentest Added Files: serializedtesttransport.h Log Message: * tests for remote Interfaces implementation in opentest --- NEW FILE: serializedtesttransport.h --- #ifndef OPENTEST_SERIALIZEDTESTTRANSPORT_H_INCLUDED # define OPENTEST_SERIALIZEDTESTTRANSPORT_H_INCLUDED # include <opentest/forwards.h> # include <opentest/remoteinterfaces.h> # include <deque> namespace OpenTest { class SerializedTestTransport : public MessageTransport { public: // overriden from MessageTransport void sendMessage( const RemoteMessagePtr &message ); void dispatchReceivedMessages( RemoteMessageServer &server ); private: typedef std::deque<RemoteMessagePtr> Messages; Messages messages_; }; inline void SerializedTestTransport::sendMessage( const RemoteMessagePtr &message ) { messages_.push_back( message ); } inline void SerializedTestTransport::dispatchReceivedMessages( RemoteMessageServer &server ) { Messages toDispatch; toDispatch.swap( messages_ ); while ( !toDispatch.empty() ) { server.dispatchMessage( toDispatch.front() ); toDispatch.pop_front(); } } } // namespace OpenTest #endif // OPENTEST_SERIALIZEDTESTTRANSPORT_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:55
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18498/src/opentesttest Added Files: mockhelper.h remoteinterfacestest.cpp Log Message: * tests for remote Interfaces implementation in opentest --- NEW FILE: mockhelper.h --- #ifndef OPENTTEST_MOCKHELPER_H_INCLUDED # define OPENTTEST_MOCKHELPER_H_INCLUDED # include <opentest/properties.h> # include <cpput/assertenum.h> /** A simple helper to implement (simple) mock object. * * \code * helper_.logEvent( "call a()" ); // log what is expected to happened * helper_.logEvent( "call b()" ); * helper_.recordActualEvents(); // log what is actually happenning * helper_.logEvent( "call a()" ); * helper_.logEvent( "call c()" ); * MOCKHELPER_ASSERT_VERIFY( helper_ ); // check that the expected events match the actual events * \endcode */ class MockHelper { public: /// At construction, expected events are recorded. MockHelper(); void clearEvents(); bool isRecordingExpectedEvents() const; void recordExpectedEvents(); void recordActualEvents(); void verify( const CppUT::Message &message = CppUT::Message( "Actual events do not match expected events." ) ); void logEvent( const OpenTest::Value &value ); const OpenTest::Value &expectedEvents() const; const OpenTest::Value &actualEvents() const; private: OpenTest::Value expectations_; OpenTest::Value actuals_; bool recordExpectations_; }; #define MOCKHELPER_ASSERT_VERIFY( instance ) \ CPPUT_BEGIN_ASSERTION_MACRO() \ (instance).verify() #define MOCKHELPER_CHECK_VERIFY( instance ) \ CPPUT_BEGIN_CHECKING_MACRO() \ (instance).verify() #define MOCKHELPER_ASSERT_VERIFY_MSG( instance, msg ) \ CPPUT_BEGIN_ASSERTION_MACRO() \ (instance).verify( msg ) #define MOCKHELPER_CHECK_VERIFY_MSG( instance, msg ) \ CPPUT_BEGIN_CHECKING_MACRO() \ (instance).verify( msg ) inline MockHelper::MockHelper() : recordExpectations_( true ) , expectations_( OpenTest::Properties() ) , actuals_( OpenTest::Properties() ) { } inline void MockHelper::clearEvents() { expectations_ = OpenTest::Value(); actuals_ = OpenTest::Value(); } inline bool MockHelper::isRecordingExpectedEvents() const { return recordExpectations_; } inline void MockHelper::recordExpectedEvents() { recordExpectations_ = true; } inline void MockHelper::recordActualEvents() { recordExpectations_ = false; } inline void MockHelper::verify( const CppUT::Message &message ) { CppUT::checkSequenceEqual( expectations_.asProperties().listValues(), actuals_.asProperties().listValues(), message ); clearEvents(); recordExpectedEvents(); } inline void MockHelper::logEvent( const OpenTest::Value &value ) { if ( recordExpectations_ ) expectations_.append( value ); else actuals_.append( value ); } inline const OpenTest::Value & MockHelper::expectedEvents() const { return expectations_; } inline const OpenTest::Value & MockHelper::actualEvents() const { return actuals_; } # endif // OPENTTEST_MOCKHELPER_H_INCLUDED --- NEW FILE: remoteinterfacestest.cpp --- #include <opentest/serializedtesttransport.h> #include <cpput/testfixture.h> #include <cpput/registry.h> #include <cpptl/scopedptr.h> #include "mockhelper.h" namespace CppUT { // converter for assert equal inline std::string toString( const OpenTest::Properties &value ) { return value.toString().c_str(); } inline std::string toString( const OpenTest::Value &value ) { return value.toString().c_str(); } } // namespace CppUT { class MockTestRunner : public OpenTest::TestRunnerInterface , public OpenTest::TestRunnerServer , public MockHelper { public: MockTestRunner() : OpenTest::TestRunnerServer( static_cast<OpenTest::TestRunnerInterface &>(*this) ) { } public: // overridden from OpenTest::TestRunnerInterface virtual void getTestDescriptions() { logEvent( "getTestDescriptions" ); } virtual void getTestPlans() { logEvent( "getTestPlans" ); } virtual void runTests( const OpenTest::TestPlans &plan ) { logEvent( OpenTest::String("runTests( " + CppTL::toString( plan.testPlans_.size() ) + ")") ); } virtual void stopTests() { logEvent( "stopTests" ); } }; class RemoteInterfacesTest : public CppUT::TestFixture { CPPUT_TESTSUITE_BEGIN( RemoteInterfacesTest ); CPPUT_TEST( testSimpleMessage ); CPPUT_TEST( testTestRunnerProxy ); CPPUT_TESTSUITE_END(); public: void setUp(); void tearDown(); void testSimpleMessage(); void testTestRunnerProxy(); private: CppTL::ScopedPtr<OpenTest::SerializedTestTransport> transport_; CppTL::ScopedPtr<OpenTest::TestRunnerProxy> testRunnerProxy_; CppTL::ScopedPtr<MockTestRunner> testRunner_; }; CPPUT_REGISTER_SUITE_TO_DEFAULT( RemoteInterfacesTest ); void RemoteInterfacesTest::setUp() { transport_.reset( new OpenTest::SerializedTestTransport() ); testRunnerProxy_.reset( new OpenTest::TestRunnerProxy() ); testRunnerProxy_->setTransport( *transport_ ); testRunner_.reset( new MockTestRunner() ); } void RemoteInterfacesTest::tearDown() { testRunnerProxy_.reset(); transport_.reset(); testRunner_.reset(); } void RemoteInterfacesTest::testSimpleMessage() { testRunner_->getTestDescriptions(); testRunner_->recordActualEvents(); testRunnerProxy_->getTestDescriptions(); transport_->dispatchReceivedMessages( *testRunner_ ); MOCKHELPER_ASSERT_VERIFY( *testRunner_ ); } void RemoteInterfacesTest::testTestRunnerProxy() { testRunner_->getTestDescriptions(); testRunner_->getTestPlans(); OpenTest::TestPlans plans1; testRunner_->runTests( plans1 ); OpenTest::TestPlans plans2; OpenTest::TestPlan plan1; plan1.id_ = OpenTest::TestId( 5678 ); plan1.testCase_ = OpenTest::TestId( 1234 ); plan1.name_ = "dummy test"; plans2.testPlans_.push_back( plan1 ); testRunner_->runTests( plans2 ); testRunner_->stopTests(); testRunner_->recordActualEvents(); testRunnerProxy_->getTestDescriptions(); testRunnerProxy_->getTestPlans(); testRunnerProxy_->runTests( plans1 ); testRunnerProxy_->runTests( plans2 ); testRunnerProxy_->stopTests(); transport_->dispatchReceivedMessages( *testRunner_ ); MOCKHELPER_ASSERT_VERIFY( *testRunner_ ); } |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:55
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18498/include/cpptl Added Files: autolink.h Log Message: * tests for remote Interfaces implementation in opentest --- NEW FILE: autolink.h --- // No gards, this header can be included multiple time // Generic header to automatically link against a specified library // The library name prefix must be defined in CPPTL_AUTOLINK_NAME. // CPPTL_AUTOLINK_NAME will be undefined after including this header. // The full library name is build according to the following rules: // (0) CPPTL_AUTOLINK_NAME: library name prefix (json,...) // (a) TOOLSET: vc6, vc70, vc71, vc80, bcb4, bcb5, bcb6 // (b) LINKAGE: lib(static), dll(dynamic) // The macro CPPTL_AUTOLINK_DLL must be defined to indicate that we are linking // against a DLL. // (c) This suffix depends on threading mode and CRT linkage // This suffix follow Microsoft Visual Studio c++ compiler command-line option // used to select the CRT library (/mt, /mtd...) // Threading / Run-time library / suffix // single / static / ml // mutli-thread / static / mt // multi-thread / dynamic library / md // (e) DEBUG MODE: nothing (release), d(debug) // FULLNAME: 0_(a)_bcd.lib // Example: // Compiling library "cpptl" with vc 7.1 as a static library with debug dll CRT (/MDD) // "cpptl_vc71_libmdd" #if !defined(CPPTL_AUTOLINK_NAME) # error Macro CPPTL_AUTOLINK_NAME should be defined. You should not include this header directly. #endif #undef CPPTL_AUTOLINK_TOOLSET_ #undef CPPTL_AUTOLINK_CRT_ #undef CPPTL_AUTOLINK_LINKAGE_ #undef CPPTL_AUTOLINK_DEBUG_MODE_ // Select compiler // Visual Studio #if defined(_MSC_VER) # if defined(_WIN32_WCE) # define CPPTL_AUTOLINK_TOOLSET_ "evc4" # elif (_MSC_VER < 1300) //VC6 # define CPPTL_AUTOLINK_TOOLSET_ "vc6" # elif (_MSC_VER < 1310) //VC7.0 (.NET 2002) # define CPPTL_AUTOLINK_TOOLSET_ "vc70" # elif (_MSC_VER < 1400) //VC7.1 (.NET 2003) # define CPPTL_AUTOLINK_TOOLSET_ "vc71" # else # define CPPTL_AUTOLINK_TOOLSET_ "vc80" # endif // Borland C++ #elif defined(__BORLANDC__) # if (__BORLANDC__ >= 0x560) // CBuilder 6 # define CPPTL_AUTOLINK_TOOLSET_ "bcb6" # elif (__BORLANDC__ >= 0x550) # define CPPTL_AUTOLINK_TOOLSET_ "bcb5" # elif (__BORLANDC__ >= 0x540) # define CPPTL_AUTOLINK_TOOLSET_ "bcb4" # endif #endif // Select CRT library: threading & linkage #if defined(_MT) || defined(__MT__) # if defined(_DLL) # define CPPTL_AUTOLINK_CRT_ "md" # else # define CPPTL_AUTOLINK_CRT_ "mt" # endif #else # define CPPTL_AUTOLINK_CRT_ "ml" #endif // Select debug mode #if defined(_DEBUG) # define CPPTL_AUTOLINK_DEBUG_MODE_ "d" #else # define CPPTL_AUTOLINK_DEBUG_MODE_ "" #endif // Select linkage #if defined(CPPTL_AUTOLINK_DLL) # define CPPTL_AUTOLINK_LINKAGE_ "dll" #else # define CPPTL_AUTOLINK_LINKAGE_ "lib" #endif // Automatic link #if defined(CPPTL_AUTOLINK_TOOLSET_) && \ defined(CPPTL_AUTOLINK_CRT_) && \ defined(CPPTL_AUTOLINK_LINKAGE_) && \ defined(CPPTL_AUTOLINK_DEBUG_MODE_) # define CPPTL_AUTOLINK_FULL_NAME \ CPPTL_AUTOLINK_NAME "_" CPPTL_AUTOLINK_TOOLSET_ "_" CPPTL_AUTOLINK_LINKAGE_ \ CPPTL_AUTOLINK_CRT_ CPPTL_AUTOLINK_DEBUG_MODE_ ".lib" # pragma comment(lib,CPPTL_AUTOLINK_FULL_NAME) # if defined(CPPTL_AUTOLINK_VERBOSE) && defined(_MSC_VER) # pragma message( "Linking with" CPPTL_AUTOLINK_FULL_NAME ) # endif #endif #undef CPPTL_AUTOLINK_TOOLSET_ #undef CPPTL_AUTOLINK_CRT_ #undef CPPTL_AUTOLINK_LINKAGE_ #undef CPPTL_AUTOLINK_DEBUG_MODE_ #undef CPPTL_AUTOLINK_FULL_NAME |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:02
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18344/src/cpputtest Added Files: formattest.cpp formattest.h Log Message: * experimental implementation of a type safe sprintf. --- NEW FILE: formattest.cpp --- #include "formattest.h" #include <cpput/assert.h> #include <cpptl/format.h> void FormatTest::setUp() { double x = 1, y = 1, z = 0; for ( int i = 1; i < 200; ++i ) { z += x + y; y *= 10; z /= 10; } } void FormatTest::tearDown() { } void FormatTest::testLengthNoFormat() { CPPUT_ASSERT_EQUAL( 9, CppTL::Formatter( "123456789", CppTL::FormatArgs() ).length() ); } void FormatTest::testLengthIntFormat() { CPPUT_ASSERT_EQUAL( 4+9, CppTL::Formatter( "ab%dcd", CppTL::args(123456789) ).length() ); } --- NEW FILE: formattest.h --- #ifndef CPPUT_FORMATTEST_H_INCLUDED # define CPPUT_FORMATTEST_H_INCLUDED # include <cpput/testfixture.h> class FormatTest : public CppUT::TestFixture { CPPUT_TESTSUITE_BEGIN( FormatTest ); CPPUT_TEST( testLengthNoFormat ); CPPUT_TEST( testLengthIntFormat ); CPPUT_TESTSUITE_END(); public: void setUp(); void tearDown(); void testLengthNoFormat(); void testLengthIntFormat(); private: }; #endif // CPPUT_FORMATTEST_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18344/include/cpptl Added Files: format.h Log Message: * experimental implementation of a type safe sprintf. --- NEW FILE: format.h --- #ifndef CPPTL_FORMAT_INCLUDED # define CPPTL_FORMAT_INCLUDED # include <cpptl/forwards.h> # include <cpptl/stringtools.h> # include <string> # include <assert.h> namespace CppTL { class FormatArg; class FormatArgSpec; class Formatter; class FormatParseContext; typedef unsigned int FormatStringIndex; class FormatArg { public: FormatArg( char v ); FormatArg( LargestInt v ); FormatArg( LargestUnsignedInt v ); FormatArg( int v ); FormatArg( unsigned int v ); FormatArg( double v ); FormatArg( void *p ); FormatArg( const char *s ); FormatArg( const ConstString &s ); FormatArg( const std::string &s ); FormatArg( const Formatter &s ); FormatArg( const StringConcatenator &s ); bool isNegative() const; enum ArgType { argChar, argInt, argUInt, argDouble, argPointer, argString, argFormatter, argConcatenator }; struct StringInfo { const char *begin_; const char *end_; }; union { char c_; LargestInt int_; LargestUnsignedInt uint_; double double_; void *pointer_; StringInfo string_; const Formatter *formatter_; const StringConcatenator *concatenator_; }; ArgType type_; }; class FormatArgs { public: enum { maxFormatArgs = 10 }; FormatArgs(); FormatArgs( const FormatArg &arg1 ); FormatArgs( const FormatArg &arg1, const FormatArg &arg2 ); FormatArgs( const FormatArg &arg1, const FormatArg &arg2, const FormatArg &arg3 ); const FormatArg *args_[ maxFormatArgs ]; int argCount_; }; class FormatArgSpec { public: enum OutputType { decimal = 1, hexaDecimal, octal, real, string, character, trailingText, automatic }; enum Flags { flagRequireSign = 1, // '+' flagLeftAlign = flagRequireSign << 1, // '-' flagShowBasePoint = flagLeftAlign << 1, // '#' flagPadWithZero = flagShowBasePoint << 1, // '0' flagPadWithSpace = flagPadWithZero << 1, // ' ' flagUseUpperCase = flagPadWithSpace << 1, // 'X' }; }; class Formatter { public: Formatter( const char *format, const FormatArgs &args ); FormatStringIndex length() const; const char *format_; const FormatArgs *args_; }; class FormatParseContext { public: void setTrailingTextOnly( const char *begin, const char *end ); const char *checkpointBegin_; const char *checkpointEnd_; const char *formatSpecBegin_; const char *formatSpecEnd_; const char *formatTypeLetter_; unsigned int flags_; int width_; int precision_; FormatArgSpec::OutputType type_; const FormatArg *arg_; bool hasFlag( unsigned int flag ) const { return (flags_ & flag) != 0; } }; class FormatLengthComputer { public: FormatLengthComputer() : length_( 0 ) { } ~FormatLengthComputer() { } void operator()( const FormatParseContext &context ); void handleNumber( const FormatParseContext &context, bool isNegative, FormatStringIndex numberDigits, FormatStringIndex prefixLength ); FormatStringIndex length_; char buffer[1024]; // for float conversion }; template<class ArgProcessor> inline void formatParse( const Formatter &formatter, ArgProcessor &processor ) { FormatParseContext context; const char *current = formatter.format_; context.checkpointBegin_ = current; const char *end = formatter.format_ + strlen( formatter.format_ ); int currentArg = 1; while ( current < end ) { if ( *current++ == '%' ) // start of format spec { if ( *current == '%' ) // escape for '%' { context.checkpointEnd_ = current; context.type_ = FormatArgSpec::trailingText; processor( context ); ++current; context.checkpointBegin_ = current; } else { context.checkpointEnd_ = current - 1; // omit '%' context.flags_ = formatParseFlags( current, end ); int argIndex = 0; context.width_ = formatParseNumber( current, end ); context.precision_ = -1; context.type_ = FormatArgSpec::automatic; bool isPositionalShortCut = false; context.formatSpecBegin_ = current; context.formatSpecEnd_ = 0; context.formatTypeLetter_ = 0; if ( current < end && context.flags_ == 0 && context.width_ != -1 ) { if ( *current == '%' ) // %N%, positional argument short-cut for %N$s { ++current; argIndex = context.width_; context.width_ = -1; isPositionalShortCut = true; context.formatSpecBegin_ = current; context.formatSpecEnd_ = current; } else if ( *current == '$' ) // standard positional argument: %N$width.precTYPE { ++current; argIndex = context.width_; context.flags_ = formatParseFlags( current, end ); context.width_ = formatParseNumber( current, end ); context.formatSpecBegin_ = current; } } if ( !isPositionalShortCut ) { if ( current < end && *current == '.' ) { ++current; context.precision_ = formatParseNumber( current, end ); } context.formatSpecEnd_ = current; // May insert map look-up there '(key)' context.formatTypeLetter_ = current; formatParseType( current, end, context ); } if ( argIndex == 0 ) argIndex = currentArg++; if ( argIndex > 0 && argIndex <= formatter.args_->argCount_ ) { context.arg_ = formatter.args_->args_[argIndex-1]; formatSetAutoArgType( context ); processor( context ); } context.checkpointBegin_ = current; } } }; if ( context.checkpointBegin_ != end ) { context.checkpointEnd_ = current; context.type_ = FormatArgSpec::trailingText; processor( context ); } } inline void formatSetAutoArgType( FormatParseContext &context ) { switch ( context.arg_->type_ ) { case FormatArg::argChar: if ( context.type_ != FormatArgSpec::string && context.type_ != FormatArgSpec::character ) { context.type_ = FormatArgSpec::character; } break; case FormatArg::argInt: case FormatArg::argUInt: case FormatArg::argPointer: if ( context.type_ != FormatArgSpec::decimal && context.type_ != FormatArgSpec::hexaDecimal && context.type_ != FormatArgSpec::octal ) { context.type_ = FormatArgSpec::decimal; } break; case FormatArg::argDouble: context.type_ = FormatArgSpec::real; break; case FormatArg::argString: case FormatArg::argFormatter: case FormatArg::argConcatenator: if ( context.type_ != FormatArgSpec::string && context.type_ != FormatArgSpec::character ) { context.type_ = FormatArgSpec::string; } break; default: CPPTL_DEBUG_ASSERT_UNREACHABLE; break; } } inline void formatParseType( const char *¤t, const char *end, FormatParseContext &context ) { switch ( *current ) { case 'p': context.type_ = FormatArgSpec::hexaDecimal; context.flags_ |= FormatArgSpec::flagShowBasePoint; break; case 'X': context.flags_ |= FormatArgSpec::flagUseUpperCase; // fall through 'x' case 'x': context.type_ = FormatArgSpec::hexaDecimal; break; case 'd': case 'u': case 'i': context.type_ = FormatArgSpec::decimal; break; case 'o': context.type_ = FormatArgSpec::octal; break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': context.type_ = FormatArgSpec::real; break; case 's': context.type_ = FormatArgSpec::string; break; case 'c': context.type_ = FormatArgSpec::character; break; default: break; } if ( context.type_ != FormatArgSpec::automatic ) ++current; } inline unsigned int formatParseFlags( const char * ¤t, const char *end ) { unsigned int flags = 0; while ( current < end ) { switch ( *current ) { case '+': flags |= FormatArgSpec::flagRequireSign; break; case '-': flags |= FormatArgSpec::flagLeftAlign; break; case '#': flags |= FormatArgSpec::flagShowBasePoint; break; case '0': flags |= FormatArgSpec::flagPadWithZero; break; case ' ': flags |= FormatArgSpec::flagPadWithSpace; break; default: return flags; } ++current; } return flags; } inline int formatParseNumber( const char * ¤t, const char *end ) { const char *begin = current; int width = 0; while ( current < end && isDigit( *current ) ) { width = width * 10 + int(*current - '0'); ++current; } if ( begin == current ) width = -1; return width; } template<const int radix> class FormatIntegerTools { public: static int length( LargestUnsignedInt v ) { int length = 0; for ( ; v != 0; v /= radix ) ++length; return length ? length : 1; } }; // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class FormatLengthComputer // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// inline void FormatLengthComputer::operator()( const FormatParseContext &context ) { length_ += context.checkpointEnd_ - context.checkpointBegin_; if ( context.type_ == FormatArgSpec::trailingText ) return; assert( context.arg_ != 0 ); const FormatArg &arg = *context.arg_; switch ( context.type_ ) { case FormatArgSpec::character: length_ += CPPTL_MAX( 1, context.width_ ); break; case FormatArgSpec::string: { int stringLength = arg.string_.begin_ - arg.string_.end_; if ( context.width_ > 0 ) length_ += CPPTL_MIN( context.width_, stringLength ); else length_ += stringLength; } break; case FormatArgSpec::real: { const int symbolsLength = 16; // for exponential, signs... const int maxWidth = CPPTL_ARRAY_SIZE(buffer) - symbolsLength; int actualWidth = CPPTL_MAX( context.width_, 0 ); actualWidth += CPPTL_MAX( context.precision_, 0 ); if ( actualWidth <= maxWidth ) { char format[32]; FormatStringIndex formatLength = context.formatSpecEnd_ - context.formatSpecBegin_; CPPTL_ASSERT_MESSAGE( formatLength < CPPTL_ARRAY_SIZE( format ) - 1, "Format string too long" ); memcpy( format, context.formatSpecBegin_, formatLength ); format[formatLength] = *context.formatTypeLetter_; format[formatLength+1] = 0; int actualLength = 0; #ifdef CPPTL_HAS__SNPRINTF actualLength = _snprintf( buffer, CPPTL_ARRAY_SIZE(buffer)-1, format, arg.double_ ); #else actualLength = sprintf( buffer, format, arg.double_ ); #endif actualLength /= sizeof(buffer[0]); // sprintf/snprintf returns number of bytes length_ += actualLength; } else // We have a problem... The buffer is not large enough { } } break; case FormatArgSpec::decimal: if ( arg.isNegative() ) handleNumber( context, true, FormatIntegerTools<10>::length( -(arg.int_) ), 0 ); else handleNumber( context, false, FormatIntegerTools<10>::length( arg.uint_ ), 0 ); break; case FormatArgSpec::hexaDecimal: if ( arg.isNegative() ) handleNumber( context, true, FormatIntegerTools<16>::length( -(arg.int_) ), 2 ); else handleNumber( context, false, FormatIntegerTools<16>::length( arg.uint_ ), 2 ); break; case FormatArgSpec::octal: if ( arg.isNegative() ) handleNumber( context, true, FormatIntegerTools<8>::length( -(arg.int_) ), 1 ); else handleNumber( context, false, FormatIntegerTools<8>::length( arg.uint_ ), 1 ); break; default: CPPTL_DEBUG_ASSERT_UNREACHABLE; break; } } inline void FormatLengthComputer::handleNumber( const FormatParseContext &context, bool isNegative, FormatStringIndex numberDigits, FormatStringIndex prefixLength ) { int numberWidth = numberDigits; if ( context.hasFlag( FormatArgSpec::flagRequireSign ) || isNegative ) ++numberWidth; if ( context.hasFlag( FormatArgSpec::flagShowBasePoint ) ) numberWidth += prefixLength; length_ += CPPTL_MAX( numberWidth, context.width_ ); } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Formatter // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// inline Formatter::Formatter( const char *format, const FormatArgs &args ) { format_ = format; args_ = &args; } inline FormatStringIndex Formatter::length() const { FormatLengthComputer processor; formatParse( *this, processor ); return processor.length_; } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class FormatArg // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// inline FormatArg::FormatArg( char v ) : type_( argChar ) , c_( v ) { } inline FormatArg::FormatArg( LargestInt v ) : type_( argInt ) , int_( v ) { } inline FormatArg::FormatArg( LargestUnsignedInt v ) : type_( argUInt ) , uint_( v ) { } inline FormatArg::FormatArg( int v ) : type_( argInt ) , int_( v ) { } inline FormatArg::FormatArg( unsigned int v ) : type_( argUInt ) , uint_( v ) { } inline FormatArg::FormatArg( double v ) : type_( argDouble ) , double_( v ) { } inline FormatArg::FormatArg( void *p ) : type_( argPointer ) , pointer_( p ) { } inline FormatArg::FormatArg( const char *s ) : type_( argString ) { string_.begin_ = s; string_.end_ = s ? s + strlen(s) : 0; } inline FormatArg::FormatArg( const ConstString &s ) : type_( argString ) { string_.begin_ = s.c_str(); string_.end_ = string_.begin_ + s.length(); } inline FormatArg::FormatArg( const std::string &s ) : type_( argString ) { string_.begin_ = s.c_str(); string_.end_ = string_.begin_ + s.length(); } inline FormatArg::FormatArg( const Formatter &s ) : type_( argFormatter ) , formatter_( &s ) { } inline FormatArg::FormatArg( const StringConcatenator &s ) : type_( argConcatenator ) , concatenator_( &s ) { } inline bool FormatArg::isNegative() const { return type_ == argInt && int_ < 0; } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class FormatArgs // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// inline FormatArgs::FormatArgs() : argCount_( 0 ) { } inline FormatArgs::FormatArgs( const FormatArg &arg1 ) : argCount_( 1 ) { args_[0] = &arg1; } inline FormatArgs::FormatArgs( const FormatArg &arg1, const FormatArg &arg2 ) : argCount_( 2 ) { args_[0] = &arg1; args_[1] = &arg2; } inline FormatArgs::FormatArgs( const FormatArg &arg1, const FormatArg &arg2, const FormatArg &arg3 ) : argCount_( 3 ) { args_[0] = &arg1; args_[1] = &arg2; args_[2] = &arg3; } // Helper functions inline FormatArgs args( const FormatArg &arg1 ) { return FormatArgs( arg1 ); } inline FormatArgs args( const FormatArg &arg1, const FormatArg &arg2 ) { return FormatArgs( arg1, arg2 ); } inline FormatArgs args( const FormatArg &arg1, const FormatArg &arg2, const FormatArg &arg3 ) { return FormatArgs( arg1, arg2, arg3 ); } } // namespace CppTL #endif // CPPTL_FORMAT_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:38:43
|
Update of /cvsroot/cppunit/cppunit2/examples/stringize_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17684/examples/stringize_demo Log Message: Directory /cvsroot/cppunit/cppunit2/examples/stringize_demo added to the repository |
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17272/makefiles/vs71 Added Files: cpptl_lib.vcproj cppunit2.sln cppunit2.suo cpput_lib.vcproj cpput_test.vcproj opentest_lib.vcproj opentest_test.vcproj Log Message: * new msvc project to build cppunit2. Scons is still the official way though, but this is handy for development/debugging... --- NEW FILE: cppunit2.suo --- (This appears to be a binary file; contents omitted.) --- NEW FILE: opentest_test.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="opentest_test" ProjectGUID="{FA200A48-CBCD-4A3D-8CA4-5F083610B696}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/opentest_test/debug" IntermediateDirectory="../../build/opentest_test/debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3" DisableSpecificWarnings="4355"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/opentest_test.exe" LinkIncremental="2" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/opentest_test.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool" Description="Running post-build unit tests" CommandLine="$(TargetPath)"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/opentest_test/release" IntermediateDirectory="../../build/opentest_test/release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3" DisableSpecificWarnings="4355"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/opentest_test.exe" LinkIncremental="1" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool" Description="Running post-build unit tests" CommandLine="$(TargetPath)"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath="..\..\src\opentesttest\main.cpp"> </File> <File RelativePath="..\..\src\opentesttest\mockhelper.h"> </File> <File RelativePath="..\..\src\opentesttest\packetstest.cpp"> </File> <File RelativePath="..\..\src\opentesttest\packetstest.h"> </File> <File RelativePath="..\..\src\opentesttest\remoteinterfacestest.cpp"> </File> <File RelativePath="..\..\src\opentesttest\serializertest.cpp"> </File> <File RelativePath="..\..\src\opentesttest\serializertest.h"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: cppunit2.sln --- Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpptl_lib", "cpptl_lib.vcproj", "{4037D758-74CD-412B-B67C-BA3CA89FEF28}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpput_lib", "cpput_lib.vcproj", "{79273A0D-700E-4AFA-B7F2-14D4CC325521}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpput_test", "cpput_test.vcproj", "{2506991E-13CA-49C9-8686-AACDE35C21B6}" ProjectSection(ProjectDependencies) = postProject {79273A0D-700E-4AFA-B7F2-14D4CC325521} = {79273A0D-700E-4AFA-B7F2-14D4CC325521} {4037D758-74CD-412B-B67C-BA3CA89FEF28} = {4037D758-74CD-412B-B67C-BA3CA89FEF28} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opentest_lib", "opentest_lib.vcproj", "{6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opentest_test", "opentest_test.vcproj", "{FA200A48-CBCD-4A3D-8CA4-5F083610B696}" ProjectSection(ProjectDependencies) = postProject {79273A0D-700E-4AFA-B7F2-14D4CC325521} = {79273A0D-700E-4AFA-B7F2-14D4CC325521} {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D} = {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D} {4037D758-74CD-412B-B67C-BA3CA89FEF28} = {4037D758-74CD-412B-B67C-BA3CA89FEF28} EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {4037D758-74CD-412B-B67C-BA3CA89FEF28}.Debug.ActiveCfg = Debug|Win32 {4037D758-74CD-412B-B67C-BA3CA89FEF28}.Debug.Build.0 = Debug|Win32 {4037D758-74CD-412B-B67C-BA3CA89FEF28}.Release.ActiveCfg = Release|Win32 {4037D758-74CD-412B-B67C-BA3CA89FEF28}.Release.Build.0 = Release|Win32 {79273A0D-700E-4AFA-B7F2-14D4CC325521}.Debug.ActiveCfg = Debug|Win32 {79273A0D-700E-4AFA-B7F2-14D4CC325521}.Debug.Build.0 = Debug|Win32 {79273A0D-700E-4AFA-B7F2-14D4CC325521}.Release.ActiveCfg = Release|Win32 {79273A0D-700E-4AFA-B7F2-14D4CC325521}.Release.Build.0 = Release|Win32 {2506991E-13CA-49C9-8686-AACDE35C21B6}.Debug.ActiveCfg = Debug|Win32 {2506991E-13CA-49C9-8686-AACDE35C21B6}.Debug.Build.0 = Debug|Win32 {2506991E-13CA-49C9-8686-AACDE35C21B6}.Release.ActiveCfg = Release|Win32 {2506991E-13CA-49C9-8686-AACDE35C21B6}.Release.Build.0 = Release|Win32 {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}.Debug.ActiveCfg = Debug|Win32 {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}.Debug.Build.0 = Debug|Win32 {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}.Release.ActiveCfg = Release|Win32 {6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}.Release.Build.0 = Release|Win32 {FA200A48-CBCD-4A3D-8CA4-5F083610B696}.Debug.ActiveCfg = Debug|Win32 {FA200A48-CBCD-4A3D-8CA4-5F083610B696}.Debug.Build.0 = Debug|Win32 {FA200A48-CBCD-4A3D-8CA4-5F083610B696}.Release.ActiveCfg = Release|Win32 {FA200A48-CBCD-4A3D-8CA4-5F083610B696}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- NEW FILE: opentest_lib.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="opentest_lib" ProjectGUID="{6F7EEF30-F58C-4AEF-8406-AAA16D6D384D}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/opentest/debug" IntermediateDirectory="../../build/opentest/debug" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3" DisableSpecificWarnings="4244"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/opentest_vc71_libmdd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/opentest/release" IntermediateDirectory="../../build/opentest/release" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3" DisableSpecificWarnings="4244"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/opentest_vc71_libmd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath="..\..\include\opentest\config.h"> </File> <File RelativePath="..\..\include\opentest\connection.h"> </File> <File RelativePath="..\..\include\opentest\forwards.h"> </File> <File RelativePath="..\..\src\opentest\interfaces.cpp"> </File> <File RelativePath="..\..\include\opentest\interfaces.h"> </File> <File RelativePath="..\..\include\opentest\properties.h"> </File> <File RelativePath="..\..\src\opentest\remoteinterfaces.cpp"> </File> <File RelativePath="..\..\include\opentest\remoteinterfaces.h"> </File> <File RelativePath="..\..\include\opentest\resourcelist.h"> </File> <File RelativePath="..\..\include\opentest\serializedtesttransport.h"> </File> <File RelativePath="..\..\src\opentest\serializer.cpp"> </File> <File RelativePath="..\..\include\opentest\serializer.h"> </File> <File RelativePath="..\..\src\opentest\sharedmemorytransport.cpp"> </File> <File RelativePath="..\..\include\opentest\sharedmemorytransport.h"> </File> <File RelativePath="..\..\include\opentest\testplan.h"> </File> <File RelativePath="..\..\include\opentest\testrunner.h"> </File> <File RelativePath="..\..\src\opentest\texttestdriver.cpp"> </File> <File RelativePath="..\..\include\opentest\texttestdriver.h"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: cpput_test.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="cpput_test" ProjectGUID="{2506991E-13CA-49C9-8686-AACDE35C21B6}" RootNamespace="cpput_test" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/cpput_test/debug" IntermediateDirectory="../../build/cpput_test/debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/cpput_test.exe" LinkIncremental="2" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/cpput_test.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool" Description="Running post-build unit tests" CommandLine="$(TargetPath)"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/cpput_test/release" IntermediateDirectory="../../build/cpput_test/release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" OutputFile="$(OutDir)/cpput_test.exe" LinkIncremental="1" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool" Description="Running post-build unit tests" CommandLine="$(TargetPath)"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="codetorevisit" Filter=""> <File RelativePath="..\..\src\cpputtest\testfunctor2.cpp"> <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration Name="Release|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> </File> <File RelativePath="..\..\src\cpputtest\testfunctor3.cpp"> <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration Name="Release|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> </File> <File RelativePath="..\..\src\cpputtest\testtestrunresult.cpp"> <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration Name="Release|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> </File> </Filter> <File RelativePath="..\..\src\cpputtest\assertenumtest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\assertenumtest.h"> </File> <File RelativePath="..\..\src\cpputtest\assertstringtest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\assertstringtest.h"> </File> <File RelativePath="..\..\src\cpputtest\commandlineoptionstest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\commandlineoptionstest.h"> </File> <File RelativePath="..\..\src\cpputtest\enumeratortest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\enumeratortest.h"> </File> <File RelativePath="..\..\src\cpputtest\formattest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\formattest.h"> </File> <File RelativePath="..\..\src\cpputtest\main.cpp"> </File> <File RelativePath="..\..\src\cpputtest\minitestrunner.h"> </File> <File RelativePath="..\..\src\cpputtest\mocktestlistener.h"> </File> <File RelativePath="..\..\src\cpputtest\mocktestvisitor.h"> </File> <File RelativePath="..\..\src\cpputtest\reflectiontest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\reflectiontest.h"> </File> <File RelativePath="..\..\src\cpputtest\registrytest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\registrytest.h"> </File> <File RelativePath="..\..\src\cpputtest\testbasicassertion.cpp"> </File> <File RelativePath="..\..\src\cpputtest\testexceptionguard.cpp"> </File> <File RelativePath="..\..\src\cpputtest\testfixturetest.cpp"> </File> <File RelativePath="..\..\src\cpputtest\testfixturetest.h"> </File> <File RelativePath="..\..\src\cpputtest\testfunctor.cpp"> </File> <File RelativePath="..\..\src\cpputtest\testtestcase.cpp"> </File> <File RelativePath="..\..\src\cpputtest\testtestsuite.cpp"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: cpput_lib.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="cpput_lib" ProjectGUID="{79273A0D-700E-4AFA-B7F2-14D4CC325521}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/cpput/debug" IntermediateDirectory="../../build/cpput/debug" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/cpput_vc71_libmd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/cpput/release" IntermediateDirectory="../../build/cpput/release" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/cpput_vc71_libmd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="codetorevisit" Filter=""> <File RelativePath="..\..\src\cpput\tablefixture.cpp"> <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration Name="Release|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> </File> <File RelativePath="..\..\include\cpput\tablefixture.h"> </File> <File RelativePath="..\..\src\cpput\testrunner.cpp"> <FileConfiguration Name="Debug|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> <FileConfiguration Name="Release|Win32" ExcludedFromBuild="TRUE"> <Tool Name="VCCLCompilerTool"/> </FileConfiguration> </File> <File RelativePath="..\..\include\cpput\testrunner.h"> </File> </Filter> <File RelativePath="..\..\src\cpput\assert.cpp"> </File> <File RelativePath="..\..\include\cpput\assert.h"> </File> <File RelativePath="..\..\include\cpput\assertenum.h"> </File> <File RelativePath="..\..\src\cpput\assertstring.cpp"> </File> <File RelativePath="..\..\include\cpput\assertstring.h"> </File> <File RelativePath="..\..\include\cpput\autolink.h"> </File> <File RelativePath="..\..\include\cpput\config.h"> </File> <File RelativePath="..\..\src\cpput\dllproxy.cpp"> </File> <File RelativePath="..\..\include\cpput\dllproxy.h"> </File> <File RelativePath="..\..\include\cpput\equality.h"> </File> <File RelativePath="..\..\src\cpput\exceptionguard.cpp"> </File> <File RelativePath="..\..\include\cpput\exceptionguard.h"> </File> <File RelativePath="..\..\src\cpput\extendeddata.cpp"> </File> <File RelativePath="..\..\include\cpput\extendeddata.h"> </File> <File RelativePath="..\..\include\cpput\forwards.h"> </File> <File RelativePath="..\..\include\cpput\inputtest.h"> </File> <File RelativePath="..\..\src\cpput\lighttestrunner.cpp"> </File> <File RelativePath="..\..\include\cpput\lighttestrunner.h"> </File> <File RelativePath="..\..\include\cpput\message.h"> </File> <File RelativePath="..\..\src\cpput\parametrizedsource.cpp"> </File> <File RelativePath="..\..\include\cpput\parametrizedsource.h"> </File> <File RelativePath="..\..\src\cpput\properties.cpp"> </File> <File RelativePath="..\..\src\cpput\registry.cpp"> </File> <File RelativePath="..\..\include\cpput\registry.h"> </File> <File RelativePath="..\..\include\cpput\resource.h"> </File> <File RelativePath="..\..\include\cpput\stringize.h"> </File> <File RelativePath="..\..\include\cpput\test.h"> </File> <File RelativePath="..\..\src\cpput\testcase.cpp"> </File> <File RelativePath="..\..\include\cpput\testcase.h"> </File> <File RelativePath="..\..\include\cpput\testfixture.h"> </File> <File RelativePath="..\..\src\cpput\testinfo.cpp"> </File> <File RelativePath="..\..\include\cpput\testinfo.h"> </File> <File RelativePath="..\..\src\cpput\testsuite.cpp"> </File> <File RelativePath="..\..\include\cpput\testsuite.h"> </File> <File RelativePath="..\..\include\cpput\testvisitor.h"> </File> <File RelativePath="..\..\include\cpput\translate.h"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: cpptl_lib.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="cpptl_lib" ProjectGUID="{4037D758-74CD-412B-B67C-BA3CA89FEF28}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="../../build/cpptl/debug" IntermediateDirectory="../../build/cpptl/debug" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/cpptl_vc71_libmdd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="../../build/cpptl/release" IntermediateDirectory="../../build/cpptl/release" ConfigurationType="4" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="../../include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" TreatWChar_tAsBuiltInType="TRUE" ForceConformanceInForLoopScope="TRUE" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="FALSE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLibrarianTool" OutputFile="$(OutDir)/cpptl_vc71_libmd.lib"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath="..\..\include\cpptl\any.h"> </File> <File RelativePath="..\..\include\cpptl\atomiccounter.h"> </File> <File RelativePath="..\..\include\cpptl\bimap.h"> </File> <File RelativePath="..\..\include\cpptl\config.h"> </File> <File RelativePath="..\..\include\cpptl\conststring.h"> </File> <File RelativePath="..\..\include\cpptl\enumerator.h"> </File> <File RelativePath="..\..\include\cpptl\enumstringizer.h"> </File> <File RelativePath="..\..\include\cpptl\format.h"> </File> <File RelativePath="..\..\include\cpptl\forwards.h"> </File> <File RelativePath="..\..\include\cpptl\functor.h"> </File> <File RelativePath="..\..\include\cpptl\intrusiveptr.h"> </File> <File RelativePath="..\..\include\cpptl\reflection.h"> </File> <File RelativePath="..\..\include\cpptl\reflection.inl"> </File> <File RelativePath="..\..\include\cpptl\reflectionimpl10.h"> </File> <File RelativePath="..\..\include\cpptl\scopedptr.h"> </File> <File RelativePath="..\..\include\cpptl\sharedptr.h"> </File> <File RelativePath="..\..\include\cpptl\stringtools.h"> </File> <File RelativePath="..\..\src\cpptl\thread.cpp"> </File> <File RelativePath="..\..\include\cpptl\thread.h"> </File> <File RelativePath="..\..\include\cpptl\typeinfo.h"> </File> <File RelativePath="..\..\include\cpptl\typename.h"> </File> <File RelativePath="..\..\include\cpptl\typetraits.h"> </File> <File RelativePath="..\..\include\cpptl\yaml.h"> </File> </Files> <Globals> </Globals> </VisualStudioProject> |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:33:50
|
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17190/makefiles/vs71 Log Message: Directory /cvsroot/cppunit/cppunit2/makefiles/vs71 added to the repository |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:33:07
|
Update of /cvsroot/cppunit/cppunit2/makefiles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17061/makefiles Log Message: Directory /cvsroot/cppunit/cppunit2/makefiles added to the repository |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:52
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321/include/cpput Modified Files: stringize.h Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: stringize.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/stringize.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stringize.h 4 Jul 2005 08:11:25 -0000 1.6 --- stringize.h 6 Sep 2005 07:31:42 -0000 1.7 *************** *** 7,12 **** --- 7,40 ---- # include <cpptl/stringtools.h> + /* How to: + * - define a conversion function for a string type: + * overload the function std::string getStdString( MyStringType ) + * + * namespace CppUT { + * inline std::string getStdString( const MyStringType &s ) { + * return s.str(); + * } } + * + */ + + + + // 1) Is it a string ? + // std::string convertToString( ptr ) => Yes, convert to string & add quotes. + // NoToStringConversion convertToString( .. ) + // stringize( impl::stringize( value, convertToString( ptr ) ) ); + // 2) Is there an overloaded toString() function for that type + // std::string toString( ptr ); => Yes, convert to string using the function + // NoToStringConversion toString( ... ); + // 3) Fall back DefaultStringizer. + + namespace CppUT { + /** A generic functor that can be used to convert a value into a string. + * It is used as default argument by function template that allow the user to + * pass a specific functor to convert data to string. + * \warning This class template should not be specialized. See stringize() for detail. + */ template<class ValueType> struct DefaultStringizer *************** *** 19,25 **** // ------------------- convertToString ------------------------------- ! // User should overload convertToString() to support their own string types. // ! // IMPORTANT: convertToString() must never be called with a 'by value' parameter. // Passing by value would result in undefined behavior for non string type parameter // 'eaten' by NotConvertibleToStdString convertToString( ... ). --- 47,55 ---- // ------------------- convertToString ------------------------------- ! // User should overload getStdString() to support their own string types. // ! // IMPORTANT: to handle compiler that do not support function template ordering ! // (CPPTL_NO_FUNCTION_TEMPLATE_ORDERING), such as vc++ 6.0. ! // getStdString() must never be called with a 'by value' parameter. // Passing by value would result in undefined behavior for non string type parameter // 'eaten' by NotConvertibleToStdString convertToString( ... ). *************** *** 31,59 **** // const StringType2 &str ) // convertToString will only be passed reference. // { ! // RegEx regex( CppUT::convertToString(pattern ) ); ! // CppUT::checkTrue( regex.matched( CppUT::convertToString( str ) ) ); // } struct NotConvertibleToStdString {}; ! inline std::string convertToString( const char *cstr ) { return std::string( cstr ); } ! inline std::string convertToString( const std::string &s ) { return s; } ! inline std::string convertToString( const CppTL::ConstString &s ) { return s.c_str(); } ! inline NotConvertibleToStdString convertToString( ... ) { return NotConvertibleToStdString(); } --- 61,103 ---- // const StringType2 &str ) // convertToString will only be passed reference. // { ! // RegEx regex( CppUT::convertToString(&pattern ) ); ! // CppUT::checkTrue( regex.matched( CppUT::convertToString( &str ) ) ); // } struct NotConvertibleToStdString {}; ! inline std::string getStdString( const char *cstr ) { return std::string( cstr ); } ! inline std::string getStdString( const std::string &s ) { return s; } ! inline std::string getStdString( const CppTL::ConstString &s ) { return s.c_str(); } ! #ifdef CPPTL_NO_FUNCTION_TEMPLATE_ORDERING ! inline NotConvertibleToStdString getStdString( ... ) { return NotConvertibleToStdString(); } + #else + template<class T> + inline NotConvertibleToStdString getStdString( const T & ) + { + return NotConvertibleToStdString(); + } + #endif + + template <class StringType> + inline std::string convertToString( const StringType &s ) + { + return getStdString( s ); // if you get a compilation error on this call, then getStdString() has not been overloaded for your string type. + } *************** *** 64,72 **** // std::string defaultStringize( const T &value ); namespace Impl { template<typename ValueType> ! std::string stringize( const ValueType &value, NotConvertibleToStdString ) { return defaultStringize( value ); --- 108,130 ---- // std::string defaultStringize( const T &value ); + struct NoToStringOverload {}; + + #ifdef CPPTL_NO_FUNCTION_TEMPLATE_ORDERING + inline NoToStringOverload toString( ... ) + { + return NoToStringOverload(); + } + #else + template<class T> + inline NoToStringOverload toString( const T & ) + { + return NoToStringOverload(); + } + #endif namespace Impl { template<typename ValueType> ! std::string toStringStringize( const ValueType &value, NoToStringOverload ) { return defaultStringize( value ); *************** *** 74,77 **** --- 132,147 ---- template<typename ValueType> + std::string toStringStringize( const ValueType &value, const std::string &str ) + { + return str; + } + + template<typename ValueType> + std::string stringize( const ValueType &value, NotConvertibleToStdString ) + { + return toStringStringize( value, toString( value ) ); + } + + template<typename ValueType> std::string stringize( const ValueType &value, const std::string &str ) { *************** *** 84,88 **** std::string stringize( const ValueType &value ) { ! return Impl::stringize( value, convertToString(value) ); } --- 154,158 ---- std::string stringize( const ValueType &value ) { ! return Impl::stringize( value, getStdString(&value) ); } *************** *** 100,108 **** namespace CppUT { ! template<class ValueType> ! struct StringizeTraits { - static std::string stringize( const ValueType &value ) - { # ifndef CPPTL_NO_SSTREAM std::ostringstream os; --- 170,176 ---- namespace CppUT { ! template<typename ValueType> ! std::string defaultStringize( const ValueType &value ) { # ifndef CPPTL_NO_SSTREAM std::ostringstream os; *************** *** 114,124 **** return std::string( os.str(), os.pcount() ); # endif - } - }; - - template<typename ValueType> - std::string defaultStringize( const ValueType &value ) - { - return StringizeTraits<ValueType>::stringize( value ); } --- 182,185 ---- |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:52
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321/src/opentest Modified Files: remoteinterfaces.cpp serializer.cpp sharedmemorytransport.cpp Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: remoteinterfaces.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/remoteinterfaces.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** remoteinterfaces.cpp 25 Jun 2005 11:08:05 -0000 1.2 --- remoteinterfaces.cpp 6 Sep 2005 07:31:42 -0000 1.3 *************** *** 29,32 **** --- 29,33 ---- RemoteMessage::RemoteMessage( MessageId id ) + : messageId_( id ) { } *************** *** 265,275 **** // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // class MessageSender // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// void ! MessageSender::sendMessage( const RemoteMessagePtr &message ) { } --- 266,294 ---- // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // class MessageServerProxy // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// + MessageServerProxy::MessageServerProxy() + : transport_( 0 ) + { + } + + void ! MessageServerProxy::setTransport( MessageTransport &transport ) { + transport_ = &transport; + } + + + void + MessageServerProxy::sendMessage( const RemoteMessagePtr &message ) + { + if ( transport_ ) + transport_->sendMessage( message ); + else // @todo transport error + { + } } *************** *** 406,410 **** void ! TestRunnerProxy::runTests( const TestPlan &plan ) { sendMessage( makeSimpleRemoteMessage( runnerMessageRunTests, plan ) ); --- 425,429 ---- void ! TestRunnerProxy::runTests( const TestPlans &plan ) { sendMessage( makeSimpleRemoteMessage( runnerMessageRunTests, plan ) ); Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** serializer.cpp 4 Jul 2005 08:12:33 -0000 1.8 --- serializer.cpp 6 Sep 2005 07:31:42 -0000 1.9 *************** *** 72,80 **** void ! Packets::beginMessage() { ! appendPacketIfFull( externalPos_ ); MessagePacket message; ! message.position_ = externalPos_; message.length_ = 0; messages_.push_back( message ); --- 72,80 ---- void ! Packets::beginWriteMessage() { ! appendPacketIfFull(); MessagePacket message; ! message.position_ = writePos_; message.length_ = 0; messages_.push_back( message ); *************** *** 83,115 **** void ! Packets::received( void *data, Pos length ) ! { ! write( externalPos_, static_cast<Byte *>( data ), length ); ! } ! ! ! unsigned int ! Packets::send( void *dest, ! Pos availableLength ) ! { ! return read( externalPos_, static_cast<Byte *>( dest ), availableLength ); ! } ! ! ! void ! Packets::endExternalMessage() { CPPTL_ASSERT_MESSAGE( !messages_.empty() && messages_.back().length_ == 0, "No message started." ); ! messages_.back().length_ = distance( messages_.back().position_, externalPos_ ); ! } ! ! ! void ! Packets::endSerializeMessage() ! { ! CPPTL_ASSERT_MESSAGE( !messages_.empty() && messages_.back().length_ > 0, ! "No message started." ); ! messages_.back().length_ = distance( messages_.back().position_, serializePos_ ); } --- 83,91 ---- void ! Packets::endWriteMessage() { CPPTL_ASSERT_MESSAGE( !messages_.empty() && messages_.back().length_ == 0, "No message started." ); ! messages_.back().length_ = distance( messages_.back().position_, writePos_ ); } *************** *** 134,162 **** Packets::discardFirstMessage() { ! Packet *current = packetsHead_; ! while ( current != externalPos_.packet_ ) ! { ! Packet *toDelete = current; ! current = current->next_; ! CPPTL_ASSERT_MESSAGE( toDelete != serializePos_.packet_, ! "Deleting packets used for serialization." ); ! delete toDelete; ! } ! packetsHead_ = current; } ! unsigned char ! Packets::serializationReadNextByte() { ! if ( serializePos_ ) { ! if ( serializePos_.currentData_ == serializePos_.packet_->endInitialized_ ) { ! if ( serializePos_.packet_->next_ == 0 ) return ccEndBuffer; ! serializePos_.seekToNextPacket(); } ! return *(serializePos_.currentData_++); } return ccEndBuffer; --- 110,146 ---- Packets::discardFirstMessage() { ! //Packet *current = packetsHead_; ! //while ( current != writePos_.packet_ ) ! //{ ! // Packet *toDelete = current; ! // current = current->next_; ! // CPPTL_ASSERT_MESSAGE( toDelete != readPos_.packet_, ! // "Deleting packets used for serialization." ); ! // delete toDelete; ! //} ! //packetsHead_ = current; } ! Packets::Pos ! Packets::read( void *dest, ! Pos availableLength ) { ! return read( readPos_, static_cast<Byte *>( dest ), availableLength ); ! } ! ! ! Packets::Byte ! Packets::readByte() ! { ! if ( readPos_ ) { ! if ( readPos_.currentData_ == readPos_.packet_->endInitialized_ ) { ! if ( readPos_.packet_->next_ == 0 ) return ccEndBuffer; ! readPos_.seekToNextPacket(); } ! return *(readPos_.currentData_++); } return ccEndBuffer; *************** *** 164,213 **** void ! Packets::serializationUngetLastByte() { ! CPPTL_ASSERT_MESSAGE( serializePos_, "No byte to unget" ); ! if ( serializePos_.currentData_ > serializePos_.packet_->begin_ ) ! --serializePos_.currentData_; else ! serializePos_.seekBeforeEndOfPreviousPacket(); ! } ! ! bool ! Packets::serializationRead( void *buffer, ! Pos length ) ! { ! return read( serializePos_, static_cast<Byte *>( buffer ), length ) == length; } void ! Packets::serializationWrite( const void *buffer, ! Pos length ) { ! write( serializePos_, static_cast<const Byte *>( buffer ), length ); } void ! Packets::serializationWrite( Byte byte ) { ! if ( serializePos_ && serializePos_.currentData_ != serializePos_.packet_->end_ ) ! *serializePos_.currentData_++ = byte; else ! write( serializePos_, &byte, 1 ); } void ! Packets::appendPacketIfFull( PacketPos &pos ) { ! if ( !pos || pos.currentData_ == pos.packet_->end_ ) { ! Packet *packet = new Packet( defaultPacketSize_, pos.packet_ ); if ( !packetsHead_ ) packetsHead_ = packet; ! pos = PacketPos( packet ); ! if ( !serializePos_ ) ! serializePos_ = pos; ! if ( !externalPos_ ) ! externalPos_ = pos; } } --- 148,191 ---- void ! Packets::unreadLastByte() { ! CPPTL_ASSERT_MESSAGE( readPos_, "No byte to unget" ); ! if ( readPos_.currentData_ > readPos_.packet_->begin_ ) ! --readPos_.currentData_; else ! readPos_.seekBeforeEndOfPreviousPacket(); } void ! Packets::write( const void *buffer, ! Pos length ) { ! write( writePos_, static_cast<const Byte *>( buffer ), length ); } void ! Packets::writeByte( Byte byte ) { ! if ( writePos_ && writePos_.currentData_ != writePos_.packet_->end_ ) ! { ! *writePos_.currentData_++ = byte; ! writePos_.packet_->endInitialized_ = writePos_.currentData_; ! } else ! write( writePos_, &byte, 1 ); } void ! Packets::appendPacketIfFull() { ! if ( !writePos_ || writePos_.currentData_ == writePos_.packet_->end_ ) { ! Packet *packet = new Packet( defaultPacketSize_, writePos_.packet_ ); if ( !packetsHead_ ) packetsHead_ = packet; ! writePos_ = PacketPos( packet ); ! if ( !readPos_ ) ! readPos_ = writePos_; } } *************** *** 239,243 **** if ( !pos ) ! appendPacketIfFull( pos ); Pos writeLength = CPPTL_MIN( pos.availableForWriting(), length ); --- 217,221 ---- if ( !pos ) ! appendPacketIfFull(); Pos writeLength = CPPTL_MIN( pos.availableForWriting(), length ); *************** *** 251,255 **** CPPTL_ASSERT_MESSAGE( pos.currenData_ == pos.packet_->end_, "Should be at the end of the current packet" ); ! appendPacketIfFull( pos ); writeLength = CPPTL_MIN( pos.packet_->length(), length ); memcpy( pos.packet_->begin_, data, writeLength ); --- 229,233 ---- CPPTL_ASSERT_MESSAGE( pos.currenData_ == pos.packet_->end_, "Should be at the end of the current packet" ); ! appendPacketIfFull(); writeLength = CPPTL_MIN( pos.packet_->length(), length ); memcpy( pos.packet_->begin_, data, writeLength ); *************** *** 325,332 **** ! unsigned char Stream::readNextByte() { ! return packets_.serializationReadNextByte(); } --- 303,310 ---- ! Stream::Byte Stream::readNextByte() { ! return packets_.readByte(); } *************** *** 334,338 **** Stream::ungetLastByte() { ! packets_.serializationUngetLastByte(); } --- 312,316 ---- Stream::ungetLastByte() { ! packets_.unreadLastByte(); } *************** *** 340,344 **** Stream::read( void *buffer, unsigned int length ) { ! if ( !packets_.serializationRead( buffer, length ) ) setError( "Attempted to read beyond buffer end." ); } --- 318,322 ---- Stream::read( void *buffer, unsigned int length ) { ! if ( packets_.read( buffer, length ) != length ) setError( "Attempted to read beyond buffer end." ); } *************** *** 346,352 **** void ! Stream::write( unsigned char byte ) { ! packets_.serializationWrite( byte ); } --- 324,330 ---- void ! Stream::write( Byte byte ) { ! packets_.writeByte( byte ); } *************** *** 355,359 **** Stream::write( const void *buffer, unsigned int length ) { ! packets_.serializationWrite( buffer, length ); } --- 333,337 ---- Stream::write( const void *buffer, unsigned int length ) { ! packets_.write( buffer, length ); } *************** *** 401,412 **** void ! Stream::doSerializeInteger( unsigned char kind, LargestUnsignedInt value ) { ! unsigned char buffer[ (sizeof(value)*8 + ccIntegerBaseShift - 1) / ccIntegerBaseShift ]; ! unsigned char *current = buffer + sizeof(buffer); do { ! unsigned char reminder = value & ((1 << ccIntegerBaseShift) - 1); *--current = reminder + ccIntegerZero; value >>= ccIntegerBaseShift; --- 379,390 ---- void ! Stream::doSerializeInteger( Byte kind, LargestUnsignedInt value ) { ! Byte buffer[ (sizeof(value)*8 + ccIntegerBaseShift - 1) / ccIntegerBaseShift ]; ! Byte *current = buffer + sizeof(buffer); do { ! Byte reminder = Byte(value & ((1 << ccIntegerBaseShift) - 1)); *--current = reminder + ccIntegerZero; value >>= ccIntegerBaseShift; *************** *** 446,450 **** else { ! CPPTL_ASSERT_MESSAGE( (unsigned char)*current >= ccIntegerZero, "Real number conversion produced stream control characters!" ); } --- 424,428 ---- else { ! CPPTL_ASSERT_MESSAGE( (Byte)*current >= ccIntegerZero, "Real number conversion produced stream control characters!" ); } *************** *** 500,504 **** { value = 0; ! unsigned char digit; while ( (digit = readNextByte()) >= ccIntegerZero ) { --- 478,482 ---- { value = 0; ! Byte digit; while ( (digit = readNextByte()) >= ccIntegerZero ) { *************** *** 518,522 **** return *this; ! unsigned char control = readNextByte(); if ( control == ccBooleanTrue ) value = true; --- 496,500 ---- return *this; ! Byte control = readNextByte(); if ( control == ccBooleanTrue ) value = true; *************** *** 534,538 **** LargestInt temp; *this >> temp; ! value = temp; return *this; } --- 512,516 ---- LargestInt temp; *this >> temp; ! value = int(temp); return *this; } *************** *** 544,548 **** LargestUnsignedInt temp; *this >> temp; ! value = temp; return *this; } --- 522,526 ---- LargestUnsignedInt temp; *this >> temp; ! value = (unsigned int)temp; return *this; } *************** *** 555,559 **** return *this; ! unsigned char control = readNextByte(); LargestUnsignedInt unsignedValue; if ( control == ccPositiveInteger ) --- 533,537 ---- return *this; ! Byte control = readNextByte(); LargestUnsignedInt unsignedValue; if ( control == ccPositiveInteger ) *************** *** 565,569 **** { doUnserializeInteger( unsignedValue ); ! value = -unsignedValue; } else --- 543,547 ---- { doUnserializeInteger( unsignedValue ); ! value = -LargestInt(unsignedValue); } else *************** *** 579,583 **** return *this; ! unsigned char control = readNextByte(); if ( control == ccPositiveInteger ) doUnserializeInteger( value ); --- 557,561 ---- return *this; ! Byte control = readNextByte(); if ( control == ccPositiveInteger ) doUnserializeInteger( value ); *************** *** 594,598 **** CppTL::StringBuffer buffer; ! unsigned char control = readNextByte(); if ( control == ccNegativeReal ) buffer += "-"; --- 572,576 ---- CppTL::StringBuffer buffer; ! Byte control = readNextByte(); if ( control == ccNegativeReal ) buffer += "-"; *************** *** 604,608 **** while ( true ) { ! unsigned char digit = readNextByte(); if ( digit == ccRealWithinPlusSign ) buffer += "+"; --- 582,586 ---- while ( true ) { ! Byte digit = readNextByte(); if ( digit == ccRealWithinPlusSign ) buffer += "+"; *************** *** 634,638 **** return *this; ! unsigned char control = readNextByte(); if ( control == ccString ) readString( str ); --- 612,616 ---- return *this; ! Byte control = readNextByte(); if ( control == ccString ) readString( str ); *************** *** 644,648 **** void ! Stream::readDictionnaryEntry ( unsigned char control, String &str ) { --- 622,626 ---- void ! Stream::readDictionnaryEntry ( Byte control, String &str ) { *************** *** 671,675 **** LargestUnsignedInt length; doUnserializeInteger( length ); ! unsigned char control = readNextByte(); if ( control != ccString ) setError( "Expected string." ); --- 649,653 ---- LargestUnsignedInt length; doUnserializeInteger( length ); ! Byte control = readNextByte(); if ( control != ccString ) setError( "Expected string." ); *************** *** 720,724 **** bool ! Stream::isNamedPropertyControl( unsigned char control ) { return control == ccLookUpDictionnaryEntry --- 698,702 ---- bool ! Stream::isNamedPropertyControl( Byte control ) { return control == ccLookUpDictionnaryEntry *************** *** 730,734 **** Stream::operator >>( Properties &properties ) { ! unsigned char control = readNextByte(); if ( control == ccEmptyProperties ) return *this; --- 708,712 ---- Stream::operator >>( Properties &properties ) { ! Byte control = readNextByte(); if ( control == ccEmptyProperties ) return *this; *************** *** 816,820 **** Stream::operator >>( Value &value ) { ! unsigned char control = readNextByte(); switch ( control ) { --- 794,798 ---- Stream::operator >>( Value &value ) { ! Byte control = readNextByte(); switch ( control ) { Index: sharedmemorytransport.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/sharedmemorytransport.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sharedmemorytransport.cpp 1 Jul 2005 08:19:36 -0000 1.3 --- sharedmemorytransport.cpp 6 Sep 2005 07:31:42 -0000 1.4 *************** *** 615,621 **** while ( !messages.empty() ) { ! buffer.stream_.packets().beginMessage(); buffer.stream_ << messages.front(); ! buffer.stream_.packets().endSerializeMessage(); messages.pop_front(); } --- 615,621 ---- while ( !messages.empty() ) { ! buffer.stream_.packets().beginWriteMessage(); buffer.stream_ << messages.front(); ! buffer.stream_.packets().endWriteMessage(); messages.pop_front(); } *************** *** 663,667 **** buffer.processedLength_ = 0; log( "read: message size is %d", buffer.messageLength_ ); ! buffer.stream_.packets().beginMessage(); } } --- 663,667 ---- buffer.processedLength_ = 0; log( "read: message size is %d", buffer.messageLength_ ); ! buffer.stream_.packets().beginWriteMessage(); } } *************** *** 670,680 **** { Pos toRead = CPPTL_MIN( available, buffer.messageLength_ ); ! buffer.stream_.packets().received( buffer.data_ + buffer.circular_->readPos_, ! toRead ); buffer.read( "Message content", toRead ); if ( buffer.processedLength_ == buffer.messageLength_ ) { log( "read: message completly received" ); ! buffer.stream_.packets().endExternalMessage(); buffer.state_ = bsSize; buffer.processedLength_ = 0; --- 670,680 ---- { Pos toRead = CPPTL_MIN( available, buffer.messageLength_ ); ! buffer.stream_.packets().write( buffer.data_ + buffer.circular_->readPos_, ! toRead ); buffer.read( "Message content", toRead ); if ( buffer.processedLength_ == buffer.messageLength_ ) { log( "read: message completly received" ); ! buffer.stream_.packets().endWriteMessage(); buffer.state_ = bsSize; buffer.processedLength_ = 0; *************** *** 728,732 **** Pos toWrite = CPPTL_MIN( available, buffer.messageLength_ ); Byte *target = buffer.data_ + buffer.circular_->normalizeWritePos(); ! Pos written = buffer.stream_.packets().send( target, toWrite ); buffer.write( "Message content", written ); if ( buffer.processedLength_ == buffer.messageLength_ ) --- 728,732 ---- Pos toWrite = CPPTL_MIN( available, buffer.messageLength_ ); Byte *target = buffer.data_ + buffer.circular_->normalizeWritePos(); ! Pos written = buffer.stream_.packets().read( target, toWrite ); buffer.write( "Message content", written ); if ( buffer.processedLength_ == buffer.messageLength_ ) *************** *** 809,813 **** void ! SharedMemoryTransport::send( const RemoteMessagePtr &message ) { impl_->send( message ); --- 809,813 ---- void ! SharedMemoryTransport::sendMessage( const RemoteMessagePtr &message ) { impl_->send( message ); |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:52
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321/src/opentesttest Modified Files: main.cpp packetstest.cpp serializertest.cpp Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: packetstest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/packetstest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** packetstest.cpp 8 Aug 2005 22:12:37 -0000 1.3 --- packetstest.cpp 6 Sep 2005 07:31:42 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- #include <cpput/assert.h> #include <cpput/assertstring.h> + #include <cpput/registry.h> #include <cpptl/scopedptr.h> #include <memory.h> // memcmp, memset *************** *** 33,37 **** namespace CppUT { // converter for assert equal ! inline std::string convertToString( const BinaryData &value ) { return value.toString().str(); --- 34,38 ---- namespace CppUT { // converter for assert equal ! inline std::string toString( const BinaryData &value ) { return value.toString().str(); *************** *** 40,43 **** --- 41,46 ---- + CPPUT_REGISTER_SUITE_TO_DEFAULT( PacketsTest ); + PacketsTest::PacketsTest() { *************** *** 75,92 **** { static const char *testData[] = { "1", "12", "123", "12345", "1234abcd" }; const int numberOfTestData = sizeof(testData) / sizeof(const Byte *); ! for ( int index1 = 0; index1 < numberOfTestData; ++index1 ) { ! Pos testDataLength = strlen(testData[index1]); ! packets_.reset( new OpenTest::Packets( 4 ) ); // notes: test fails if using the same packets... ! packets_->beginMessage(); ! packets_->serializationWrite( testData[index1], testDataLength ); ! packets_->endSerializeMessage(); ! CPPUT_ASSERT_EXPR( packets_->hasPendingMessage() ); ! CppTL::ScopedArray<Byte> actual( new Byte[ testDataLength ] ); ! memset( actual.get(), 0, testDataLength ); ! Pos actualLength = packets_->send( actual.get(), testDataLength ); ! CPPUT_ASSERT_EQUAL( BinaryData( testData[index1], testDataLength ), ! BinaryData( actual.get(), actualLength ) ); } } --- 78,101 ---- { static const char *testData[] = { "1", "12", "123", "12345", "1234abcd" }; + static int packetSizes[] = { 1, 2, 3, 4, 5, 16384 }; const int numberOfTestData = sizeof(testData) / sizeof(const Byte *); ! for ( int size = 0; size < sizeof(packetSizes)/sizeof(int); ++size ) { ! int packetSize = packetSizes[size]; ! CppUT::log( "Using packet size: " + CppTL::toString( packetSize ) ); ! packets_.reset( new OpenTest::Packets( packetSize ) ); ! for ( int index1 = 0; index1 < numberOfTestData; ++index1 ) ! { ! Pos testDataLength = strlen(testData[index1]); ! packets_->beginWriteMessage(); ! packets_->write( testData[index1], testDataLength ); ! packets_->endWriteMessage(); ! CPPUT_ASSERT_EXPR( packets_->hasPendingMessage()); ! CppTL::ScopedArray<Byte> actual( new Byte[ testDataLength ] ); ! memset( actual.get(), 0, testDataLength ); ! Pos actualLength = packets_->read( actual.get(), testDataLength ); ! CPPUT_ASSERT_EQUAL( BinaryData( testData[index1], testDataLength ), ! BinaryData( actual.get(), actualLength ) ); ! } } } Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 4 Jul 2005 08:12:34 -0000 1.3 --- main.cpp 6 Sep 2005 07:31:42 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- #include <cpput/testsuite.h> #include <cpput/lighttestrunner.h> + #include <cpput/registry.h> #include <stdio.h> #include "packetstest.h" *************** *** 65,70 **** printf( "All bootstrap tests passed successfuly...\n" ); ! CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); ! allSuite->add( PacketsTest::suite() ); //allSuite->add( SerializerTest::suite() ); --- 66,71 ---- printf( "All bootstrap tests passed successfuly...\n" ); ! CppUT::TestSuitePtr allSuite = CppUT::Registry::instance().createDefaultTests(); ! // allSuite->add( PacketsTest::suite() ); //allSuite->add( SerializerTest::suite() ); Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** serializertest.cpp 2 Jul 2005 20:27:37 -0000 1.3 --- serializertest.cpp 6 Sep 2005 07:31:42 -0000 1.4 *************** *** 2,9 **** #include <cpput/assert.h> #include <cpput/assertstring.h> namespace CppUT { // converter for assert equal ! inline std::string convertToString( const OpenTest::Value &value ) { return value.toString().c_str(); --- 2,15 ---- #include <cpput/assert.h> #include <cpput/assertstring.h> + #include <cpput/registry.h> namespace CppUT { // converter for assert equal ! inline std::string toString( const OpenTest::Properties &value ) ! { ! return value.toString().c_str(); ! } ! ! inline std::string toString( const OpenTest::Value &value ) { return value.toString().c_str(); *************** *** 13,16 **** --- 19,25 ---- + CPPUT_REGISTER_SUITE_TO_DEFAULT( SerializerTest ); + + SerializerTest::SerializerTest() { *************** *** 39,43 **** SerializerTest::prepareSerialize() { ! streamOut_.packets().beginMessage(); } --- 48,52 ---- SerializerTest::prepareSerialize() { ! streamOut_.packets().beginWriteMessage(); } *************** *** 46,58 **** SerializerTest::prepareUnserialize() { ! streamOut_.packets().endSerializeMessage(); int length = streamOut_.packets().getFirstMessageLength(); void *buffer = new char[length]; ! streamOut_.packets().send( buffer, length ); streamOut_.packets().discardFirstMessage(); ! streamIn_.packets().beginMessage(); ! streamIn_.packets().received( buffer, length ); ! streamIn_.packets().endExternalMessage(); delete [] buffer; } --- 55,70 ---- SerializerTest::prepareUnserialize() { ! streamOut_.packets().endWriteMessage(); ! ! // Read the serialized message in 'streamOut_' int length = streamOut_.packets().getFirstMessageLength(); void *buffer = new char[length]; ! streamOut_.packets().read( buffer, length ); streamOut_.packets().discardFirstMessage(); ! // and write the serialized message back in 'streamIn_' ! streamIn_.packets().beginWriteMessage(); ! streamIn_.packets().write( buffer, length ); ! streamIn_.packets().endWriteMessage(); delete [] buffer; } |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:52
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321/include/opentest Modified Files: forwards.h interfaces.h remoteinterfaces.h serializer.h sharedmemorytransport.h Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: sharedmemorytransport.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/sharedmemorytransport.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sharedmemorytransport.h 30 Jun 2005 21:48:09 -0000 1.2 --- sharedmemorytransport.h 6 Sep 2005 07:31:42 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- # include <opentest/forwards.h> + # include <opentest/remoteinterfaces.h> #ifndef OPENTEST_NO_SHAREDMEMORYTRANSPORT *************** *** 33,37 **** }; ! class SharedMemoryTransport { public: --- 34,38 ---- }; ! class SharedMemoryTransport : public MessageTransport { public: *************** *** 45,49 **** virtual ~SharedMemoryTransport(); ! void send( const RemoteMessagePtr &message ); void dispatchReceivedMessages( RemoteMessageServer &server ); --- 46,52 ---- virtual ~SharedMemoryTransport(); ! ! public: // overriden from MessageTransport ! void sendMessage( const RemoteMessagePtr &message ); void dispatchReceivedMessages( RemoteMessageServer &server ); Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/forwards.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** forwards.h 1 Jul 2005 08:19:37 -0000 1.6 --- forwards.h 6 Sep 2005 07:31:42 -0000 1.7 *************** *** 16,19 **** --- 16,20 ---- class TestPlan; class TestPlanEntry; + class TestPlans; class TestRunTracker; class Value; Index: serializer.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/serializer.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** serializer.h 4 Jul 2005 08:12:32 -0000 1.6 --- serializer.h 6 Sep 2005 07:31:42 -0000 1.7 *************** *** 10,24 **** 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 Packets { public: typedef unsigned char Byte; --- 10,19 ---- namespace OpenTest { ! typedef CppTL::LargestInt LargestInt; ! typedef CppTL::LargestUnsignedInt LargestUnsignedInt; class Packets { + friend class PacketsTest; public: typedef unsigned char Byte; *************** *** 28,48 **** virtual ~Packets(); ! // for transport communication ! void beginMessage(); ! void received( void *data, Pos length ); ! // Returns the length actual written at dest ! unsigned int send( void *dest, Pos availableLength ); ! void endSerializeMessage(); ! void endExternalMessage(); bool hasPendingMessage() const; Pos getFirstMessageLength(); void discardFirstMessage(); ! // for serialization ! unsigned char serializationReadNextByte(); ! void serializationUngetLastByte(); ! bool serializationRead( void *buffer, Pos length ); ! void serializationWrite( const void *buffer, Pos length ); ! void serializationWrite( Byte byte ); private: --- 23,50 ---- virtual ~Packets(); ! void beginWriteMessage(); ! void endWriteMessage(); ! //void beginReadMessage(); ! //void endReadMessage(); bool hasPendingMessage() const; Pos getFirstMessageLength(); void discardFirstMessage(); ! /// Read the specified length of data from packets ! /// @returns Length of data actually read and written in the buffer. ! Pos read( void *data, Pos length ); ! ! /// Read a single byte ! /// @returns byte read, ccEndBuffer if no byte available for reading. ! Byte readByte(); ! ! /// Seeks read position backward in current message. ! void unreadLastByte(); ! ! /// Write the specified data in the packets ! void write( const void *buffer, Pos length ); ! ! /// Write the specified byte in the packets ! void writeByte( Byte byte ); private: *************** *** 123,127 **** { CPPTL_ASSERT_MESSAGE( packet_ != 0, "No packet available" ); ! return packet_->endInitialized_ - packet_->begin_; } --- 125,129 ---- { CPPTL_ASSERT_MESSAGE( packet_ != 0, "No packet available" ); ! return packet_->endInitialized_ - currentData_; } *************** *** 156,160 **** }; ! void appendPacketIfFull( PacketPos &pos ); Pos distance( const PacketPos &begin, const PacketPos &end ) const; --- 158,162 ---- }; ! void appendPacketIfFull(); Pos distance( const PacketPos &begin, const PacketPos &end ) const; *************** *** 166,171 **** std::deque<MessagePacket> messages_; Packet *packetsHead_; ! PacketPos serializePos_; // Position from where data are read or write for serialization ! PacketPos externalPos_; // Position where data are read/write on transport medium Pos defaultPacketSize_; }; --- 168,173 ---- std::deque<MessagePacket> messages_; Packet *packetsHead_; ! PacketPos readPos_; // Position from where data are read or write for serialization ! PacketPos writePos_; // Position where data are read/write on transport medium Pos defaultPacketSize_; }; *************** *** 209,226 **** 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: --- 211,230 ---- private: ! typedef unsigned char Byte; ! ! void doSerializeInteger( Byte kind, LargestUnsignedInt value ); void doUnserializeInteger( LargestUnsignedInt &value ); void saveDictionnaryEntry( const String &str ); ! void readDictionnaryEntry( Byte control, String &str ); void readString( String &str ); ! Byte readNextByte(); void ungetLastByte(); void read( void *buffer, unsigned int length ); void write( const void *buffer, unsigned int length ); ! void write( Byte byte ); ! static bool isNamedPropertyControl( Byte control ); private: Index: interfaces.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/interfaces.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** interfaces.h 25 Jun 2005 11:05:55 -0000 1.2 --- interfaces.h 6 Sep 2005 07:31:42 -0000 1.3 *************** *** 20,24 **** virtual void getTestPlans() = 0; ! virtual void runTests( const TestPlan &plan ) = 0; virtual void stopTests() = 0; --- 20,24 ---- virtual void getTestPlans() = 0; ! virtual void runTests( const TestPlans &plan ) = 0; virtual void stopTests() = 0; Index: remoteinterfaces.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/remoteinterfaces.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** remoteinterfaces.h 1 Jul 2005 08:19:37 -0000 1.3 --- remoteinterfaces.h 6 Sep 2005 07:31:42 -0000 1.4 *************** *** 49,65 **** ! class OPENTEST_API MessageSender { public: ! virtual ~MessageSender() { } void sendMessage( const RemoteMessagePtr &message ); }; class OPENTEST_API TestDriverProxy : public TestDriverInterface ! , public MessageSender { public: // overridden from TestDriverInterface --- 49,81 ---- ! class OPENTEST_API MessageTransport { public: ! virtual void sendMessage( const RemoteMessagePtr &message ) = 0; ! ! virtual void dispatchReceivedMessages( RemoteMessageServer &server ) = 0; ! }; ! ! ! class OPENTEST_API MessageServerProxy ! { ! public: ! MessageServerProxy(); ! ! virtual ~MessageServerProxy() { } + void setTransport( MessageTransport &transport ); + void sendMessage( const RemoteMessagePtr &message ); + + private: + MessageTransport *transport_; }; class OPENTEST_API TestDriverProxy : public TestDriverInterface ! , public MessageServerProxy { public: // overridden from TestDriverInterface *************** *** 116,120 **** class OPENTEST_API TestRunnerProxy : public TestRunnerInterface ! , public MessageSender { public: // overridden from TestRunnerInterface --- 132,136 ---- class OPENTEST_API TestRunnerProxy : public TestRunnerInterface ! , public MessageServerProxy { public: // overridden from TestRunnerInterface *************** *** 123,127 **** void getTestPlans(); ! void runTests( const TestPlan &plan ); void stopTests(); --- 139,143 ---- void getTestPlans(); ! void runTests( const TestPlans &plan ); void stopTests(); |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:52
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321/src/cpputtest Modified Files: assertstringtest.cpp main.cpp testfixturetest.cpp Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: testfixturetest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfixturetest.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testfixturetest.cpp 6 Aug 2005 22:24:54 -0000 1.6 --- testfixturetest.cpp 6 Sep 2005 07:31:42 -0000 1.7 *************** *** 242,247 **** { CppUT::TestPtr suite = TestFixtureWithSpecific::suite(); ! CPPUT_ASSERT_EQUAL( 1, dynamic_cast<CppUT::TestSuite &>( *suite ).testCount() ); ! CppUT::TestPtr test = dynamic_cast<CppUT::TestSuite &>( *suite ).testAt(0); CPPUT_ASSERT_EQUAL( "Forced test failure", test->description() ); CPPUT_ASSERT_EQUAL( 30.0, test->timeOut() ); --- 242,247 ---- { CppUT::TestPtr suite = TestFixtureWithSpecific::suite(); ! CPPUT_ASSERT_EQUAL( 1, static_cast<CppUT::TestSuite &>( *suite ).testCount() ); ! CppUT::TestPtr test = static_cast<CppUT::TestSuite &>( *suite ).testAt(0); CPPUT_ASSERT_EQUAL( "Forced test failure", test->description() ); CPPUT_ASSERT_EQUAL( 30.0, test->timeOut() ); Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** main.cpp 7 Aug 2005 08:42:15 -0000 1.22 --- main.cpp 6 Sep 2005 07:31:42 -0000 1.23 *************** *** 8,11 **** --- 8,12 ---- #include "testfixturetest.h" #include "reflectiontest.h" + #include "formattest.h" #include <cpput/lighttestrunner.h> *************** *** 106,109 **** --- 107,111 ---- allSuite->add( AssertEnumTest::suite() ); allSuite->add( ReflectionTest::suite() ); + allSuite->add( FormatTest::suite() ); // allSuite->add( CommandLineOptionsTest::suite() ); Index: assertstringtest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/assertstringtest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** assertstringtest.cpp 23 Feb 2005 23:09:29 -0000 1.4 --- assertstringtest.cpp 6 Sep 2005 07:31:42 -0000 1.5 *************** *** 28,32 **** // Specialize convertToStringImpl function to handle StringWrapper type. ! inline std::string convertToString( const StringWrapper &str ) { return str.str(); --- 28,33 ---- // Specialize convertToStringImpl function to handle StringWrapper type. ! // @todo Does this work on VC6 without putting it in CppUT namespace ! inline std::string getStdString( const StringWrapper &str ) { return str.str(); |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:31:51
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16321 Modified Files: sconstruct Log Message: * fixed compilation without RTTI * revised stringize implementation to allow an additional customization point by overloading toString(). * added test and corrected bug in serialization/packets implementation. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sconstruct 11 Aug 2005 07:18:23 -0000 1.15 --- sconstruct 6 Sep 2005 07:31:42 -0000 1.16 *************** *** 131,133 **** --- 131,134 ---- buildProjectInDirectory( 'examples/checking_assertions' ) buildProjectInDirectory( 'examples/log_demo' ) + buildProjectInDirectory( 'examples/stringize_demo' ) #buildProjectInDirectory( 'src/qttestdriver' ) |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:26:52
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15917/src/cpputtest Modified Files: reflectiontest.cpp Log Message: * fixed compilation when RTTI was disabled. Index: reflectiontest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/reflectiontest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** reflectiontest.cpp 5 Mar 2005 10:15:12 -0000 1.4 --- reflectiontest.cpp 6 Sep 2005 07:26:12 -0000 1.5 *************** *** 4,8 **** --- 4,13 ---- namespace { // anonymous namespace + class Sample1; + } // anonymous namespace + CPPTL_DECLARE_TYPE_AND_PTR_INFO( Sample1 ); // Not required if RTTI are always enabled + + namespace { // anonymous namespace class Sample1 { |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:21:14
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15044/src/cpput Modified Files: assert.cpp Log Message: * added CPPUT_ASSERT_DOUBLES_EQUAL and CPPUT_CHECK_DOUBLES_EQUAL Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** assert.cpp 10 Aug 2005 21:34:29 -0000 1.13 --- assert.cpp 6 Sep 2005 07:21:05 -0000 1.14 *************** *** 95,98 **** --- 95,120 ---- + void + checkDoubleEquals( double expected, + double actual, + double tolerance, + const Message &message ) + { + double diff = expected - actual; + if ( diff < 0 ) + diff = -diff; + if ( diff <= tolerance ) + return; + + Message newMessage( message ); + newMessage.add( translate( "Double equality assertion failed." ) ); + newMessage.add( translate( "Expected: " ) + CppTL::toString( expected ) ); + newMessage.add( translate( "Actual : " ) + CppTL::toString( actual ) ); + newMessage.add( translate( "Tolerance : " ) + CppTL::toString( tolerance ) ); + newMessage.add( translate( "Actual difference : " ) + CppTL::toString( diff ) ); + fail( newMessage ); + } + + } // namespace CppUT |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:18:56
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14732/include/cpput Modified Files: assertenum.h Log Message: * added CPPUT_CHECK* macros for enum based assertions Index: assertenum.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assertenum.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** assertenum.h 26 Feb 2005 11:43:17 -0000 1.7 --- assertenum.h 6 Sep 2005 07:18:48 -0000 1.8 *************** *** 392,395 **** --- 392,413 ---- ::CppUT::checkStlSetEqual + + # define CPPUT_CHECK_SEQUENCE_EQUAL \ + CPPUT_BEGIN_CHECKING_MACRO() \ + ::CppUT::checkSequenceEqual + + # define CPPUT_CHECK_SET_EQUAL \ + CPPUT_BEGIN_CHECKING_MACRO() \ + ::CppUT::checkSetEqual + + + # define CPPUT_CHECK_STL_SEQUENCE_EQUAL \ + CPPUT_BEGIN_CHECKING_MACRO() \ + ::CppUT::checkStlSequenceEqual + + # define CPPUT_CHECK_STL_SET_EQUAL \ + CPPUT_BEGIN_CHECKING_MACRO() \ + ::CppUT::checkStlSetEqual + #endif // CPPUT_ASSERTENUM_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:17:46
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14537/include/cpptl Modified Files: typeinfo.h Log Message: * added CPPUT_ASSERT_DOUBLES_EQUAL and CPPUT_CHECK_DOUBLES_EQUAL Index: typeinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/typeinfo.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** typeinfo.h 3 Mar 2005 08:13:06 -0000 1.1 --- typeinfo.h 6 Sep 2005 07:17:36 -0000 1.2 *************** *** 91,99 **** --- 91,106 ---- }; + #ifdef CPPTL_NO_FUNCTION_TEMPLATE_ORDERING inline TypeId typeId( ... ) + #else + template<class AType> + inline TypeId typeId( Type<AType> ) + #endif { return __error__typeId_function_not_overloaded; } + } // namespace CppTL + #define CPPTL_DECLARE_TYPEINFO( AType ) \ namespace CppTL { \ *************** *** 104,131 **** } ! CPPUTTOOLS_DECLARE_CTTI( char ); ! CPPUTTOOLS_DECLARE_CTTI( signed char ); ! CPPUTTOOLS_DECLARE_CTTI( unsigned char ); ! CPPUTTOOLS_DECLARE_CTTI( short ); ! CPPUTTOOLS_DECLARE_CTTI( unsigned short ); ! CPPUTTOOLS_DECLARE_CTTI( int ); ! CPPUTTOOLS_DECLARE_CTTI( unsigned int ); ! CPPUTTOOLS_DECLARE_CTTI( long ); ! CPPUTTOOLS_DECLARE_CTTI( unsigned long ); ! CPPUTTOOLS_DECLARE_CTTI( float ); ! CPPUTTOOLS_DECLARE_CTTI( double ); ! CPPUTTOOLS_DECLARE_CTTI( long double ); ! CPPUTTOOLS_DECLARE_CTTI( const char * ); ! CPPUTTOOLS_DECLARE_CTTI( const wchar_t * ); ! CPPUTTOOLS_DECLARE_CTTI( std::string ); ! CPPUTTOOLS_DECLARE_CTTI( std::wstring ); ! ! } // namespace CppTL # endif - - - #endif // CPPTL_TYPEINFO_H_INCUDED --- 111,138 ---- } + #define CPPTL_DECLARE_TYPE_AND_PTR_INFO( AType ) \ + CPPTL_DECLARE_TYPEINFO( AType ); \ + CPPTL_DECLARE_TYPEINFO( AType * ) ! CPPTL_DECLARE_TYPEINFO( void ); ! CPPTL_DECLARE_TYPEINFO( bool ); ! CPPTL_DECLARE_TYPEINFO( char ); ! CPPTL_DECLARE_TYPEINFO( signed char ); ! CPPTL_DECLARE_TYPEINFO( unsigned char ); ! CPPTL_DECLARE_TYPEINFO( short ); ! CPPTL_DECLARE_TYPEINFO( unsigned short ); ! CPPTL_DECLARE_TYPEINFO( int ); ! CPPTL_DECLARE_TYPEINFO( unsigned int ); ! CPPTL_DECLARE_TYPEINFO( long ); ! CPPTL_DECLARE_TYPEINFO( unsigned long ); ! CPPTL_DECLARE_TYPEINFO( float ); ! CPPTL_DECLARE_TYPEINFO( double ); ! CPPTL_DECLARE_TYPEINFO( long double ); ! CPPTL_DECLARE_TYPEINFO( const char * ); ! CPPTL_DECLARE_TYPEINFO( const wchar_t * ); ! CPPTL_DECLARE_TYPEINFO( std::string ); ! CPPTL_DECLARE_TYPEINFO( std::wstring ); # endif #endif // CPPTL_TYPEINFO_H_INCUDED |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:17:46
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14537/src/cpputtest Modified Files: enumeratortest.cpp Log Message: * added CPPUT_ASSERT_DOUBLES_EQUAL and CPPUT_CHECK_DOUBLES_EQUAL Index: enumeratortest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/enumeratortest.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** enumeratortest.cpp 23 Feb 2005 23:10:22 -0000 1.7 --- enumeratortest.cpp 6 Sep 2005 07:17:36 -0000 1.8 *************** *** 55,69 **** double v2 = 23.0 / divider; double v3 = 34.0 / divider; CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_EQUAL( v1, e.current() ); ! CPPUT_ASSERT_EQUAL( v1, *e ); ! CPPUT_ASSERT_EQUAL( v1, e.next() ); CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_EQUAL( v2, e.current() ); ! CPPUT_ASSERT_EQUAL( v2, *e++ ); CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_EQUAL( v3, e.current() ); ! CPPUT_ASSERT_EQUAL( v3, *e ); ! CPPUT_ASSERT_EQUAL( v3, e.next() ); checkHasNoMoreElements( e ); } --- 55,70 ---- double v2 = 23.0 / divider; double v3 = 34.0 / divider; + const double tolerance = 0.000001; CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v1, e.current(), tolerance ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v1, *e, tolerance ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v1, e.next(), tolerance ); CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v2, e.current(), tolerance ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v2, *e++, tolerance ); CPPUT_ASSERT_EXPR( e.is_open() ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v3, e.current(), tolerance ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v3, *e, tolerance ); ! CPPUT_ASSERT_DOUBLE_EQUAL( v3, e.next(), tolerance ); checkHasNoMoreElements( e ); } |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:17:46
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14537/include/cpput Modified Files: assert.h Log Message: * added CPPUT_ASSERT_DOUBLES_EQUAL and CPPUT_CHECK_DOUBLES_EQUAL Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** assert.h 10 Aug 2005 21:34:29 -0000 1.12 --- assert.h 6 Sep 2005 07:17:36 -0000 1.13 *************** *** 109,112 **** --- 109,117 ---- } + void CPPUT_API checkDoubleEquals( double expected, + double actual, + double tolerance, + const Message &message = Message() ); + } // namespace CppUT *************** *** 177,180 **** --- 182,193 ---- ::CppUT::checkNotEquals + # define CPPUT_ASSERT_DOUBLE_EQUAL \ + CPPUT_BEGIN_ASSERTION_MACRO() \ + ::CppUT::checkDoubleEquals + + # define CPPUT_CHECK_DOUBLE_EQUAL \ + CPPUT_BEGIN_CHECKING_MACRO() \ + ::CppUT::checkDoubleEquals + # define _CPPUT_ASSERT_THROW_IMPL( assertionType, expression, ExceptionType ) \ do { \ |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:15:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13773/include/cpput Modified Files: testcase.h testvisitor.h Log Message: * added CPPTL_ARRAY_SIZE * added typedef LargestInt and LargestUnsignedInt Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testcase.h 20 Jul 2005 21:06:49 -0000 1.10 --- testcase.h 6 Sep 2005 07:14:49 -0000 1.11 *************** *** 16,23 **** AbstractTestCase( const CppTL::ConstString &name ); - /// @warning: TestInfo::startNewTest() must be called before each test bool runTest(); ! /// @warning: TestInfo::startNewTest() must be called before each test bool runTest( const ExceptionGuard &guardsChain ); --- 16,27 ---- AbstractTestCase( const CppTL::ConstString &name ); bool runTest(); ! /*! \brief Run the test case. ! * Call TestInfo::startNewTest() before starting the test. ! * Then, setUp(), run() and finally tearDown() are called. run() is only called ! * if setUp() did not failed (no assertion or exception failed during setUp() ! * call). ! */ bool runTest( const ExceptionGuard &guardsChain ); Index: testvisitor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testvisitor.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testvisitor.h 15 Nov 2004 08:30:05 -0000 1.2 --- testvisitor.h 6 Sep 2005 07:14:49 -0000 1.3 *************** *** 14,18 **** } ! virtual void visitTestCase( Test &test ) = 0; virtual void visitTestSuite( AbstractTestSuite &suite ) = 0; --- 14,18 ---- } ! virtual void visitTestCase( AbstractTestCase &test ) = 0; virtual void visitTestSuite( AbstractTestSuite &suite ) = 0; |
From: Baptiste L. <bl...@us...> - 2005-09-06 07:14:57
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13773/src/cpputtest Modified Files: mocktestvisitor.h Log Message: * added CPPTL_ARRAY_SIZE * added typedef LargestInt and LargestUnsignedInt Index: mocktestvisitor.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/mocktestvisitor.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mocktestvisitor.h 15 Nov 2004 08:36:24 -0000 1.3 --- mocktestvisitor.h 6 Sep 2005 07:14:49 -0000 1.4 *************** *** 15,19 **** public: // overridden from CppUT::TestVisitor ! void visitTestCase( CppUT::Test &test ) { ++visitTestCaseCount_; --- 15,19 ---- public: // overridden from CppUT::TestVisitor ! void visitTestCase( CppUT::AbstractTestCase &test ) { ++visitTestCaseCount_; |