From: Baptiste L. <bl...@us...> - 2004-08-05 20:52:58
|
Update of /cvsroot/cpptool/CppParser/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20897/src/cpput Modified Files: assert.cpp cpput.dsp cpput.vcproj dllproxy.cpp parametrizedsource.cpp testcontext.cpp testfailureguard.cpp Added Files: tablefixture.cpp Log Message: * upgraded to current cppunit 2 cvs Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/cpput.vcproj,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cpput.vcproj 8 Jun 2004 20:23:23 -0000 1.1.1.1 --- cpput.vcproj 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 129,136 **** Filter=""> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File ! RelativePath=".\SConscript"> </File> <File --- 129,136 ---- Filter=""> <File ! RelativePath=".\SConscript"> </File> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File *************** *** 138,141 **** --- 138,188 ---- </File> </Filter> + <Filter + Name="cpputtools" + Filter=""> + <File + RelativePath="..\..\include\cpputtools\configuration.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\convertor.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\ctti.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\refcountptr.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\value.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\valuebinder.h"> + </File> + <Filter + Name="configuration" + Filter=""> + <File + RelativePath="..\..\include\cpputtools\configuration\description.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\errors.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\forwards.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\parser.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\simplertti.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\validator.h"> + </File> + <File + RelativePath="..\..\include\cpputtools\configuration\values.h"> + </File> + </Filter> + </Filter> <File RelativePath=".\assert.cpp"> *************** *** 148,154 **** </File> <File - RelativePath="..\..\include\cpput\assertexception.h"> - </File> - <File RelativePath="assertstring.cpp"> </File> --- 195,198 ---- *************** *** 223,226 **** --- 267,276 ---- </File> <File + RelativePath="..\..\include\cpput\progresslistener.h"> + </File> + <File + RelativePath="..\..\include\cpput\properties.h"> + </File> + <File RelativePath=".\registry.cpp"> </File> *************** *** 229,233 **** </File> <File ! RelativePath="..\..\include\cpput\result.h"> </File> <File --- 279,286 ---- </File> <File ! RelativePath="..\..\include\cpput\resource.h"> ! </File> ! <File ! RelativePath="..\..\include\cpput\resultexception.h"> </File> <File *************** *** 238,241 **** --- 291,312 ---- </File> <File + RelativePath=".\tablefixture.cpp"> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="TRUE"> + <Tool + Name="VCCLCompilerTool"/> + </FileConfiguration> + </File> + <File + RelativePath="..\..\include\cpput\tablefixture.h"> + </File> + <File RelativePath="..\..\include\cpput\test.h"> </File> *************** *** 253,259 **** </File> <File - RelativePath="..\..\include\cpput\testfailure.h"> - </File> - <File RelativePath=".\testfailureguard.cpp"> </File> --- 324,327 ---- *************** *** 268,271 **** --- 336,345 ---- </File> <File + RelativePath="..\..\include\cpput\testresult.h"> + </File> + <File + RelativePath="..\..\include\cpput\testrunresult.h"> + </File> + <File RelativePath=".\testsuite.cpp"> </File> Index: testcontext.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/testcontext.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testcontext.cpp 8 Jun 2004 20:23:24 -0000 1.1.1.1 --- testcontext.cpp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 1,5 **** #include <cpput/testcontext.h> ! #include <cpput/assertexception.h> ! #include <cpput/testfailure.h> #include <cpput/testlistener.h> #include <cpput/testsuite.h> --- 1,5 ---- #include <cpput/testcontext.h> ! #include <cpput/resultexception.h> ! #include <cpput/testresult.h> #include <cpput/testlistener.h> #include <cpput/testsuite.h> *************** *** 14,17 **** --- 14,18 ---- TestContext::TestContext() + : testSucceeded_( true ) { } *************** *** 22,29 **** --- 23,35 ---- Functor1<TestContext *> runTest ) { + testSucceeded_ = true; + dispatchTestEvent( test, &TestListener::enterTest ); guardsChain_.protect( *this, bind1( runTest, this ), test ); + if ( testSucceeded_ ) + dispatchTestSuccessResult( test ); + dispatchTestEvent( test, &TestListener::exitTest ); } *************** *** 61,65 **** void ! TestContext::appendGuard( const TestFailureGuardPtr &guard ) { guardsChain_.appendGuard( guard ); --- 67,71 ---- void ! TestContext::appendGuard( const TestExceptionGuardPtr &guard ) { guardsChain_.appendGuard( guard ); *************** *** 102,107 **** void ! TestContext::dispatchTestFailure( const TestFailure &failure ) { Listeners::const_iterator it = listeners_.begin(); Listeners::const_iterator itEnd = listeners_.end(); --- 108,116 ---- void ! TestContext::dispatchTestResult( TestResult &result ) { + if ( result.failed() ) + testSucceeded_ = false; + Listeners::const_iterator it = listeners_.begin(); Listeners::const_iterator itEnd = listeners_.end(); *************** *** 109,113 **** { TestListener &listener = **it++; ! listener.testFailed( failure, *this ); } } --- 118,122 ---- { TestListener &listener = **it++; ! listener.processTestResult( result, *this ); } } *************** *** 115,129 **** void ! TestContext::handleAssertion( Test &failedTest, const AssertException &e ) { ! TestFailure failure( failedTest, e.message(), e.location() ); ! dispatchTestFailure( failure ); } void ! TestContext::handleFault( Test &failedTest, const FaultException &e ) { ! TestFailure failure( failedTest, e.message(), e.location() ); ! dispatchTestFailure( failure ); } --- 124,141 ---- void ! TestContext::dispatchTestSuccessResult( Test &test ) { ! Message message; ! message.setStatus( true ); ! TestResult result( test, message ); ! dispatchTestResult( result ); } + void ! TestContext::handleResultException( Test &test, const ResultException &e ) { ! TestResult result( test, e.message(), e.location() ); ! dispatchTestResult( result ); } Index: cpput.dsp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/cpput.dsp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cpput.dsp 8 Jun 2004 20:23:23 -0000 1.1.1.1 --- cpput.dsp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 89,92 **** --- 89,151 ---- # End Source File # End Group + # Begin Group "cpputtools" + + # PROP Default_Filter "" + # Begin Group "configuration" + + # PROP Default_Filter "" + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\description.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\errors.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\forwards.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\parser.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\simplertti.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\validator.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\value.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration\values.h + # End Source File + # End Group + # Begin Source File + + SOURCE=..\..\include\cpputtools\configuration.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\convertor.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\ctti.h + # End Source File + # Begin Source File + + SOURCE=..\..\include\cpputtools\value.h + # End Source File + # End Group + # Begin Group "stuffs" + + # PROP Default_Filter "" # Begin Source File *************** *** 249,252 **** --- 308,312 ---- SOURCE=..\..\include\cpput\typehelper.h # End Source File + # End Group # End Target # End Project Index: dllproxy.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/dllproxy.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dllproxy.cpp 8 Jun 2004 20:23:23 -0000 1.1.1.1 --- dllproxy.cpp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 155,159 **** DllProxy::doLoadLibrary( const std::string &libraryName ) { ! return ::dlopen( libraryName.c_str(), RTLD_NOW ); // RTLD_LAZY ? } --- 155,159 ---- DllProxy::doLoadLibrary( const std::string &libraryName ) { ! return ::dlopen( libraryName.c_str(), RTLD_NOW | RTLD_GLOBAL ); } Index: parametrizedsource.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/parametrizedsource.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** parametrizedsource.cpp 8 Jun 2004 20:23:24 -0000 1.1.1.1 --- parametrizedsource.cpp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 1,4 **** ! # include <cpput/parametrizedsource.h> ! # include <cpput/test.h> namespace CppUT { --- 1,5 ---- ! #include <cpput/parametrizedsource.h> ! #include <cpput/test.h> ! #include <cpput/tablefixture.h> namespace CppUT { --- NEW FILE: tablefixture.cpp --- #include <cpput/tablefixture.h> namespace CppUT { // class TableRow // ////////////////////////////////////////////////////////////////// TableRow::TableRow( const Table &table, int rowIndex ) : table_( table ) , rowIndex_( rowIndex ) { } int TableRow::getCellIndex( const std::string &name ) { return table_.getColumnIndex( name ); } int TableRow::cellCount() { return table_.rowLength( rowIndex ); } bool TableRow::isCellEmpty( int index ) { return table_.isCellEmpty( rowIndex, index ); } int TableRow::cellAsInt( int index ) { return table_.cellAsInt( rowIndex, index ); } unsigned int TableRow::cellAsUnsignedInt( int index ) { return table_.cellAsUnsignedInt( rowIndex, index ); } char TableRow::cellAsChar( int index ) { return table_.cellAsChar( rowIndex, index ); } float TableRow::cellAsFloat( int index ) { return table_.cellAsFloat( rowIndex, index ); } double TableRow::cellAsDouble( int index ) { return table_.cellAsDouble( rowIndex, index ); } std::string TableRow::cellAsString( double index ) { return table_.cellAsInt( rowIndex, index ); } // class TableFixture // ////////////////////////////////////////////////////////////////// void TableFixture::bindAction( const std::string &actionName, ActionFn actionMethod ); void TableFixture::bindInput( const std::string &inputName, const CellBinderPtr &binder ) { binders_[inputName].binder_ = binder; } void TableFixture::bindInput( const std::string &inputName, CharInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<char>( input, &TableRow::cellAsChar ) ) ); } void TableFixture::bindInput( const std::string &inputName, IntInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<int>( input, &TableRow::cellAsInt ) ) ); } void TableFixture::bindInput( const std::string &inputName, UnsignedIntInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<unsigned int>( input, &TableRow::cellAsUnsignedInt ) ) ); } void TableFixture::bindInput( const std::string &inputName, FloatInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<float>( input, &TableRow::cellAsFloat ) ) ); } void TableFixture::bindInput( const std::string &inputName, DoubleInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<double>( input, &TableRow::cellAsDouble ) ) ); } void TableFixture::bindInput( const std::string &inputName, StringInput input ) { bindInput( inputName, CellBinderPtr( new CommonCellBinder<std::string>( input, &TableRow::cellAsString ) ) ); } void TableFixture::beginProcessRow( const TableRow &row ) { Binders::const_iterator it = binders_.begin(); Binders::const_iterator itEnd = binders_.end(); for ( ; it != itEnd; ++it ) { const std::string &name = it->first; int cellIndex = row->getCellIndex( name ); CPPUT_ASSERT( cellIndex != TableRow::invalidRow, "Row contains no column named '" + name + "'." ); it->second->bind( *this, row, cellIndex ); } } void TableFixture::endProcessRow( const TableRow &row ) { } void TableFixture::processRow( const TableRow &row ) { } } // namespace CppUT Index: testfailureguard.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/testfailureguard.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** testfailureguard.cpp 8 Jun 2004 20:23:24 -0000 1.1.1.1 --- testfailureguard.cpp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 1,12 **** #include <cpput/testfailureguard.h> ! #include <cpput/assertexception.h> #include <cpput/typehelper.h> namespace CppUT { ! // class TestFailureGuard // ////////////////////////////////////////////////////////////////// void ! TestFailureGuard::setNextInChain( const TestFailureGuardPtr &deleguate ) { deleguate_ = deleguate; --- 1,12 ---- #include <cpput/testfailureguard.h> ! #include <cpput/resultexception.h> #include <cpput/typehelper.h> namespace CppUT { ! // class TestExceptionGuard // ////////////////////////////////////////////////////////////////// void ! TestExceptionGuard::setNextInChain( const TestExceptionGuardPtr &deleguate ) { deleguate_ = deleguate; *************** *** 15,19 **** bool ! TestFailureGuard::callNextInChain( Context &context ) { return deleguate_->protect( context ); --- 15,19 ---- bool ! TestExceptionGuard::callNextInChain( Context &context ) { return deleguate_->protect( context ); *************** *** 23,33 **** namespace Impl { ! // class StandardTestFailureGuard // ////////////////////////////////////////////////////////////////// // catch CppUT::AssertionException, std::exception, ... ! class CPPUT_API StandardTestFailureGuard : public TestFailureGuard { ! public: // overridden from TestFailureGuard bool protect( Context &context ) { --- 23,33 ---- namespace Impl { ! // class StandardTestExceptionGuard // ////////////////////////////////////////////////////////////////// // catch CppUT::AssertionException, std::exception, ... ! class CPPUT_API StandardTestExceptionGuard : public TestExceptionGuard { ! public: // overridden from TestExceptionGuard bool protect( Context &context ) { *************** *** 36,50 **** return callNextInChain( context ); } ! catch ( const FailuresPropagationException &e ) ! { ! e.handleFailures( context.failureHandler_ ); ! } ! catch ( const FaultException &e ) { ! context.failureHandler_.handleFault( context.protectedTest_, e ); } ! catch ( const AssertException &e ) { ! context.failureHandler_.handleAssertion( context.protectedTest_, e ); } catch ( const std::exception &e ) --- 36,46 ---- return callNextInChain( context ); } ! catch ( const TestResultsPropagationException &e ) { ! e.handleFailures( context.exceptionHandler_ ); } ! catch ( const ResultException &e ) { ! context.exceptionHandler_.handleResultException( context.protectedTest_, e ); } catch ( const std::exception &e ) *************** *** 55,63 **** FaultException fault( message ); ! context.failureHandler_.handleFault( context.protectedTest_, fault ); } catch ( ... ) { Message message( "unexpected unknown exception caught" ); FaultException fault( message ); ! context.failureHandler_.handleFault( context.protectedTest_, fault ); } --- 51,59 ---- FaultException fault( message ); ! context.exceptionHandler_.handleResultException( context.protectedTest_, fault ); } catch ( ... ) { Message message( "unexpected unknown exception caught" ); FaultException fault( message ); ! context.exceptionHandler_.handleResultException( context.protectedTest_, fault ); } *************** *** 67,76 **** ! // class Impl::ExecutorTestFailureGuard // ////////////////////////////////////////////////////////////////// ! class ExecutorTestFailureGuard : public TestFailureGuard { ! public: // overridden from TestFailureGuard bool protect( Context &context ) { --- 63,72 ---- ! // class Impl::ExecutorTestExceptionGuard // ////////////////////////////////////////////////////////////////// ! class ExecutorTestExceptionGuard : public TestExceptionGuard { ! public: // overridden from TestExceptionGuard bool protect( Context &context ) { *************** *** 84,88 **** ! // class TestFailureGuardChain // ////////////////////////////////////////////////////////////////// --- 80,84 ---- ! // class TestExceptionGuardChain // ////////////////////////////////////////////////////////////////// *************** *** 93,100 **** // executor ! TestFailureGuardChain::TestFailureGuardChain() { ! guards_.push_back( TestFailureGuardPtr( new Impl::StandardTestFailureGuard() ) ); ! guards_.push_back( TestFailureGuardPtr( new Impl::ExecutorTestFailureGuard() ) ); connectChain(); } --- 89,96 ---- // executor ! TestExceptionGuardChain::TestExceptionGuardChain() { ! guards_.push_back( TestExceptionGuardPtr( new Impl::StandardTestExceptionGuard() ) ); ! guards_.push_back( TestExceptionGuardPtr( new Impl::ExecutorTestExceptionGuard() ) ); connectChain(); } *************** *** 102,106 **** void ! TestFailureGuardChain::appendGuard( const TestFailureGuardPtr &guard ) { guards_.insert( guards_.end()-1, guard ); --- 98,102 ---- void ! TestExceptionGuardChain::appendGuard( const TestExceptionGuardPtr &guard ) { guards_.insert( guards_.end()-1, guard ); *************** *** 110,114 **** void ! TestFailureGuardChain::removeGuard() { if ( guards_.size() <= 2 ) // should we throw an exception ? --- 106,110 ---- void ! TestExceptionGuardChain::removeGuard() { if ( guards_.size() <= 2 ) // should we throw an exception ? *************** *** 121,129 **** bool ! TestFailureGuardChain::protect( TestFailureHandler &failureHandler, Functor0 test, Test &protectedTest ) { ! TestFailureGuard::Context context( failureHandler, test, protectedTest ); return guards_.front()->protect( context ); } --- 117,125 ---- bool ! TestExceptionGuardChain::protect( TestExceptionHandler &exceptionHandler, Functor0 test, Test &protectedTest ) { ! TestExceptionGuard::Context context( exceptionHandler, test, protectedTest ); return guards_.front()->protect( context ); } *************** *** 131,135 **** void ! TestFailureGuardChain::connectChain() { unsigned int length = guards_.size(); --- 127,131 ---- void ! TestExceptionGuardChain::connectChain() { unsigned int length = guards_.size(); *************** *** 142,148 **** ! // class FailuresPropagationException // ////////////////////////////////////////////////////////////////// ! FailuresPropagationException::FailuresPropagationException() : std::exception( "propagating multiple test failures" ) { --- 138,144 ---- ! // class TestResultsPropagationException // ////////////////////////////////////////////////////////////////// ! TestResultsPropagationException::TestResultsPropagationException() : std::exception( "propagating multiple test failures" ) { *************** *** 151,188 **** void ! FailuresPropagationException::addAssertion( Test &failedTest, ! const AssertException &e ) ! { ! assertions_.push_back( AssertionData( failedTest, e ) ); ! } ! ! ! void ! FailuresPropagationException::addFault( Test &failedTest, ! const FaultException &e ) ! { ! faults_.push_back( FaultData( failedTest, e ) ); ! } ! ! bool ! FailuresPropagationException::hasFailures() const { ! return !assertions_.empty() || !faults_.empty(); } void ! FailuresPropagationException::handleFailures( TestFailureHandler &handler ) const { ! for ( unsigned int index = 0; index < assertions_.size(); ++index ) ! { ! const AssertionData &data = assertions_[index]; ! handler.handleAssertion( data.failedTest_, data.exception_ ); ! } ! ! for ( unsigned int index2 = 0; index2 < faults_.size(); ++index2 ) { ! const FaultData &data = faults_[index2]; ! handler.handleFault( data.failedTest_, data.exception_ ); } } --- 147,164 ---- void ! TestResultsPropagationException::addResult( Test &test, ! const ResultException &e ) { ! results_.push_back( ResultData( test, e ) ); } void ! TestResultsPropagationException::handleFailures( TestExceptionHandler &handler ) const { ! for ( unsigned int index = 0; index < results_.size(); ++index ) { ! const ResultData &data = results_[index]; ! handler.handleResultException( data.test_, data.exception_ ); } } Index: assert.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/cpput/assert.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** assert.cpp 8 Jun 2004 20:23:23 -0000 1.1.1.1 --- assert.cpp 5 Aug 2004 20:52:46 -0000 1.2 *************** *** 1,4 **** # include <cpput/assert.h> ! # include <cpput/assertexception.h> # include <cpput/location.h> # include <cpput/message.h> --- 1,4 ---- # include <cpput/assert.h> ! # include <cpput/resultexception.h> # include <cpput/location.h> # include <cpput/message.h> *************** *** 32,35 **** --- 32,41 ---- } + void + succeed( const Message &message ) + { + throw SuccessException( message, getCheckPointLocation() ); + } + void |