cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 21)
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-07-05 21:17:53
|
Update of /cvsroot/cppunit/cppunit/src/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31780/src/cppunit Modified Files: DllMain.cpp TestResultCollector.cpp Log Message: * include/cppunit/TestResultCollector.h * src/cppunit/TestResultCollector.cpp: fixed memory leak occuring when calling reset(). * src/cppunit/DllMain.cpp: added work-around for mingw compilation for BLENDFUNCTION macro issue when including windows.h. * src/qttestrunner/TestRunnerDlgImpl.cpp: fixed display of multiline messages. * include/cppunit/Portability.h: better integration of compiler output for gcc on Mac OS X with Xcode (contributed by Claus Broch). Index: DllMain.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/cppunit/DllMain.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DllMain.cpp 25 Mar 2002 18:41:39 -0000 1.2 --- DllMain.cpp 5 Jul 2005 21:17:40 -0000 1.3 *************** *** 4,7 **** --- 4,8 ---- #define NOKERNEL #define NOSOUND + #define BLENDFUNCTION void // for mingw & gcc #include <windows.h> Index: TestResultCollector.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/cppunit/TestResultCollector.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestResultCollector.cpp 12 Jul 2002 05:59:57 -0000 1.3 --- TestResultCollector.cpp 5 Jul 2005 21:17:40 -0000 1.4 *************** *** 15,18 **** --- 15,24 ---- TestResultCollector::~TestResultCollector() { + } + + + void + TestResultCollector::freeFailures() + { TestFailures::iterator itFailure = m_failures.begin(); while ( itFailure != m_failures.end() ) *************** *** 27,30 **** --- 33,37 ---- ExclusiveZone zone( m_syncObject ); + freeFailures(); m_testErrors = 0; m_tests.clear(); |
From: Baptiste L. <bl...@us...> - 2005-07-05 21:17:53
|
Update of /cvsroot/cppunit/cppunit/include/cppunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31780/include/cppunit Modified Files: Portability.h TestResultCollector.h Log Message: * include/cppunit/TestResultCollector.h * src/cppunit/TestResultCollector.cpp: fixed memory leak occuring when calling reset(). * src/cppunit/DllMain.cpp: added work-around for mingw compilation for BLENDFUNCTION macro issue when including windows.h. * src/qttestrunner/TestRunnerDlgImpl.cpp: fixed display of multiline messages. * include/cppunit/Portability.h: better integration of compiler output for gcc on Mac OS X with Xcode (contributed by Claus Broch). Index: Portability.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/Portability.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Portability.h 6 Nov 2004 10:42:01 -0000 1.26 --- Portability.h 5 Jul 2005 21:17:40 -0000 1.27 *************** *** 80,85 **** --- 80,90 ---- // See class CompilerOutputter for format. #if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT) + #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) ) + // gcc/Xcode integration on Mac OS X + # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: " + #else # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:" #endif + #endif // If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used, Index: TestResultCollector.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/TestResultCollector.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TestResultCollector.h 13 Jul 2002 10:33:50 -0000 1.10 --- TestResultCollector.h 5 Jul 2005 21:17:40 -0000 1.11 *************** *** 62,65 **** --- 62,67 ---- protected: + void freeFailures(); + Tests m_tests; TestFailures m_failures; |
From: Baptiste L. <bl...@us...> - 2005-07-05 21:17:53
|
Update of /cvsroot/cppunit/cppunit/src/qttestrunner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31780/src/qttestrunner Modified Files: TestRunnerDlgImpl.cpp Log Message: * include/cppunit/TestResultCollector.h * src/cppunit/TestResultCollector.cpp: fixed memory leak occuring when calling reset(). * src/cppunit/DllMain.cpp: added work-around for mingw compilation for BLENDFUNCTION macro issue when including windows.h. * src/qttestrunner/TestRunnerDlgImpl.cpp: fixed display of multiline messages. * include/cppunit/Portability.h: better integration of compiler output for gcc on Mac OS X with Xcode (contributed by Claus Broch). Index: TestRunnerDlgImpl.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit/src/qttestrunner/TestRunnerDlgImpl.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestRunnerDlgImpl.cpp 13 Jul 2002 10:33:50 -0000 1.2 --- TestRunnerDlgImpl.cpp 5 Jul 2005 21:17:41 -0000 1.3 *************** *** 181,184 **** --- 181,185 ---- QListViewItem *item = new TestFailureListViewItem( failure, _listFailures ); + item->setMultiLinesEnabled( true ); item->setText( indexType, failure->isError() ? tr("Error") : tr("Failure") ); |
From: Baptiste L. <bl...@us...> - 2005-07-05 20:56:17
|
Update of /cvsroot/cppunit/cppunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19551 Modified Files: Money.dox Log Message: * fixed a bunch of typos reported by Dave Dibble. Index: Money.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit/doc/Money.dox,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Money.dox 5 Jul 2005 20:14:14 -0000 1.2 --- Money.dox 5 Jul 2005 20:56:09 -0000 1.3 *************** *** 32,36 **** - The resulting libraries can be found in the $CPPUNIT/lib/ directory. ! Once it is done, you need to tell VC++ where are the includes and librairies to use them in other projects. Open the 'Tools/Options...' dialog, and in the 'Directories' tab, select 'include files' in the combo. Add a new entry that --- 32,36 ---- - The resulting libraries can be found in the $CPPUNIT/lib/ directory. ! Once it is done, you need to tell VC++ where are the includes and libraries to use them in other projects. Open the 'Tools/Options...' dialog, and in the 'Directories' tab, select 'include files' in the combo. Add a new entry that *************** *** 94,98 **** \section sec_running_test Running our tests ! We have a main that doesn't do anything. Let's start by adding the mecanics to run our tests (remember, test before you code ;-) ). For this example, we will use a TextTestRunner with the CompilerOutputter for post-build --- 94,98 ---- \section sec_running_test Running our tests ! We have a main that doesn't do anything. Let's start by adding the mechanics to run our tests (remember, test before you code ;-) ). For this example, we will use a TextTestRunner with the CompilerOutputter for post-build *************** *** 155,159 **** - Select 'All configurations' (upper left combo) - In the 'Post-build description', enter 'Unit testing...' ! - In 'post-build command(s)', add a new line: <tt>\$(TargetPath)$</tt> <tt>\$(TargetPath)</tt> expands into the name of your application: --- 155,159 ---- - Select 'All configurations' (upper left combo) - In the 'Post-build description', enter 'Unit testing...' ! - In 'post-build command(s)', add a new line: <tt>\$(TargetPath)</tt> <tt>\$(TargetPath)</tt> expands into the name of your application: *************** *** 167,171 **** step failed. ! Compile. Notices that the application's output is now in the build window. How convenient! --- 167,171 ---- step failed. ! Compile. Notice that the application's output is now in the build window. How convenient! *************** *** 291,295 **** Well, we finally have a good start of what our Money class will ! look likes. Let's start implementing... <tt>Money.h</tt> --- 291,295 ---- Well, we finally have a good start of what our Money class will ! look like. Let's start implementing... <tt>Money.h</tt> *************** *** 332,336 **** indicates that string is not equal to expected value. There is only two ways for this to happen: the member was badly initialized or we ! returned the wrong value. After a quick check, we fin out it is the former. Let's fix that: --- 332,336 ---- indicates that string is not equal to expected value. There is only two ways for this to happen: the member was badly initialized or we ! returned the wrong value. After a quick check, we find out it is the former. Let's fix that: *************** *** 344,348 **** Compile. Our test finally pass! ! Let's add some functionnalities to our Money class. --- 344,348 ---- Compile. Our test finally pass! ! Let's add some functionnality to our Money class. *************** *** 418,422 **** }\endcode ! Compile, run. Finaly got it working! --- 418,422 ---- }\endcode ! Compile, run. Finally got it working! *************** *** 489,493 **** };\endcode ! By convention, you ends the name of such tests with \c 'Throw', that way, you know that the test expect an exception to be thrown. Let's write our test case: --- 489,493 ---- };\endcode ! By convention, you end the name of such tests with \c 'Throw', that way, you know that the test expect an exception to be thrown. Let's write our test case: *************** *** 535,542 **** }\endcode ! Compile. Our test finaly pass! TODO: ! - Copy constructor/Assigment operator - Introducing fixtures - ? --- 535,542 ---- }\endcode ! Compile. Our test finaly passes! TODO: ! - Copy constructor/Assignment operator - Introducing fixtures - ? |
From: Baptiste L. <bl...@us...> - 2005-07-05 20:14:25
|
Update of /cvsroot/cppunit/cppunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31880 Modified Files: Money.dox Log Message: * fixed sample unix sample makefile LDFLAGS duplication * m_currency member initialization Index: Money.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit/doc/Money.dox,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Money.dox 21 Apr 2002 10:57:52 -0000 1.1 --- Money.dox 5 Jul 2005 20:14:14 -0000 1.2 *************** *** 83,88 **** MoneyApp_SOURCES = Money.h MoneyTest.h MoneyTest.cpp MoneyApp.cpp MoneyApp_CXXFLAGS = $(CPPUNIT_CFLAGS) ! MoneyApp_LDFLAGS = $(CPPUNIT_LIBS) ! MoneyApp_LDFLAGS = -ldl\endverbatim --- 83,87 ---- MoneyApp_SOURCES = Money.h MoneyTest.h MoneyTest.cpp MoneyApp.cpp MoneyApp_CXXFLAGS = $(CPPUNIT_CFLAGS) ! MoneyApp_LDFLAGS = $(CPPUNIT_LIBS) -ldl\endverbatim *************** *** 306,310 **** Money( double amount, std::string currency ) : m_amount( amount ) ! , m_currency( m_currency ) { } --- 305,309 ---- Money( double amount, std::string currency ) : m_amount( amount ) ! , m_currency( currency ) { } |
From: Baptiste L. <bl...@us...> - 2005-07-05 20:10:31
|
Update of /cvsroot/cppunit/cppunit/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29992 Modified Files: cookbook.dox Log Message: * fixed 'return wasSuccessful' instead of '!wasSuccessful.' Index: cookbook.dox =================================================================== RCS file: /cvsroot/cppunit/cppunit/doc/cookbook.dox,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cookbook.dox 14 Jun 2005 21:15:15 -0000 1.6 --- cookbook.dox 5 Jul 2005 20:10:19 -0000 1.7 *************** *** 505,509 **** runner.addTest( registry.makeTest() ); bool wasSuccessful = runner.run( "", false ); ! return wasSuccessful; } \endcode --- 505,509 ---- runner.addTest( registry.makeTest() ); bool wasSuccessful = runner.run( "", false ); ! return !wasSuccessful; } \endcode |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:12:55
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23595/src/opentest Modified Files: serializer.cpp Log Message: * Started adding unit tests for Packets. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** serializer.cpp 2 Jul 2005 20:27:36 -0000 1.7 --- serializer.cpp 4 Jul 2005 08:12:33 -0000 1.8 *************** *** 53,59 **** // ////////////////////////////////////////////////////////////////// ! Packets::Packets() : packetsHead_( 0 ) ! , defaultPacketSize_( 16384 ) { } --- 53,59 ---- // ////////////////////////////////////////////////////////////////// ! Packets::Packets( Pos defaultPacketSize ) : packetsHead_( 0 ) ! , defaultPacketSize_( defaultPacketSize ) { } |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:12:55
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23595/src/opentesttest Modified Files: SConscript main.cpp opentest.vcproj Added Files: packetstest.cpp packetstest.h Log Message: * Started adding unit tests for Packets. --- NEW FILE: packetstest.h --- #ifndef OPENTEST_PACKETSTEST_H # define OPENTEST_PACKETSTEST_H # include <cpput/testfixture.h> # include <opentest/serializer.h> # include <cpptl/scopedptr.h> class PacketsTest : public CppUT::TestFixture { CPPUT_TESTSUITE_BEGIN( PacketsTest ); CPPUT_TEST( testDefaultConstructor ); CPPUT_TEST( testSerializeMessage ); CPPUT_TESTSUITE_END(); public: PacketsTest(); virtual ~PacketsTest(); void setUp(); void tearDown(); void testDefaultConstructor(); void testSerializeMessage(); private: typedef OpenTest::Packets::Byte Byte; typedef OpenTest::Packets::Pos Pos; CppTL::ScopedPtr<OpenTest::Packets> packets_; }; #endif // OPENTEST_PACKETSTEST_H --- NEW FILE: packetstest.cpp --- #include "packetstest.h" #include <cpput/assert.h> #include <cpput/assertstring.h> #include <cpptl/scopedptr.h> #include <memory.h> // memcmp, memset class BinaryData { public: BinaryData( const void *data, unsigned int length ) : data_( data ) , length_( length ) { } bool operator ==( const BinaryData &other ) const { return length_ == other.length_ && memcmp( data_, other.data_, length_ ) == 0; } CppTL::ConstString toString() const { const char *begin = static_cast<const char *>( data_ ); return "length = " + CppTL::toString( length_ ) + "\ndata = " + quoteString( CppTL::ConstString( begin, begin + length_ ) ); } const void *data_; unsigned int length_; }; namespace CppUT { // converter for assert equal inline std::string convertToString( const BinaryData &value ) { return value.toString().str(); } } PacketsTest::PacketsTest() { } PacketsTest::~PacketsTest() { } void PacketsTest::setUp() { packets_.reset( new OpenTest::Packets( 4 ) ); } void PacketsTest::tearDown() { packets_.reset(); } void PacketsTest::testDefaultConstructor() { CPPUT_ASSERT_EXPR_FALSE( packets_->hasPendingMessage() ); } void PacketsTest::testSerializeMessage() { 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_->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 ) ); } } Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 2 Jul 2005 20:27:37 -0000 1.2 --- main.cpp 4 Jul 2005 08:12:34 -0000 1.3 *************** *** 3,6 **** --- 3,7 ---- #include <cpput/lighttestrunner.h> #include <stdio.h> + #include "packetstest.h" #include "serializertest.h" *************** *** 65,69 **** CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); ! allSuite->add( SerializerTest::suite() ); CppUT::LightTestRunner runner; --- 66,71 ---- CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); ! allSuite->add( PacketsTest::suite() ); ! //allSuite->add( SerializerTest::suite() ); CppUT::LightTestRunner runner; Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/SConscript,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SConscript 1 Jul 2005 08:19:37 -0000 1.1 --- SConscript 4 Jul 2005 08:12:34 -0000 1.2 *************** *** 2,17 **** buildLibraryUnitTest( env_testing, Split( """ ! assertenumtest.cpp ! assertstringtest.cpp ! enumeratortest.cpp main.cpp - registrytest.cpp - testbasicassertion.cpp - testexceptionguard.cpp - testfunctor.cpp - testfixturetest.cpp - testtestcase.cpp - testtestsuite.cpp - reflectiontest.cpp """ ), ! 'cpputtest' ) --- 2,8 ---- buildLibraryUnitTest( env_testing, Split( """ ! packetstest.cpp ! serializertest.cpp main.cpp """ ), ! 'opentesttest' ) Index: opentest.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/opentest.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opentest.vcproj 1 Jul 2005 08:19:37 -0000 1.1 --- opentest.vcproj 4 Jul 2005 08:12:34 -0000 1.2 *************** *** 55,59 **** <Tool Name="VCPostBuildEventTool" ! Description="Testing cpput library..." CommandLine="$(TargetPath)"/> <Tool --- 55,59 ---- <Tool Name="VCPostBuildEventTool" ! Description="Testing opentest library..." CommandLine="$(TargetPath)"/> <Tool *************** *** 126,130 **** <Tool Name="VCPostBuildEventTool" ! Description="Testing cpput library..." CommandLine="$(TargetPath)"/> <Tool --- 126,130 ---- <Tool Name="VCPostBuildEventTool" ! Description="Testing opentest library..." CommandLine="$(TargetPath)"/> <Tool *************** *** 155,158 **** --- 155,164 ---- </File> <File + RelativePath=".\packetstest.cpp"> + </File> + <File + RelativePath=".\packetstest.h"> + </File> + <File RelativePath=".\serializertest.cpp"> </File> |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:12:54
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23595/src Modified Files: cpput_lib.suo Log Message: * Started adding unit tests for Packets. Index: cpput_lib.suo =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.suo,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 Binary files /tmp/cvs78m6Wo and /tmp/cvsNTnjPw differ |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:12:54
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23595/include/opentest Modified Files: serializer.h Log Message: * Started adding unit tests for Packets. Index: serializer.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/serializer.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** serializer.h 1 Jul 2005 08:19:37 -0000 1.5 --- serializer.h 4 Jul 2005 08:12:32 -0000 1.6 *************** *** 25,29 **** typedef unsigned int Pos; ! Packets(); virtual ~Packets(); --- 25,29 ---- typedef unsigned int Pos; ! Packets( Pos defaultPacketSize = 16384 ); virtual ~Packets(); |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:11:35
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23097/src/cpput Modified Files: SConscript cpput.vcproj lighttestrunner.cpp testrunner.cpp Log Message: * fixed bug in lighttestrunner: called AbstractTestCase::run instead of runTest(). * fixed usage of incomplete SharedPtr in TestRunner. Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/SConscript,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SConscript 6 Mar 2005 18:48:23 -0000 1.6 --- SConscript 4 Jul 2005 08:11:25 -0000 1.7 *************** *** 4,8 **** assert.cpp assertstring.cpp ! exceptionguard.cpp properties.cpp registry.cpp --- 4,9 ---- assert.cpp assertstring.cpp ! exceptionguard.cpp ! lighttestrunner.cpp properties.cpp registry.cpp Index: lighttestrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/lighttestrunner.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lighttestrunner.cpp 2 Jul 2005 20:27:36 -0000 1.1 --- lighttestrunner.cpp 4 Jul 2005 08:11:26 -0000 1.2 *************** *** 64,73 **** printf( "Testing %s : ", getTestPath().c_str() ); TestInfo::startNewTest(); - testCase->run(); - ++testRun_; ! OpenTest::PropertiesAccessor status = result_.accessor()["result"]["status"]; ! bool succeeded = status.getValue( "success", false ).asBool(); ! CppTL::ConstString statusInfo; printf( "%s\n", succeeded ? "OK" : "FAIL" ); if ( !succeeded ) --- 64,70 ---- printf( "Testing %s : ", getTestPath().c_str() ); TestInfo::startNewTest(); ++testRun_; ! bool succeeded = testCase->runTest(); ! printf( "%s\n", succeeded ? "OK" : "FAIL" ); if ( !succeeded ) *************** *** 75,83 **** ++testFailed_; ! CppTL::ConstString resultType = status.getValue( "type", "" ).asString(); ! if ( !resultType.empty() ) ! statusInfo += " (" + resultType + ")"; ! report_ += "-> " + getTestPath() + statusInfo + "\n"; OpenTest::PropertiesAccessor info = result_.accessor(); --- 72,79 ---- ++testFailed_; ! printf( "Result tree: %s\n", result_.toString().c_str() ); ! CppTL::ConstString resultType = TestInfo::faultCount() ? "fault" : "assertion"; ! report_ += "-> " + getTestPath() + " : " + resultType + "\n"; OpenTest::PropertiesAccessor info = result_.accessor(); *************** *** 108,112 **** void LightTestRunner::mergeInResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) { result_[path] = value; --- 104,108 ---- void LightTestRunner::mergeInResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) { result_[path] = value; *************** *** 116,120 **** void LightTestRunner::appendToResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) { result_[path].append( value ); --- 112,116 ---- void LightTestRunner::appendToResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) { result_[path].append( value ); Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testrunner.cpp 2 Jul 2005 20:27:36 -0000 1.10 --- testrunner.cpp 4 Jul 2005 08:11:26 -0000 1.11 *************** *** 5,8 **** --- 5,9 ---- #include <cpput/testsuite.h> #include <cpput/testvisitor.h> + #include <cpptl/scopedptr.h> #include <opentest/properties.h> #include <opentest/testplan.h> *************** *** 125,129 **** { tracker.startTestRun(); ! TestResultUpdaterImplPtr resultUpdater( new TestResultUpdaterImpl( tracker ) ); TestInfo::setTestResultUpdater( *resultUpdater ); --- 126,131 ---- { tracker.startTestRun(); ! CppTL::ScopedPtr<TestResultUpdaterImpl> resultUpdater( ! new TestResultUpdaterImpl( tracker ) ); TestInfo::setTestResultUpdater( *resultUpdater ); Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** cpput.vcproj 2 Jul 2005 20:27:36 -0000 1.34 --- cpput.vcproj 4 Jul 2005 08:11:25 -0000 1.35 *************** *** 229,232 **** --- 229,235 ---- </File> <File + RelativePath="..\..\include\cpptl\scopedptr.h"> + </File> + <File RelativePath="..\..\include\cpptl\sharedptr.h"> </File> |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:11:34
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23097/include/cpput Modified Files: stringize.h testrunner.h Log Message: * fixed bug in lighttestrunner: called AbstractTestCase::run instead of runTest(). * fixed usage of incomplete SharedPtr in TestRunner. Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testrunner.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testrunner.h 2 Jul 2005 20:27:35 -0000 1.4 --- testrunner.h 4 Jul 2005 08:11:25 -0000 1.5 *************** *** 30,34 **** class TestDeclaratorVisitor; class TestResultUpdaterImpl; - typedef CppTL::SharedPtr<TestResultUpdaterImpl> TestResultUpdaterImplPtr; void sendTestStatus( const OpenTest::TestPlanEntry &entry, --- 30,33 ---- *************** *** 37,41 **** AbstractTestSuitePtr suite_; DeclaredTests tests_; - TestResultUpdaterImplPtr resultUpdater_; }; --- 36,39 ---- Index: stringize.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/stringize.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stringize.h 5 Mar 2005 12:43:24 -0000 1.5 --- stringize.h 4 Jul 2005 08:11:25 -0000 1.6 *************** *** 7,11 **** # include <cpptl/stringtools.h> - namespace CppUT { --- 7,10 ---- |
From: Baptiste L. <bl...@us...> - 2005-07-04 08:09:48
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22058/cpptl Modified Files: config.h conststring.h forwards.h sharedptr.h Added Files: scopedptr.h Log Message: * updated forward declarations * ScopedPtr and SharedPtr now use checked delete (check if type is complete) * added checkedDelete() and checkedArrayDelete() to config.h * added ScopedPtr and ScopedArray. Index: config.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/config.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** config.h 24 Jun 2005 19:47:39 -0000 1.18 --- config.h 4 Jul 2005 08:09:29 -0000 1.19 *************** *** 192,195 **** --- 192,205 ---- #define CPPTL_MAX( a, b ) ((a) > (b) ? a : b) + /*! Cause a compilation error if a type is not complete. + * Typical use if before call to delete operator (ScopedPtr, SharedPtr...). + * (based on boost.checked_delete) + */ + #define CPPTL_CHECK_TYPE_COMPLETE( Type ) \ + { \ + typedef char typeMustBeComplete[ sizeof(Type) ? 1 : -1 ]; \ + (void)sizeof(typeMustBeComplete); \ + } + /////////////////////////////////////////////////////////////////////////// *************** *** 251,254 **** --- 261,278 ---- } + template<class T> + void checkedDelete( T *p ) + { + CPPTL_CHECK_TYPE_COMPLETE( T ) + delete p; + } + + template<class T> + void checkedArrayDelete( T *p ) + { + CPPTL_CHECK_TYPE_COMPLETE( T ) + delete[] p; + } + } // namespace CppTL Index: conststring.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** conststring.h 2 Jul 2005 20:27:35 -0000 1.6 --- conststring.h 4 Jul 2005 08:09:30 -0000 1.7 *************** *** 45,49 **** size_type length() const { ! return end_ - begin_; } --- 45,49 ---- size_type length() const { ! return size_type(end_ - begin_); } Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/forwards.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** forwards.h 3 Mar 2005 20:48:54 -0000 1.4 --- forwards.h 4 Jul 2005 08:09:30 -0000 1.5 *************** *** 10,15 **** --- 10,17 ---- // conststring.h + class ConstCharView; class ConstString; class StringBuffer; + class StringConcatenator; // enumerator.h *************** *** 17,24 **** class AnyEnumerator; - // sharedptr.h - template<class PointeeType> - class SharedPtr; - // functor.h class Functor0; --- 19,22 ---- *************** *** 31,34 **** --- 29,42 ---- class Method; + // scopedptr.h + template<class PointeeType> + class ScopedPtr; + template<class PointeeType> + class ScopedArray; + + // sharedptr.h + template<class PointeeType> + class SharedPtr; + Index: sharedptr.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/sharedptr.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sharedptr.h 28 Feb 2005 20:38:21 -0000 1.4 --- sharedptr.h 4 Jul 2005 08:09:30 -0000 1.5 *************** *** 153,157 **** { if ( releaseCount() ) ! delete static_cast<PointeeType *>( p_ ); } --- 153,157 ---- { if ( releaseCount() ) ! checkedDelete( static_cast<PointeeType *>( p_ ) ); } --- NEW FILE: scopedptr.h --- #ifndef CPPTL_SCOPEDPTR_H_INCLUDED # define CPPTL_SCOPEDPTR_H_INCLUDED # include <cpptl/config.h> namespace CppTL { template<class PointeeType> class ScopedPtr : public NonCopyable { public: typedef ScopedPtr<PointeeType> SelfType; ScopedPtr( PointeeType *p = 0 ) : p_( p ) { } ~ScopedPtr() { checkedDelete( p_ ); } void swap( SelfType &other ) { CppTL::swap( p_, other.p_ ); } void reset( PointeeType *p = 0 ) { SelfType temp(p); swap( temp ); } PointeeType *get() const { return p_; } PointeeType &operator *() const { CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempted to use null pointer" ); return *p_; } PointeeType *operator ->() const { CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempted to use null pointer" ); return p_; } operator bool() const { return p_ != 0; } bool operator !() const { return p_ == 0; } private: PointeeType *p_; }; template<class PointeeType> class ScopedArray : public NonCopyable { public: typedef ScopedArray<PointeeType> SelfType; ScopedArray( PointeeType *p = 0 ) : p_( p ) { } ~ScopedArray() { checkedArrayDelete( p_ ); } void swap( SelfType &other ) { CppTL::swap( p_, other.p_ ); } void reset( PointeeType *p = 0 ) { SelfType temp(p); swap( temp ); } PointeeType *get() const { return p_; } PointeeType &operator *() const { CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempted to use null pointer" ); return *p_; } PointeeType *operator ->() const { CPPTL_ASSERT_MESSAGE( p_ != 0, "Attempted to use null pointer" ); return p_; } operator bool() const { return p_ != 0; } bool operator !() const { return p_ == 0; } private: PointeeType *p_; }; } // namespace CppTL #endif // CPPTL_SCOPEDPTR_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:49
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/include/cpptl Modified Files: conststring.h conststring.py stringtools.h Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: conststring.py =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** conststring.py 27 Feb 2005 09:53:20 -0000 1.1 --- conststring.py 2 Jul 2005 20:27:35 -0000 1.2 *************** *** 6,10 **** csz = 'const char *' std_string = 'const std::string &' ! types = [ csz, "const CppTL::ConstString &", "const CppTL::StringConcatenator &", "const CppTL::StringBuffer &" ] for left in xrange(0,len(types)): start = (left == 0) and 1 or 0 --- 6,10 ---- csz = 'const char *' std_string = 'const std::string &' ! types = [ csz, "const CppTL::ConstString &", "const CppTL::StringConcatenator &", "const CppTL::StringBuffer &", "const CppTL::ConstCharView &" ] for left in xrange(0,len(types)): start = (left == 0) and 1 or 0 Index: conststring.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** conststring.h 28 Feb 2005 20:32:35 -0000 1.5 --- conststring.h 2 Jul 2005 20:27:35 -0000 1.6 *************** *** 12,15 **** --- 12,77 ---- namespace CppTL { + class ConstCharView + { + public: + typedef unsigned int size_type; + typedef char value_type; + + ConstCharView() + : begin_( "" ) + , end_( begin_ ) + { + } + + ConstCharView( const value_type *czstr ) + : begin_( czstr ) + { + CPPTL_ASSERT_MESSAGE( czstr != 0, "Invalid zero terminated string" ); + end_ = begin_ + strlen( begin_ ); + } + + ConstCharView( const value_type *cbegin, size_type length ) + : begin_( cbegin ) + , end_( cbegin + length ) + { + } + + ConstCharView( const value_type *cbegin, const value_type *cend ) + : begin_( cbegin ) + , end_( cend ) + { + } + + size_type length() const + { + return end_ - begin_; + } + + size_type size() const + { + return length(); + } + + const value_type *c_str() const + { + return begin_; + } + + const value_type *begin() const + { + return begin_; + } + + const value_type *end() const + { + return end_; + } + + private: + const value_type *begin_; + const value_type *end_; + }; + + class StringConcatenator { *************** *** 26,29 **** --- 88,92 ---- SubString( const ConstString &string ); SubString( const StringBuffer &buffer ); + SubString( const ConstCharView &constCharView ); # ifndef CPPTL_CONSTSTRING_NO_STDSTRING SubString( const std::string &string ); *************** *** 40,43 **** --- 103,107 ---- string, stringBuffer, + constCharView, stdString } kind_; *************** *** 48,51 **** --- 112,116 ---- const ConstString *string_; const StringBuffer *buffer_; + const ConstCharView *constCharView_; # ifndef CPPTL_CONSTSTRING_NO_STDSTRING const std::string *stdString_; *************** *** 169,172 **** --- 234,238 ---- ConstString( const StringConcatenator &concatenator ); ConstString( const StringBuffer &buffer ); + ConstString( const ConstCharView &view ); # ifndef CPPTL_CONSTSTRING_NO_STDSTRING ConstString( const std::string &string ); *************** *** 180,183 **** --- 246,250 ---- ConstString &operator =( const StringConcatenator &concatenator ); ConstString &operator =( const StringBuffer &buffer ); + ConstString &operator =( const ConstCharView &view ); # ifndef CPPTL_CONSTSTRING_NO_STDSTRING ConstString &operator =( const std::string &other ); *************** *** 189,192 **** --- 256,260 ---- ConstString &operator +=( const StringConcatenator &concatenator ); ConstString &operator +=( const StringBuffer &buffer ); + ConstString &operator +=( const ConstCharView &view ); # ifndef CPPTL_CONSTSTRING_NO_STDSTRING ConstString &operator +=( const std::string &string ); *************** *** 257,260 **** --- 325,329 ---- StringBuffer &operator +=( const ConstString &other ); StringBuffer &operator +=( const char *other ); + StringBuffer &operator +=( const ConstCharView &other ); # ifndef CPPTL_CONSTSTRING_NO_STDSTRING StringBuffer &operator +=( const std::string &other ); *************** *** 282,290 **** // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // operator +, in global namespace... // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// - inline CppTL::StringConcatenator operator +( const char *left, const CppTL::ConstString &right ) { --- 351,359 ---- // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// ! // operator +, in global namespace... ! // implementation generated by conststring.py // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// inline CppTL::StringConcatenator operator +( const char *left, const CppTL::ConstString &right ) { *************** *** 302,305 **** --- 371,379 ---- } + inline CppTL::StringConcatenator + operator +( const char *left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + inline CppTL::StringConcatenator *************** *** 323,326 **** --- 397,405 ---- } + inline CppTL::StringConcatenator + operator +( const CppTL::ConstString &left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + inline CppTL::StringConcatenator *************** *** 344,347 **** --- 423,431 ---- } + inline CppTL::StringConcatenator + operator +( const CppTL::StringConcatenator &left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + inline CppTL::StringConcatenator *************** *** 365,368 **** --- 449,483 ---- } + inline CppTL::StringConcatenator + operator +( const CppTL::StringBuffer &left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + + + inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const char *right ) { + return CppTL::StringConcatenator( left, right ); + } + + inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const CppTL::ConstString &right ) { + return CppTL::StringConcatenator( left, right ); + } + + inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const CppTL::StringConcatenator &right ) { + return CppTL::StringConcatenator( left, right ); + } + + inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const CppTL::StringBuffer &right ) { + return CppTL::StringConcatenator( left, right ); + } + + inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + # ifndef CPPTL_CONSTSTRING_NO_STDSTRING *************** *** 383,386 **** --- 498,506 ---- inline CppTL::StringConcatenator + operator +( const CppTL::ConstCharView &left, const std::string &right ) { + return CppTL::StringConcatenator( left, right ); + } + + inline CppTL::StringConcatenator operator +( const std::string &left, const CppTL::ConstString &right ) { return CppTL::StringConcatenator( left, right ); *************** *** 397,400 **** --- 517,525 ---- } + inline CppTL::StringConcatenator + operator +( const std::string &left, const CppTL::ConstCharView &right ) { + return CppTL::StringConcatenator( left, right ); + } + # endif *************** *** 471,474 **** --- 596,608 ---- + inline + StringConcatenator::SubString::SubString( const ConstCharView &view ) + : kind_( constCharView ) + , constCharView_( &view ) + , length_( view.length() ) + { + } + + # ifndef CPPTL_CONSTSTRING_NO_STDSTRING inline *************** *** 501,504 **** --- 635,641 ---- length_ = buffer_->length(); break; + case constCharView: + length_ = constCharView_->length(); + break; # ifndef CPPTL_CONSTSTRING_NO_STDSTRING case stdString: *************** *** 506,511 **** break; # endif ! //default: ! // // unreachable } return length_; --- 643,649 ---- break; # endif ! default: ! CPPTL_ASSERT_MESSAGE( false, "unreachable" ); ! break; } return length_; *************** *** 529,532 **** --- 667,673 ---- memcpy( buffer, buffer_->c_str(), length() ); break; + case constCharView: + memcpy( buffer, constCharView_->begin(), length() ); + break; # ifndef CPPTL_CONSTSTRING_NO_STDSTRING case stdString: *************** *** 534,539 **** break; # endif ! //default: ! // // unreachable } } --- 675,681 ---- break; # endif ! default: ! CPPTL_ASSERT_MESSAGE( false, "unreachable" ); ! break; } } *************** *** 586,589 **** --- 728,741 ---- inline + ConstString::ConstString( const ConstCharView &view ) + : length_( view.length() ) + , buffer_( new value_type[view.length()+1] ) + { + memcpy( buffer_, view.begin(), view.length() ); + buffer_[ length_ ] = 0; + } + + + inline ConstString::ConstString( const StringConcatenator &concatenator ) : length_( concatenator.length() ) *************** *** 673,676 **** --- 825,837 ---- + inline ConstString & + ConstString::operator =( const ConstCharView &view ) + { + ConstString temp( view ); + swap( temp ); + return *this; + } + + # ifndef CPPTL_CONSTSTRING_NO_STDSTRING inline ConstString & *************** *** 712,715 **** --- 873,883 ---- + inline ConstString & + ConstString::operator +=( const ConstCharView &view ) + { + return *this = *this + view; + } + + # ifndef CPPTL_CONSTSTRING_NO_STDSTRING inline ConstString & *************** *** 1005,1008 **** --- 1173,1187 ---- + inline StringBuffer & + StringBuffer::operator +=( const ConstCharView &other ) + { + size_type newLength = length_ + other.length(); + prepareBuffer( newLength ); + memcpy( &buffer_[length_], other.begin(), other.length() ); + truncate(newLength); + return *this; + } + + # ifndef CPPTL_CONSTSTRING_NO_STDSTRING inline StringBuffer & Index: stringtools.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/stringtools.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** stringtools.h 5 Mar 2005 12:19:51 -0000 1.7 --- stringtools.h 2 Jul 2005 20:27:35 -0000 1.8 *************** *** 229,255 **** ! inline CppTL::ConstString ! escapeControl( char c ) { ! if ( c == '\n' ) ! return "\\n"; ! else if ( c == '\t' ) ! return "\\t"; ! else if ( c == '\r' ) ! return "\\r"; ! else if ( c == '\v' ) ! return "\\v"; ! return "\\x" + toHexaString( unsigned(c) ); } ! inline CppTL::ConstString ! escape( char c ) { ! if ( c >=0 && c < 32 ) ! return escapeControl( c ); ! else if ( c == '\\' ) ! return "\\\\"; ! return CppTL::ConstString( &c, 1 ); } --- 229,270 ---- ! inline void ! escapeControl( char c, CppTL::StringBuffer &escaped, const char *newLineEscape = "\\n" ) { ! switch ( c ) ! { ! case '\n': ! escaped += newLineEscape; ! break; ! case '\t': ! escaped += CppTL::ConstCharView( "\\t", 2 ); ! break; ! case '\r': ! escaped += CppTL::ConstCharView( "\\r", 2 ); ! break; ! case '\v': ! escaped += CppTL::ConstCharView( "\\v", 2 ); ! break; ! default: ! { ! char hexa[2]; ! hexa[0] = hexaDigit( (c >> 4) & 15 ); ! hexa[1] = hexaDigit( c & 15 ); ! escaped += CppTL::ConstCharView( "\\x", 2 ) ! + ConstCharView( hexa, hexa + sizeof(hexa) ); ! } ! break; ! } } ! inline void ! escape( char c, CppTL::StringBuffer &escaped, const char *newLineEscape = "\\n" ) { ! if ( c >=0 && c < 32 ) ! escapeControl( c, escaped, newLineEscape ); ! else if ( c == '\\' ) ! escaped += CppTL::ConstCharView( "\\\\", 2 ); ! escaped += CppTL::ConstCharView( &c, 1 ); } *************** *** 257,274 **** // need to expose some of those utility functions... inline CppTL::ConstString ! escape( const CppTL::ConstString &text ) { CppTL::StringBuffer escaped( size_type(text.length() * 1.2) + 64 ); ! CppTL::ConstString::const_iterator it = text.begin(); ! while ( it != text.end() ) ! escaped += escape( *it++ ); ! return escaped; } inline CppTL::ConstString ! quoteString( const CppTL::ConstString &str ) { ! return "\"" + escape(str) + "\""; } --- 272,302 ---- // need to expose some of those utility functions... inline CppTL::ConstString ! escape( const CppTL::ConstString &text, ! CppTL::StringBuffer &escaped, ! const char *newLineEscape = "\\n" ) ! { ! CppTL::ConstString::const_iterator it = text.begin(); ! while ( it != text.end() ) ! escape( *it++, escaped, newLineEscape ); ! return escaped; ! } ! ! ! inline CppTL::ConstString ! quoteString( const CppTL::ConstString &text, ! const char *newLineEscape = "\\n" ) { CppTL::StringBuffer escaped( size_type(text.length() * 1.2) + 64 ); ! escaped += CppTL::ConstCharView( "\"", 1 ); ! escape(text, escaped, newLineEscape ); ! escaped += CppTL::ConstCharView( "\"", 1 ); ! return escaped; } inline CppTL::ConstString ! quoteMultiLineString( const CppTL::ConstString &str ) { ! return quoteString( str, "\\n\n" ); } |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:49
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/src/opentest Modified Files: serializer.cpp Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** serializer.cpp 2 Jul 2005 09:19:06 -0000 1.6 --- serializer.cpp 2 Jul 2005 20:27:36 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- ccPositiveReal = 0x2a, // '*' ccPositiveInteger = 0x2b, // '+' + ccEmptyProperties = 0x2c, // ',' ccNegativeInteger = 0x2d, // '-' ccRealDot = 0x2e, // '.' *************** *** 108,112 **** Packets::endSerializeMessage() { ! CPPTL_ASSERT_MESSAGE( !messages_.empty() && messages_.back().length_ == 0, "No message started." ); messages_.back().length_ = distance( messages_.back().position_, serializePos_ ); --- 109,113 ---- Packets::endSerializeMessage() { ! CPPTL_ASSERT_MESSAGE( !messages_.empty() && messages_.back().length_ > 0, "No message started." ); messages_.back().length_ = distance( messages_.back().position_, serializePos_ ); *************** *** 485,488 **** --- 486,490 ---- indexesByString_[ str ] = index; doSerializeInteger( ccNewDictionnaryEntry, str.length() ); + write( ccString ); write( str.c_str(), str.length() ); } *************** *** 690,693 **** --- 692,696 ---- Stream::operator <<( const Properties &properties ) { + Properties::PropertyEnum enumProperties = properties.properties(); if ( properties.hasList() ) { *************** *** 696,701 **** *this << properties.at( valueIndex ); } - Properties::PropertyEnum enumProperties = properties.properties(); if ( enumProperties.hasNext() ) { --- 699,707 ---- *this << properties.at( valueIndex ); } + else if ( !enumProperties.hasNext() ) + { + write( ccEmptyProperties ); + } if ( enumProperties.hasNext() ) { *************** *** 725,728 **** --- 731,736 ---- { unsigned char control = readNextByte(); + if ( control == ccEmptyProperties ) + return *this; if ( control == ccPropertyList ) { |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:49
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/src/cpput Modified Files: assertstring.cpp cpput.vcproj testinfo.cpp testrunner.cpp Added Files: lighttestrunner.cpp Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: assertstring.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assertstring.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** assertstring.cpp 27 Feb 2005 10:13:37 -0000 1.3 --- assertstring.cpp 2 Jul 2005 20:27:36 -0000 1.4 *************** *** 14,19 **** Message newMessage( message ); newMessage.add( translate( "String does not start with the expected pattern." ) ); ! newMessage.add( translate( "Expected start: " ) + CppTL::quoteString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteString( string ) ); fail( newMessage ); } --- 14,19 ---- Message newMessage( message ); newMessage.add( translate( "String does not start with the expected pattern." ) ); ! newMessage.add( translate( "Expected start: " ) + CppTL::quoteMultiLineString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteMultiLineString( string ) ); fail( newMessage ); } *************** *** 31,36 **** Message newMessage( message ); newMessage.add( translate( "String does not end with the expected pattern." ) ); ! newMessage.add( translate( "Expected end: " ) + CppTL::quoteString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteString( string ) ); fail( newMessage ); } --- 31,36 ---- Message newMessage( message ); newMessage.add( translate( "String does not end with the expected pattern." ) ); ! newMessage.add( translate( "Expected end: " ) + CppTL::quoteMultiLineString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteMultiLineString( string ) ); fail( newMessage ); } *************** *** 47,52 **** Message newMessage( message ); newMessage.add( translate( "String does not contain the expected pattern." ) ); ! newMessage.add( translate( "Expected pattern: " ) + CppTL::quoteString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteString( string ) ); fail( newMessage ); } --- 47,52 ---- Message newMessage( message ); newMessage.add( translate( "String does not contain the expected pattern." ) ); ! newMessage.add( translate( "Expected pattern: " ) + CppTL::quoteMultiLineString( pattern ) ); ! newMessage.add( translate( "Actual string: " ) + CppTL::quoteMultiLineString( string ) ); fail( newMessage ); } *************** *** 76,83 **** newMessage.add( translate( "Strings are not equal." ) ); if ( !common.empty() ) ! newMessage.add( translate( "Common: " ) + CppTL::quoteString( common ) ); newMessage.add( translate( "Divergence position (0 based): " ) + stringize( differenceIndex ) ); ! newMessage.add( translate( "Expected (at divergence): " ) + CppTL::quoteString( expectedTail ) ); ! newMessage.add( translate( "Actual (at divergence): " ) + CppTL::quoteString( actualTail ) ); fail( newMessage ); } --- 76,83 ---- newMessage.add( translate( "Strings are not equal." ) ); if ( !common.empty() ) ! newMessage.add( translate( "Common: " ) + CppTL::quoteMultiLineString( common ) ); newMessage.add( translate( "Divergence position (0 based): " ) + stringize( differenceIndex ) ); ! newMessage.add( translate( "Expected (at divergence): " ) + CppTL::quoteMultiLineString( expectedTail ) ); ! newMessage.add( translate( "Actual (at divergence): " ) + CppTL::quoteMultiLineString( actualTail ) ); fail( newMessage ); } --- NEW FILE: lighttestrunner.cpp --- #include <cpput/lighttestrunner.h> #include <cpput/testcase.h> #include <cpput/testsuite.h> #include <cpptl/sharedptr.h> #include <cpptl/stringtools.h> #include <stdio.h> namespace CppUT { LightTestRunner::LightTestRunner() : testRun_( 0 ) , testFailed_( 0 ) { } LightTestRunner::~LightTestRunner() { } void LightTestRunner::addTest( const TestPtr &test ) { tests_.push_back( test ); } bool LightTestRunner::runAllTests() { TestInfo::setTestResultUpdater( *this ); for ( Tests::iterator it = tests_.begin(); it != tests_.end(); ++it ) runTest( *it ); printf( "Failure report:\n", report_ ); return testFailed_ == 0; } void LightTestRunner::runTest( const TestPtr &test ) { testPath_.push_back( test->name() ); if ( test->isTestCase() ) runTestCase( CppTL::staticPointerCast<AbstractTestCase>( test ) ); else runTestSuite( CppTL::staticPointerCast<TestSuite>( test ) ); testPath_.pop_back(); } void LightTestRunner::runTestSuite( const TestSuitePtr &suite ) { for ( int index =0; index < suite->testCount(); ++index ) runTest( suite->testAt( index ) ); } void LightTestRunner::runTestCase( const AbstractTestCasePtr &testCase ) { result_.clear(); printf( "Testing %s : ", getTestPath().c_str() ); TestInfo::startNewTest(); testCase->run(); ++testRun_; OpenTest::PropertiesAccessor status = result_.accessor()["result"]["status"]; bool succeeded = status.getValue( "success", false ).asBool(); CppTL::ConstString statusInfo; printf( "%s\n", succeeded ? "OK" : "FAIL" ); if ( !succeeded ) { ++testFailed_; CppTL::ConstString resultType = status.getValue( "type", "" ).asString(); if ( !resultType.empty() ) statusInfo += " (" + resultType + ")"; report_ += "-> " + getTestPath() + statusInfo + "\n"; OpenTest::PropertiesAccessor info = result_.accessor(); OpenTest::Properties::ValueEnum enumFaults = info["result/faults"].listValues(); while ( enumFaults.hasNext() ) { OpenTest::Value fault = enumFaults.next(); reportFailure( fault.asProperties(), false ); } OpenTest::Properties::ValueEnum enumAssertions = info["result/assertions"].listValues(); while ( enumAssertions.hasNext() ) { OpenTest::Value assertion = enumAssertions.next(); reportFailure( assertion.asProperties(), true ); } report_ += "\n"; } } void LightTestRunner::mergeInResult( const OpenTest::Properties &result ) { result_.mergeReplacingExisting( result ); } void LightTestRunner::mergeInResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) { result_[path] = value; } void LightTestRunner::appendToResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) { result_[path].append( value ); } CppTL::ConstString LightTestRunner::getTestPath() const { CppTL::StringBuffer buffer; for ( TestPath::const_iterator it = testPath_.begin(); it != testPath_.end(); ++it ) buffer += "/" + *it; return buffer; } void LightTestRunner::reportFailure( const OpenTest::Properties &failure, bool isAssertion ) { if ( failure.has( "location") && failure.has("location/file") ) { report_ += failure["location/file"].asString() + "(" + CppTL::toString( failure["location/line"].asInt() ) + ") : "; } else report_ += "unknwon failure location : "; CppTL::ConstString failureType = failure.getValue( "failure_type", isAssertion ? "assertion" : "fault" ).asString(); report_ += "[failure type: " + failureType + "]\n"; OpenTest::Properties::ValueEnum enumMessages = failure.accessor()["messages"].listValues(); if ( enumMessages.hasNext() ) report_ += "Messages:\n"; while ( enumMessages.hasNext() ) report_ += enumMessages.next().asString() + "\n"; OpenTest::Properties::ValueEnum enumLogs = failure.accessor()["logs"].listValues(); if ( enumLogs.hasNext() ) report_ += "Log:\n"; while ( enumLogs.hasNext() ) report_ += enumLogs.next().asString() + "\n"; report_ += "Specifics:\n" + failure.toString() + "\n"; } } // namespace CppUT Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testrunner.cpp 28 Feb 2005 22:31:37 -0000 1.9 --- testrunner.cpp 2 Jul 2005 20:27:36 -0000 1.10 *************** *** 126,131 **** tracker.startTestRun(); TestResultUpdaterImplPtr resultUpdater( new TestResultUpdaterImpl( tracker ) ); ! TestInfo::setTestResultUpdater( CppTL::staticPointerCast<TestResultUpdater>( ! resultUpdater ) ); OpenTest::TestPlanEntryPtrEnum enumEntries = testPlan.entries(); --- 126,130 ---- tracker.startTestRun(); TestResultUpdaterImplPtr resultUpdater( new TestResultUpdaterImpl( tracker ) ); ! TestInfo::setTestResultUpdater( *resultUpdater ); OpenTest::TestPlanEntryPtrEnum enumEntries = testPlan.entries(); Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** cpput.vcproj 1 Jul 2005 08:19:36 -0000 1.33 --- cpput.vcproj 2 Jul 2005 20:27:36 -0000 1.34 *************** *** 439,442 **** --- 439,448 ---- </File> <File + RelativePath=".\lighttestrunner.cpp"> + </File> + <File + RelativePath="..\..\include\cpput\lighttestrunner.h"> + </File> + <File RelativePath="..\..\include\cpput\message.h"> </File> Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testinfo.cpp 6 Mar 2005 18:49:59 -0000 1.10 --- testinfo.cpp 2 Jul 2005 20:27:36 -0000 1.11 *************** *** 43,46 **** --- 43,47 ---- , assertionCount_( 0 ) , failedAssertionCount_( 0 ) + , updater_( 0 ) { } *************** *** 93,97 **** } ! TestResultUpdaterPtr updater_; OpenTest::Properties result_; OpenTest::Properties assertion_; --- 94,98 ---- } ! TestResultUpdater *updater_; OpenTest::Properties result_; OpenTest::Properties assertion_; *************** *** 121,127 **** } ! void setTestResultUpdater( const TestResultUpdaterPtr &updater ) { ! data().updater_ = updater; } --- 122,128 ---- } ! void setTestResultUpdater( TestResultUpdater &updater ) { ! data().updater_ = &updater; } |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:49
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/src/opentesttest Modified Files: main.cpp serializertest.cpp serializertest.h Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: serializertest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serializertest.h 1 Jul 2005 20:32:04 -0000 1.2 --- serializertest.h 2 Jul 2005 20:27:37 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- CPPUT_TEST( testBool ); CPPUT_TEST( testBasicValue ); + CPPUT_TEST( testBasicProperty ); CPPUT_TESTSUITE_END(); *************** *** 30,33 **** --- 31,35 ---- void testBool(); void testBasicValue(); + void testBasicProperty(); private: Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serializertest.cpp 1 Jul 2005 20:32:04 -0000 1.2 --- serializertest.cpp 2 Jul 2005 20:27:37 -0000 1.3 *************** *** 128,132 **** { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( 123456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); --- 128,132 ---- { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( 323456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); *************** *** 142,143 **** --- 142,173 ---- CPPUT_ASSERT_EQUAL( vString, v5 ); } + + + void + SerializerTest::testBasicProperty() + { + OpenTest::Properties emptyProperties; + OpenTest::Properties properties; + OpenTest::Value vEmpty; + OpenTest::Value vUInt( 323456789 ); + OpenTest::Value vInt( -123456789 ); + OpenTest::Value vDouble( 1.2345678 ); + OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); + properties.append( vEmpty ); + properties.append( vUInt ); + properties.append( vInt ); + properties.append( vDouble ); + properties.append( vString ); + properties["v1"] = vEmpty; + properties["v2"] = vUInt; + properties["v3"] = vInt; + properties["v4"] = vDouble; + properties["v5"] = vString; + + streamOut_ << emptyProperties << properties; + prepareUnserialize(); + OpenTest::Properties p1, p2; + streamIn_ >> p1 >> p2; + CPPUT_ASSERT_EQUAL( emptyProperties, p1 ); + CPPUT_ASSERT_EQUAL( properties, p2 ); + } Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 1 Jul 2005 08:19:37 -0000 1.1 --- main.cpp 2 Jul 2005 20:27:37 -0000 1.2 *************** *** 1,10 **** #include <cpput/test.h> #include <cpput/testsuite.h> #include <stdio.h> #include "serializertest.h" - #include <cpput/testrunner.h> // cppunit2 testrunner for opentest - #include <opentest/texttestdriver.h> - static void displayConfiguration() --- 1,8 ---- #include <cpput/test.h> #include <cpput/testsuite.h> + #include <cpput/lighttestrunner.h> #include <stdio.h> #include "serializertest.h" static void displayConfiguration() *************** *** 69,79 **** allSuite->add( SerializerTest::suite() ); ! CppUT::TestRunner runner; ! CppUT::AbstractTestSuitePtr rootSuite = ! CppTL::staticPointerCast<CppUT::AbstractTestSuite>( allSuite ); ! runner.setRootSuite( rootSuite ); ! ! OpenTest::TextTestDriver driver( runner ); ! bool sucessful = driver.run(); return sucessful ? 0 : 1; } --- 67,75 ---- allSuite->add( SerializerTest::suite() ); ! CppUT::LightTestRunner runner; ! CppUT::TestPtr rootSuite = ! CppTL::staticPointerCast<CppUT::Test>( allSuite ); ! runner.addTest( rootSuite ); ! bool sucessful = runner.runAllTests(); return sucessful ? 0 : 1; } |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:48
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/include/cpput Modified Files: testinfo.h testrunner.h Added Files: lighttestrunner.h Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testinfo.h 1 Mar 2005 19:36:51 -0000 1.9 --- testinfo.h 2 Jul 2005 20:27:35 -0000 1.10 *************** *** 58,62 **** }; ! void CPPUT_API setTestResultUpdater( const TestResultUpdaterPtr &updater ); void CPPUT_API startNewTest(); --- 58,62 ---- }; ! void CPPUT_API setTestResultUpdater( TestResultUpdater &updater ); void CPPUT_API startNewTest(); Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testrunner.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testrunner.h 21 Nov 2004 22:24:45 -0000 1.3 --- testrunner.h 2 Jul 2005 20:27:35 -0000 1.4 *************** *** 37,40 **** --- 37,41 ---- AbstractTestSuitePtr suite_; DeclaredTests tests_; + TestResultUpdaterImplPtr resultUpdater_; }; --- NEW FILE: lighttestrunner.h --- #ifndef CPPUT_LIGHTTESTRUNNER_H_INCLUDED # define CPPUT_LIGHTTESTRUNNER_H_INCLUDED # include <cpput/forwards.h> # include <cpput/testinfo.h> # include <deque> namespace CppUT { /* Lightweight test runner intended for unit testing CppUnit itself * and the open test framework. */ class LightTestRunner : private TestResultUpdater { public: LightTestRunner(); virtual ~LightTestRunner(); void addTest( const TestPtr &test ); bool runAllTests(); private: // overridden from TestResultUpdater virtual void mergeInResult( const OpenTest::Properties &result ); virtual void mergeInResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ); virtual void appendToResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ); private: void runTest( const TestPtr &test ); void runTestSuite( const TestSuitePtr &suite ); void runTestCase( const AbstractTestCasePtr &testCase ); CppTL::ConstString getTestPath() const; void reportFailure( const OpenTest::Properties &failure, bool isAssertion ); typedef std::deque<TestPtr> Tests; Tests tests_; typedef std::deque<CppTL::ConstString> TestPath; TestPath testPath_; CppTL::StringBuffer report_; OpenTest::Properties result_; unsigned int testRun_; unsigned int testFailed_; }; } // namespace CppUT #endif // CPPUT_LIGHTTESTRUNNER_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:48
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/src Modified Files: cpput_lib.suo Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: cpput_lib.suo =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.suo,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 Binary files /tmp/cvsOmaId3 and /tmp/cvsRDfBoy differ |
From: Baptiste L. <bl...@us...> - 2005-07-02 09:19:24
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5777/src/cpput Modified Files: properties.cpp Log Message: Made Value operator == deal nicely with int/unsigned int value comparison. Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** properties.cpp 1 Jul 2005 20:32:04 -0000 1.12 --- properties.cpp 2 Jul 2005 09:19:06 -0000 1.13 *************** *** 464,485 **** Value::operator ==( const Value &other ) const { ! if ( type() != other.type() ) ! return false; switch ( type() ) { case vtNone: ! return true; case vtBoolean: ! return asBool() == other.asBool(); case vtSignedInteger: ! return guts_.intValue_ == other.guts_.intValue_; case vtUnsignedInteger: ! return guts_.uintValue_ == other.guts_.uintValue_; case vtReal: ! return guts_.realValue_ == other.guts_.realValue_; case vtString: ! return asString() == other.asString(); case vtProperties: ! return asProperties() == other.asProperties(); default: // unreachable CPPTL_DEBUG_ASSERT_UNREACHABLE; --- 464,502 ---- Value::operator ==( const Value &other ) const { ! const StorageUInt maxInt = StorageUInt(-1) >> 1; switch ( type() ) { case vtNone: ! return type() == other.type(); case vtBoolean: ! return type() == other.type() ! && asBool() == other.asBool(); case vtSignedInteger: ! { ! if ( type() == other.type() && guts_.intValue_ == other.guts_.intValue_ ) ! return true; ! ! if ( other.type() == vtUnsignedInteger && other.guts_.uintValue_ <= maxInt ) ! return guts_.intValue_ == other.guts_.intValue_; ! return false; ! } case vtUnsignedInteger: ! { ! if ( type() == other.type() && guts_.uintValue_ == other.guts_.uintValue_ ) ! return true; ! ! if ( other.type() == vtSignedInteger && guts_.uintValue_ <= maxInt ) ! return guts_.intValue_ == other.guts_.intValue_; ! return false; ! } case vtReal: ! return type() == other.type() ! && guts_.realValue_ == other.guts_.realValue_; case vtString: ! return type() == other.type() ! && asString() == other.asString(); case vtProperties: ! return type() == other.type() ! && asProperties() == other.asProperties(); default: // unreachable CPPTL_DEBUG_ASSERT_UNREACHABLE; |
From: Baptiste L. <bl...@us...> - 2005-07-02 09:19:24
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5777/src Modified Files: cpput_lib.suo Log Message: Made Value operator == deal nicely with int/unsigned int value comparison. Index: cpput_lib.suo =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.suo,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 Binary files /tmp/cvslZZUVQ and /tmp/cvsARJhZJ differ |
From: Baptiste L. <bl...@us...> - 2005-07-02 09:19:24
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5777/src/opentest Modified Files: serializer.cpp Log Message: Made Value operator == deal nicely with int/unsigned int value comparison. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** serializer.cpp 1 Jul 2005 20:32:04 -0000 1.5 --- serializer.cpp 2 Jul 2005 09:19:06 -0000 1.6 *************** *** 368,372 **** Stream::operator <<( int value ) { ! return *this << CppTL::int64_t( value ); } --- 368,372 ---- Stream::operator <<( int value ) { ! return *this << LargestInt( value ); } |
From: Baptiste L. <bl...@us...> - 2005-07-01 20:32:18
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6317/include/opentest Modified Files: properties.h Log Message: * added more unit tests for serializer * fixed bugs * added strict operator == for Value and Properties. Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** properties.h 24 Jun 2005 19:45:49 -0000 1.12 --- properties.h 1 Jul 2005 20:32:05 -0000 1.13 *************** *** 138,141 **** --- 138,144 ---- CppTL::ConstString toString() const; + bool operator ==( const Value &other ) const; + bool operator !=( const Value &other ) const; + private: *************** *** 208,211 **** --- 211,217 ---- Value &value(); + bool operator ==( const Property &other ) const; + bool operator !=( const Property &other ) const; + private: CppTL::ConstString name_; *************** *** 301,304 **** --- 307,313 ---- CppTL::ConstString toString() const; + bool operator ==( const Properties &other ) const; + bool operator !=( const Properties &other ) const; + private: // Notes: can not use std::map because VC++6 implementation is buggy and cause |
From: Baptiste L. <bl...@us...> - 2005-07-01 20:32:18
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6317/src/opentesttest Modified Files: serializertest.cpp serializertest.h Log Message: * added more unit tests for serializer * fixed bugs * added strict operator == for Value and Properties. Index: serializertest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** serializertest.h 1 Jul 2005 08:19:37 -0000 1.1 --- serializertest.h 1 Jul 2005 20:32:04 -0000 1.2 *************** *** 10,13 **** --- 10,17 ---- CPPUT_TEST( testBasicInteger ); CPPUT_TEST( testMinMaxInteger ); + CPPUT_TEST( testReal ); + CPPUT_TEST( testString ); + CPPUT_TEST( testBool ); + CPPUT_TEST( testBasicValue ); CPPUT_TESTSUITE_END(); *************** *** 22,25 **** --- 26,34 ---- void testBasicInteger(); void testMinMaxInteger(); + void testReal(); + void testString(); + void testBool(); + void testBasicValue(); + private: void prepareSerialize(); Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** serializertest.cpp 1 Jul 2005 08:19:37 -0000 1.1 --- serializertest.cpp 1 Jul 2005 20:32:04 -0000 1.2 *************** *** 1,4 **** --- 1,14 ---- #include "serializertest.h" #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(); + } + + } // namespace CppUT { *************** *** 72,73 **** --- 82,143 ---- CPPUT_ASSERT_EQUAL( minInt, y ); } + + + void + SerializerTest::testReal() + { + double x1 = 1.23456789; + double x2 = 12345678.9; + streamOut_ << x1 << x2; + prepareUnserialize(); + double x, y; + streamIn_ >> x >> y; + CPPUT_ASSERT_EQUAL( x1, x ); + CPPUT_ASSERT_EQUAL( x2, y ); + } + + + void + SerializerTest::testString() + { + OpenTest::String empty; + OpenTest::String text = "abcdefhjk.123798+-,_()[]\"'"; + streamOut_ << text << empty; + prepareUnserialize(); + OpenTest::String s1, s2; + streamIn_ >> s1 >> s2; + CPPUT_ASSERTSTR_EQUAL( text, s1 ); + CPPUT_ASSERTSTR_EQUAL( empty, s2 ); + } + + + void + SerializerTest::testBool() + { + streamOut_ << true << false; + prepareUnserialize(); + bool x, y; + streamIn_ >> x >> y; + CPPUT_ASSERT_EQUAL( true, x ); + CPPUT_ASSERT_EQUAL( false, y ); + } + + + void + SerializerTest::testBasicValue() + { + OpenTest::Value vEmpty; + OpenTest::Value vUInt( 123456789 ); + OpenTest::Value vInt( -123456789 ); + OpenTest::Value vDouble( 1.2345678 ); + OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); + streamOut_ << vEmpty << vUInt << vInt << vDouble << vString; + prepareUnserialize(); + OpenTest::Value v1, v2, v3, v4, v5; + streamIn_ >> v1 >> v2 >> v3 >> v4 >> v5; + CPPUT_ASSERT_EQUAL( vEmpty, v1 ); + CPPUT_ASSERT_EQUAL( vUInt, v2 ); + CPPUT_ASSERT_EQUAL( vInt, v3 ); + CPPUT_ASSERT_EQUAL( vDouble, v4 ); + CPPUT_ASSERT_EQUAL( vString, v5 ); + } |
From: Baptiste L. <bl...@us...> - 2005-07-01 20:32:17
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6317/src Modified Files: cpput_lib.suo Log Message: * added more unit tests for serializer * fixed bugs * added strict operator == for Value and Properties. Index: cpput_lib.suo =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.suo,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 Binary files /tmp/cvsOpnIbC and /tmp/cvsgMS98g differ |