cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 32)
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...> - 2004-11-20 15:47:24
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25665/include/cpput Modified Files: testinfo.h Log Message: * added quick accessor for actual/expected Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testinfo.h 20 Nov 2004 15:06:59 -0000 1.5 --- testinfo.h 20 Nov 2004 15:47:15 -0000 1.6 *************** *** 5,8 **** --- 5,10 ---- # include <opentest/properties.h> + /// @todo find a away to integrate context with multiple thread. + namespace CppUT { *************** *** 76,79 **** --- 78,83 ---- OpenTest::Properties &CPPUT_API currentAssertion(); + OpenTest::Properties &CPPUT_API currentAssertionActual(); + OpenTest::Properties &CPPUT_API currentAssertionExpected(); /// Realize the current assertion. |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:47:24
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25665/src/cpput Modified Files: testinfo.cpp Log Message: * added quick accessor for actual/expected Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testinfo.cpp 20 Nov 2004 15:07:00 -0000 1.5 --- testinfo.cpp 20 Nov 2004 15:47:15 -0000 1.6 *************** *** 181,184 **** --- 181,196 ---- } + + OpenTest::Properties ¤tAssertionActual() + { + return currentAssertion()["actual"].asProperties(); + } + + + OpenTest::Properties ¤tAssertionExpected() + { + return currentAssertion()["expected"].asProperties(); + } + void realizeAssertion() { *************** *** 208,213 **** } - - void appendFaultToResult( const OpenTest::Properties &fault ) { --- 220,223 ---- |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:26:48
|
Update of /cvsroot/cppunit/cppunit2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21663/src Modified Files: cpput_lib.suo Log Message: * Removed TestContext. * TestContext/AbstractTestCase: moved responsibility of running the test to AbstractTestCase. Index: cpput_lib.suo =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput_lib.suo,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 Binary files /tmp/cvs5BFlOi and /tmp/cvsavL3lH differ |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:26:48
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21663/src/cpput Modified Files: cpput.vcproj testcase.cpp testfailureguard.cpp testrunner.cpp testsuite.cpp Removed Files: testcontext.cpp Log Message: * Removed TestContext. * TestContext/AbstractTestCase: moved responsibility of running the test to AbstractTestCase. Index: testsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testsuite.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testsuite.cpp 17 Nov 2004 21:47:10 -0000 1.4 --- testsuite.cpp 20 Nov 2004 15:26:38 -0000 1.5 *************** *** 1,5 **** #include <cpput/testsuite.h> #include <cpput/functor.h> - #include <cpput/testcontext.h> #include <cpput/testvisitor.h> --- 1,4 ---- Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testrunner.cpp 20 Nov 2004 15:07:00 -0000 1.5 --- testrunner.cpp 20 Nov 2004 15:26:38 -0000 1.6 *************** *** 2,6 **** #include <cpput/message.h> #include <cpput/testcase.h> - #include <cpput/testcontext.h> #include <cpput/testinfo.h> #include <cpput/testsuite.h> --- 2,5 ---- *************** *** 136,141 **** const OpenTest::Properties &configuration ) { - TestContext testContext; - tracker.startTestRun(); --- 135,138 ---- *************** *** 169,173 **** { AbstractTestCase &testCase = static_cast<AbstractTestCase &>( test ); ! testContext.run( testCase ); } } --- 166,170 ---- { AbstractTestCase &testCase = static_cast<AbstractTestCase &>( test ); ! testCase.runTest(); } } Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** cpput.vcproj 20 Nov 2004 15:07:00 -0000 1.23 --- cpput.vcproj 20 Nov 2004 15:26:38 -0000 1.24 *************** *** 374,383 **** </File> <File - RelativePath=".\testcontext.cpp"> - </File> - <File - RelativePath="..\..\include\cpput\testcontext.h"> - </File> - <File RelativePath=".\testfailureguard.cpp"> </File> --- 374,377 ---- --- testcontext.cpp DELETED --- Index: testfailureguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testfailureguard.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testfailureguard.cpp 20 Nov 2004 15:07:00 -0000 1.11 --- testfailureguard.cpp 20 Nov 2004 15:26:38 -0000 1.12 *************** *** 135,139 **** bool ! TestExceptionGuardChain::protect( Functor0 test ) { TestExceptionGuard::Context context( test ); --- 135,139 ---- bool ! TestExceptionGuardChain::protect( Functor0 test ) const { TestExceptionGuard::Context context( test ); Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testcase.cpp 20 Nov 2004 15:07:00 -0000 1.5 --- testcase.cpp 20 Nov 2004 15:26:38 -0000 1.6 *************** *** 3,7 **** #include <cpput/functor.h> #include <cpput/message.h> ! #include <cpput/testcontext.h> #include <cpput/testvisitor.h> --- 3,7 ---- #include <cpput/functor.h> #include <cpput/message.h> ! #include <cpput/testfailureguard.h> #include <cpput/testvisitor.h> *************** *** 35,38 **** --- 35,61 ---- + bool + AbstractTestCase::runTest() + { + TestExceptionGuardChain guardsChain; + return runTest( guardsChain ); + } + + bool + AbstractTestCase::runTest( const TestExceptionGuardChain &guardsChain ) + { + bool initialized = guardsChain.protect( makeMemFn0( this, + &AbstractTestCase::setUp ) ); + + if ( initialized ) + { + guardsChain.protect( makeMemFn0( this, &AbstractTestCase::run ) ); + guardsChain.protect( makeMemFn0( this, &AbstractTestCase::tearDown) ); + } + + return !TestInfo::testHasFailed(); + } + + void AbstractTestCase::setUp() |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:26:48
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21663/include/cpput Modified Files: testcase.h testfailureguard.h Removed Files: testcontext.h Log Message: * Removed TestContext. * TestContext/AbstractTestCase: moved responsibility of running the test to AbstractTestCase. Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testcase.h 17 Nov 2004 21:47:09 -0000 1.5 --- testcase.h 20 Nov 2004 15:26:37 -0000 1.6 *************** *** 2,6 **** # define CPPUT_TESTCASE_H_INCLUDED - # include <cpput/config.h> # include <cpput/forwards.h> # include <cpput/functor.h> --- 2,5 ---- *************** *** 18,21 **** --- 17,26 ---- AbstractTestCase( const std::string &name ); + /// @warning: TestInfo::startNewTest() must be called before each test + bool runTest(); + + /// @warning: TestInfo::startNewTest() must be called before each test + bool runTest( const TestExceptionGuardChain &guardsChain ); + public: // overridden from Test void accept( TestVisitor &visitor ); Index: testfailureguard.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfailureguard.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testfailureguard.h 20 Nov 2004 15:06:59 -0000 1.11 --- testfailureguard.h 20 Nov 2004 15:26:37 -0000 1.12 *************** *** 57,61 **** void removeLastGuard(); ! bool protect( Functor0 test ); private: --- 57,61 ---- void removeLastGuard(); ! bool protect( Functor0 test ) const; private: --- testcontext.h DELETED --- |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:26:47
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21663/src/cpputtest Modified Files: testtestcase.cpp testtestsuite.cpp Log Message: * Removed TestContext. * TestContext/AbstractTestCase: moved responsibility of running the test to AbstractTestCase. Index: testtestsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestsuite.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testtestsuite.cpp 20 Nov 2004 15:07:00 -0000 1.5 --- testtestsuite.cpp 20 Nov 2004 15:26:38 -0000 1.6 *************** *** 2,6 **** #include <cpput/testcase.h> #include <cpput/testsuite.h> - #include <cpput/testcontext.h> #include <iostream> #include "mocktestvisitor.h" --- 2,5 ---- Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testtestcase.cpp 20 Nov 2004 15:07:00 -0000 1.8 --- testtestcase.cpp 20 Nov 2004 15:26:38 -0000 1.9 *************** *** 1,5 **** #include <cpput/assert.h> #include <cpput/testcase.h> - #include <cpput/testcontext.h> #include <iostream> #include "mocktestvisitor.h" --- 1,4 ---- *************** *** 80,85 **** { CppUT::TestInfo::ScopedContextOverride contextOverride; ! CppUT::TestContext context; ! success = context.run( static_cast<CppUT::AbstractTestCase &>( test ) ); } return success; --- 79,83 ---- { CppUT::TestInfo::ScopedContextOverride contextOverride; ! success = static_cast<CppUT::AbstractTestCase &>( test ).runTest(); } return success; |
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18083/src/cpput Modified Files: assert.cpp cpput.vcproj properties.cpp testcase.cpp testcontext.cpp testfailureguard.cpp testinfo.cpp testrunner.cpp Log Message: * TestContext: no longer rely on exception to retrieve failure * TestContext: removed TestListener support since everything is handled by TestInfo * TestFailureGuard: modified to report fault using TestInfo instead of exception * TestListener, TestResult, TestRunResult: removed, replaced by TestInfo * TextTestDriver: fixed bug in result merging (not prefixed with "/result"). Still need work to handle assertion and fault reporting. Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** assert.cpp 20 Nov 2004 12:17:51 -0000 1.5 --- assert.cpp 20 Nov 2004 15:07:00 -0000 1.6 *************** *** 1,5 **** # include <cpput/assert.h> - # include <cpput/resultexception.h> - # include <cpput/location.h> # include <cpput/message.h> # include <cpput/stringize.h> --- 1,3 ---- Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testrunner.cpp 20 Nov 2004 12:17:51 -0000 1.4 --- testrunner.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 4,9 **** #include <cpput/testcontext.h> #include <cpput/testinfo.h> - #include <cpput/testlistener.h> - #include <cpput/testresult.h> #include <cpput/testsuite.h> #include <cpput/testvisitor.h> --- 4,7 ---- *************** *** 52,56 **** ! class TestRunner::TestTrackerListener : public TestListener { --- 50,54 ---- ! /* class TestRunner::TestTrackerListener : public TestListener { *************** *** 98,102 **** const OpenTest::TestPlanEntry *testEntry_; }; ! --- 96,100 ---- const OpenTest::TestPlanEntry *testEntry_; }; ! */ *************** *** 138,144 **** const OpenTest::Properties &configuration ) { - TestTrackerListener listener( tracker ); TestContext testContext; - testContext.add( listener ); tracker.startTestRun(); --- 136,140 ---- *************** *** 150,154 **** OpenTest::TestId id = entry.test(); DeclaredTests::const_iterator itTest = tests_.find( id ); - listener.setTestPlanEntry( entry ); tracker.startTest( entry ); TestInfo::startNewTest(); --- 146,149 ---- *************** *** 177,180 **** --- 172,176 ---- } } + sendTestStatus( entry, tracker ); tracker.endTest( entry ); } *************** *** 184,187 **** --- 180,197 ---- + void + TestRunner::sendTestStatus( const OpenTest::TestPlanEntry &entry, + OpenTest::TestRunTracker &tracker ) + { + TestInfo::updateTestStatistics(); + OpenTest::Properties result; + bool success = !TestInfo::testHasFailed(); + result["result/status/success"] = success; + if ( TestInfo::testHasFailed() ) + result["result/status/type"] = TestInfo::faultCount() ? "fault" : "assertion"; + tracker.mergeInTestResult( entry, result ); + } + + } // namespace CppUT Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** cpput.vcproj 20 Nov 2004 12:17:51 -0000 1.22 --- cpput.vcproj 20 Nov 2004 15:07:00 -0000 1.23 *************** *** 347,353 **** </File> <File - RelativePath="..\..\include\cpput\location.h"> - </File> - <File RelativePath="..\..\include\cpput\message.h"> </File> --- 347,350 ---- *************** *** 365,371 **** </File> <File - RelativePath="..\..\include\cpput\resultexception.h"> - </File> - <File RelativePath="..\..\include\cpput\stringize.h"> </File> --- 362,365 ---- *************** *** 401,410 **** </File> <File - RelativePath="..\..\include\cpput\testlistener.h"> - </File> - <File - RelativePath="..\..\include\cpput\testresult.h"> - </File> - <File RelativePath=".\testrunner.cpp"> </File> --- 395,398 ---- *************** *** 413,419 **** </File> <File - RelativePath="..\..\include\cpput\testrunresult.h"> - </File> - <File RelativePath=".\testsuite.cpp"> </File> --- 401,404 ---- Index: testcontext.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcontext.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testcontext.cpp 17 Nov 2004 21:47:10 -0000 1.9 --- testcontext.cpp 20 Nov 2004 15:07:00 -0000 1.10 *************** *** 1,12 **** #include <cpput/testcontext.h> - #include <cpput/resultexception.h> #include <cpput/testcase.h> ! #include <cpput/testlistener.h> ! #include <cpput/testresult.h> ! #include <cpput/testsuite.h> ! #include <cpput/testvisitor.h> ! #include <cpput/message.h> ! #include <cpput/typehelper.h> ! #include <algorithm> --- 1,5 ---- #include <cpput/testcontext.h> #include <cpput/testcase.h> ! #include <cpput/testinfo.h> *************** *** 14,69 **** ! TestContext::TestContext() ! : testSucceeded_( true ) ! { ! } ! ! ! void TestContext::run( AbstractTestCase &test ) { ! testSucceeded_ = true; ! ! bool initialized = protect( test, makeMemFn0( &test, ! &AbstractTestCase::setUp ) ); if ( initialized ) { ! protect( test, makeMemFn0( &test, &AbstractTestCase::run ) ); ! protect( test, makeMemFn0( &test, &AbstractTestCase::tearDown) ); } ! if ( testSucceeded_ ) ! dispatchTestSuccessResult( test ); } bool ! TestContext::protect( Test &test, ! const Functor0 &functor ) ! { ! return guardsChain_.protect( *this, functor, test ); ! } ! ! ! void ! TestContext::add( TestListener &listener ) ! { ! listeners_.push_back( &listener ); ! } ! ! ! void ! TestContext::remove( TestListener &listener ) { ! while ( true ) ! { ! Listeners::iterator it = std::find( listeners_.begin(), ! listeners_.end(), ! &listener ); ! if ( it == listeners_.end() ) ! break; ! listeners_.erase( it ); ! } } --- 7,29 ---- ! bool TestContext::run( AbstractTestCase &test ) { ! bool initialized = protect( makeMemFn0( &test, &AbstractTestCase::setUp ) ); if ( initialized ) { ! protect( makeMemFn0( &test, &AbstractTestCase::run ) ); ! protect( makeMemFn0( &test, &AbstractTestCase::tearDown) ); } ! return !TestInfo::testHasFailed(); } bool ! TestContext::protect( const Functor0 &functor ) { ! return guardsChain_.protect( functor ); } *************** *** 76,116 **** void ! TestContext::removeGuard() ! { ! guardsChain_.removeGuard(); ! } ! ! ! void ! TestContext::dispatchTestResult( TestResult &result ) ! { ! if ( result.failed() ) ! testSucceeded_ = false; ! ! Listeners::const_iterator it = listeners_.begin(); ! Listeners::const_iterator itEnd = listeners_.end(); ! while ( it != itEnd ) ! { ! TestListener &listener = **it++; ! listener.processTestResult( result, *this ); ! } ! } ! ! ! 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 ); } --- 36,42 ---- void ! TestContext::removeLastGuard() { ! guardsChain_.removeLastGuard(); } Index: testfailureguard.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testfailureguard.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testfailureguard.cpp 4 Aug 2004 19:57:33 -0000 1.10 --- testfailureguard.cpp 20 Nov 2004 15:07:00 -0000 1.11 *************** *** 1,4 **** #include <cpput/testfailureguard.h> ! #include <cpput/resultexception.h> #include <cpput/typehelper.h> --- 1,4 ---- #include <cpput/testfailureguard.h> ! #include <cpput/testinfo.h> #include <cpput/typehelper.h> *************** *** 36,63 **** 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 ) { ! Message message( "unexpected exception caught" ); ! message.add( "Type: " + extractObjectType( e, "std::exception" ) ); ! message.add( std::string("What: ") + e.what() ); ! ! 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 ); } return false; } }; --- 36,81 ---- return callNextInChain( context ); } ! catch ( const AbortingAssertionException & ) { ! // Already injected into result } ! #ifndef CPPTL_NO_RTTI ! catch ( const std::exception &e ) { ! addFault( extractObjectType( e, "std::exception" ), e.what() ); ! } ! #else // @todo Need to add catch for all standard derived classes. ! // Warning: => they don't always exist on all platforms. ! catch ( const std::runtime_error &e ) ! { ! addFault( extractObjectType( e, "std::runtime_error" ), e.what() ); } catch ( const std::exception &e ) { ! addFault( extractObjectType( e, "std::exception" ), e.what() ); ! } ! #endif ! catch ( ... ) ! { ! OpenTest::Properties fault; ! fault["type"] = "unexpected exception"; ! fault["message"].append( "caught unexpected exception of unknown type." ); ! TestInfo::appendFaultToResult( fault ); } return false; } + + private: + void addFault( const std::string &exceptionType, + const char *what ) + { + OpenTest::Properties fault; + fault["type"] = "unexpected exception"; + fault["exception_type"] = exceptionType; + fault["message"].append( "caught unexpected exception." ); + fault["message"].append( what ); + TestInfo::appendFaultToResult( fault ); + } }; *************** *** 106,110 **** void ! TestExceptionGuardChain::removeGuard() { if ( guards_.size() <= 2 ) // should we throw an exception ? --- 124,128 ---- void ! TestExceptionGuardChain::removeLastGuard() { if ( guards_.size() <= 2 ) // should we throw an exception ? *************** *** 117,125 **** bool ! TestExceptionGuardChain::protect( TestExceptionHandler &exceptionHandler, ! Functor0 test, ! Test &protectedTest ) { ! TestExceptionGuard::Context context( exceptionHandler, test, protectedTest ); return guards_.front()->protect( context ); } --- 135,141 ---- bool ! TestExceptionGuardChain::protect( Functor0 test ) { ! TestExceptionGuard::Context context( test ); return guards_.front()->protect( context ); } *************** *** 137,167 **** - - // class TestResultsPropagationException - // ////////////////////////////////////////////////////////////////// - TestResultsPropagationException::TestResultsPropagationException() - : std::exception( "propagating multiple test failures" ) - { - } - - - 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_ ); - } - } - - } // namespace CppUT --- 153,155 ---- Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testinfo.cpp 20 Nov 2004 12:17:51 -0000 1.4 --- testinfo.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 56,59 **** --- 56,64 ---- } + void updateTestStatistics() + { + TestInfo::mergeInResult( "statistics/assertions", assertionCount_ ); + } + void newAssertion() { *************** *** 139,142 **** --- 144,152 ---- } + void updateTestStatistics() + { + data().updateTestStatistics(); + } + OpenTest::PropertiesAccessor result() { *************** *** 176,189 **** } ! unsigned int CPPUT_API assertionCount() { return data().assertionCount_; } ! unsigned int CPPUT_API failedAssertionCount() { ! return data().failedAssertionCount_; } void mergeInResult( const OpenTest::Properties &result ) { --- 186,219 ---- } ! unsigned int assertionCount() { return data().assertionCount_; } ! unsigned int failedAssertionCount() { ! return result()["assertions"].listSize(); ! } ! ! unsigned int faultCount() ! { ! return result()["faults"].listSize(); ! } ! ! bool testHasFailed() ! { ! const OpenTest::PropertiesAccessor &accessor = result(); ! return accessor["assertions"].hasList() ! || accessor["faults"].hasList(); } + + + void appendFaultToResult( const OpenTest::Properties &fault ) + { + appendToResult( "faults", fault ); + } + + void mergeInResult( const OpenTest::Properties &result ) { Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** properties.cpp 20 Nov 2004 12:12:01 -0000 1.3 --- properties.cpp 20 Nov 2004 15:07:00 -0000 1.4 *************** *** 697,700 **** --- 697,714 ---- + unsigned int + PropertiesAccessor::listSize() const + { + return properties_ ? properties_->listSize() : 0; + } + + + bool + PropertiesAccessor::hasList() const + { + return properties_ ? properties_->hasList() : false; + } + + // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testcase.cpp 17 Nov 2004 21:47:10 -0000 1.4 --- testcase.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 1,4 **** --- 1,6 ---- #include <cpput/testcase.h> + #include <cpput/assert.h> #include <cpput/functor.h> + #include <cpput/message.h> #include <cpput/testcontext.h> #include <cpput/testvisitor.h> *************** *** 124,128 **** void run() { ! throw CppUT::AssertException( message_ ); } --- 126,130 ---- void run() { ! CPPUT_FAIL( message_ ); } |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:07:11
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18083/src/cpputtest Modified Files: assertstringtest.cpp testbasicassertion.cpp testfunctor.cpp testtestcase.cpp testtestsuite.cpp Log Message: * TestContext: no longer rely on exception to retrieve failure * TestContext: removed TestListener support since everything is handled by TestInfo * TestFailureGuard: modified to report fault using TestInfo instead of exception * TestListener, TestResult, TestRunResult: removed, replaced by TestInfo * TextTestDriver: fixed bug in result merging (not prefixed with "/result"). Still need work to handle assertion and fault reporting. Index: assertstringtest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/assertstringtest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** assertstringtest.cpp 4 Aug 2004 08:01:15 -0000 1.2 --- assertstringtest.cpp 20 Nov 2004 15:07:00 -0000 1.3 *************** *** 1,5 **** #include "assertstringtest.h" #include <cpput/assertstring.h> - #include <cpput/resultexception.h> #include <string.h> // use string.h for easier portability --- 1,4 ---- Index: testbasicassertion.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testbasicassertion.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testbasicassertion.cpp 20 Nov 2004 12:17:52 -0000 1.4 --- testbasicassertion.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <iostream> --- 1,3 ---- Index: testtestsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestsuite.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testtestsuite.cpp 20 Nov 2004 12:17:52 -0000 1.4 --- testtestsuite.cpp 20 Nov 2004 15:07:00 -0000 1.5 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <cpput/testcase.h> #include <cpput/testsuite.h> --- 1,3 ---- Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testtestcase.cpp 20 Nov 2004 12:17:52 -0000 1.7 --- testtestcase.cpp 20 Nov 2004 15:07:00 -0000 1.8 *************** *** 1,5 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> - #include <cpput/testrunresult.h> #include <cpput/testcase.h> #include <cpput/testcontext.h> --- 1,3 ---- *************** *** 77,80 **** --- 75,89 ---- + static bool runTestCase( CppUT::Test &test ) + { + bool success = false; + { + CppUT::TestInfo::ScopedContextOverride contextOverride; + CppUT::TestContext context; + success = context.run( static_cast<CppUT::AbstractTestCase &>( test ) ); + } + return success; + } + static void testCaseSimpleRun() { *************** *** 92,101 **** CPPUT_ASSERT_EQUAL( 0, visitor.visitTestSuiteCount_ ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testCall ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 101,106 ---- CPPUT_ASSERT_EQUAL( 0, visitor.visitTestSuiteCount_ ); ! CPPUT_ASSERT( runTestCase( *test ), "testCaseSimpleRun" ); CPPUT_ASSERT_EQUAL( 1, testCall ); } *************** *** 129,140 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 134,141 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 151,162 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); CPPUT_ASSERT_EQUAL( 0, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 152,159 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 0, testRunCall ); CPPUT_ASSERT_EQUAL( 0, testTearDownCall ); } *************** *** 173,184 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 170,177 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 195,206 **** CPPUT_ASSERT( test->isTestCase() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); - CPPUT_ASSERT_EQUAL( 1, result.failureCount() ); } --- 188,195 ---- CPPUT_ASSERT( test->isTestCase() ); ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, testSetUpCall ); CPPUT_ASSERT_EQUAL( 1, testRunCall ); CPPUT_ASSERT_EQUAL( 1, testTearDownCall ); } *************** *** 217,228 **** CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 1, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 1, fixture->run_ ); CPPUT_ASSERT_EQUAL( 1, fixture->tearDown_ ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 206,214 ---- CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 1, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 1, fixture->run_ ); CPPUT_ASSERT_EQUAL( 1, fixture->tearDown_ ); } *************** *** 238,249 **** CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! CppUT::TestContext context; ! CppUT::TestRunResult result; ! context.add( result ); ! context.run( static_cast<CppUT::AbstractTestCase &>( *test ) ); CPPUT_ASSERT_EQUAL( 0, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 111, fixture->run_ ); CPPUT_ASSERT_EQUAL( 0, fixture->tearDown_ ); - CPPUT_ASSERT_EQUAL( 0, result.failureCount() ); } --- 224,232 ---- CPPUT_ASSERT( test->isTestCase() ); CPPUT_ASSERT_EQUAL( "Test1", test->name() ); ! ! CPPUT_ASSERT_EXPR( runTestCase( *test ) ); CPPUT_ASSERT_EQUAL( 0, fixture->setUp_ ); CPPUT_ASSERT_EQUAL( 111, fixture->run_ ); CPPUT_ASSERT_EQUAL( 0, fixture->tearDown_ ); } Index: testfunctor.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfunctor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testfunctor.cpp 20 Nov 2004 12:17:52 -0000 1.5 --- testfunctor.cpp 20 Nov 2004 15:07:00 -0000 1.6 *************** *** 1,4 **** #include <cpput/assert.h> - #include <cpput/resultexception.h> #include <cpput/functor.h> #include <iostream> --- 1,3 ---- |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:07:11
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18083/include/opentest Modified Files: properties.h texttestdriver.h Log Message: * TestContext: no longer rely on exception to retrieve failure * TestContext: removed TestListener support since everything is handled by TestInfo * TestFailureGuard: modified to report fault using TestInfo instead of exception * TestListener, TestResult, TestRunResult: removed, replaced by TestInfo * TextTestDriver: fixed bug in result merging (not prefixed with "/result"). Still need work to handle assertion and fault reporting. Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** texttestdriver.h 19 Nov 2004 21:39:13 -0000 1.3 --- texttestdriver.h 20 Nov 2004 15:07:00 -0000 1.4 *************** *** 389,393 **** const Properties &result ) { ! results_.back().result().mergeReplacingExisting( result ); } --- 389,393 ---- const Properties &result ) { ! results_.back().result()["result"].asProperties().mergeReplacingExisting( result ); } *************** *** 398,402 **** const Value &value ) { ! results_.back().result()[path] = value; } --- 398,402 ---- const Value &value ) { ! results_.back().result()["result"][path] = value; } *************** *** 407,411 **** const Value &value ) { ! results_.back().result()[path].append( value ); } --- 407,411 ---- const Value &value ) { ! results_.back().result()["result"][path].append( value ); } *************** *** 429,432 **** --- 429,433 ---- std::cout << statusInfo << std::endl; std::cout.flush(); + // std::cout << result.toString() << std::endl; } *************** *** 465,472 **** } - TestResultIndexes::const_iterator failuresIt = failures_.begin(); for ( ; failuresIt != failures_.end(); ++failuresIt ) { const TestResult &testResult = results_.at( *failuresIt ); PropertiesAccessor info = testResult.result().accessor(); --- 466,473 ---- } TestResultIndexes::const_iterator failuresIt = failures_.begin(); for ( ; failuresIt != failures_.end(); ++failuresIt ) { + // @todo update to new result properties structure const TestResult &testResult = results_.at( *failuresIt ); PropertiesAccessor info = testResult.result().accessor(); Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** properties.h 20 Nov 2004 12:12:01 -0000 1.6 --- properties.h 20 Nov 2004 15:06:59 -0000 1.7 *************** *** 253,256 **** --- 253,260 ---- const Value &defaultValue ) const; + unsigned int listSize() const; + + bool hasList() const; + private: const Properties *properties_; |
From: Baptiste L. <bl...@us...> - 2004-11-20 15:07:11
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18083/include/cpput Modified Files: assert.h testcontext.h testfailureguard.h testinfo.h testrunner.h Removed Files: location.h progresslistener.h resultexception.h testlistener.h testresult.h testrunresult.h Log Message: * TestContext: no longer rely on exception to retrieve failure * TestContext: removed TestListener support since everything is handled by TestInfo * TestFailureGuard: modified to report fault using TestInfo instead of exception * TestListener, TestResult, TestRunResult: removed, replaced by TestInfo * TextTestDriver: fixed bug in result merging (not prefixed with "/result"). Still need work to handle assertion and fault reporting. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testinfo.h 20 Nov 2004 12:17:50 -0000 1.4 --- testinfo.h 20 Nov 2004 15:06:59 -0000 1.5 *************** *** 60,63 **** --- 60,66 ---- void CPPUT_API startNewTest(); + // Flush test statistics + void CPPUT_API updateTestStatistics(); + OpenTest::PropertiesAccessor CPPUT_API result(); *************** *** 86,89 **** --- 89,100 ---- unsigned int CPPUT_API failedAssertionCount(); + /// Returns the number of faults that occurred + unsigned int CPPUT_API faultCount(); + + /// Returns true if an assertion failed or a fault occured. + bool CPPUT_API testHasFailed(); + + void CPPUT_API appendFaultToResult( const OpenTest::Properties &fault ); + void CPPUT_API mergeInResult( const OpenTest::Properties &result ); Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testrunner.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testrunner.h 15 Nov 2004 08:30:40 -0000 1.1 --- testrunner.h 20 Nov 2004 15:06:59 -0000 1.2 *************** *** 29,33 **** private: class TestDeclaratorVisitor; ! class TestTrackerListener; AbstractTestSuitePtr suite_; --- 29,35 ---- private: class TestDeclaratorVisitor; ! ! void sendTestStatus( const OpenTest::TestPlanEntry &entry, ! OpenTest::TestRunTracker &tracker ); AbstractTestSuitePtr suite_; --- progresslistener.h DELETED --- --- testlistener.h DELETED --- --- location.h DELETED --- --- testrunresult.h DELETED --- Index: testcontext.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcontext.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testcontext.h 17 Nov 2004 21:47:09 -0000 1.8 --- testcontext.h 20 Nov 2004 15:06:59 -0000 1.9 *************** *** 9,45 **** namespace CppUT { ! class CPPUT_API TestContext : private TestExceptionHandler { public: ! TestContext(); ! ! void run( AbstractTestCase &test ); ! ! void add( TestListener &listener ); ! ! void remove( TestListener &listener ); void appendGuard( const TestExceptionGuardPtr &guard ); ! void removeGuard(); private: ! bool protect( Test &test, ! const Functor0 &functor ); ! ! void dispatchTestResult( TestResult &result ); ! ! void dispatchTestSuccessResult( Test &test ); ! ! // overridden from TestExceptionHandler ! void handleResultException( Test &test, const ResultException &e ); private: TestExceptionGuardChain guardsChain_; - - typedef std::vector<TestListener *> Listeners; - Listeners listeners_; - - bool testSucceeded_; }; --- 9,27 ---- namespace CppUT { ! class CPPUT_API TestContext { public: ! /// Returns \c true if the test was successful, \c false otherwise. ! bool run( AbstractTestCase &test ); void appendGuard( const TestExceptionGuardPtr &guard ); ! void removeLastGuard(); private: ! bool protect( const Functor0 &functor ); private: TestExceptionGuardChain guardsChain_; }; --- testresult.h DELETED --- Index: testfailureguard.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfailureguard.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testfailureguard.h 4 Aug 2004 19:57:12 -0000 1.10 --- testfailureguard.h 20 Nov 2004 15:06:59 -0000 1.11 *************** *** 3,13 **** # include <cpput/forwards.h> - # include <cpput/resultexception.h> # include <cpput/functor.h> # include <deque> - # include <stdexcept> /* Tests setUp(), tearDown(), run() call are protected by a TestExceptionGuardChain. ! * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. * The default guard chain handles AssertionException (thrown when an assertion fails), --- 3,11 ---- # include <cpput/forwards.h> # include <cpput/functor.h> # include <deque> /* Tests setUp(), tearDown(), run() call are protected by a TestExceptionGuardChain. ! * * This guard chain ensures that any exceptions thrown by the call is caught and properly handled. * The default guard chain handles AssertionException (thrown when an assertion fails), *************** *** 20,35 **** namespace CppUT { - // Test fault & assertion failure are forwarded to that handler. - class CPPUT_API TestExceptionHandler - { - public: - virtual ~TestExceptionHandler() - { - } - - virtual void handleResultException( Test &test, const ResultException &e ) = 0; - }; - - class CPPUT_API TestExceptionGuard { --- 18,21 ---- *************** *** 43,58 **** struct Context { ! Context( TestExceptionHandler &exceptionHandler, ! Functor0 test, ! Test &protectedTest ) ! : exceptionHandler_( exceptionHandler ) ! , test_( test ) ! , protectedTest_( protectedTest ) { } - TestExceptionHandler &exceptionHandler_; Functor0 test_; - Test &protectedTest_; }; --- 29,38 ---- struct Context { ! Context( Functor0 test ) ! : test_( test ) { } Functor0 test_; }; *************** *** 75,83 **** void appendGuard( const TestExceptionGuardPtr &guard ); ! void removeGuard(); - bool protect( TestExceptionHandler &exceptionHandler, - Functor0 test, - Test &protectedTest ); private: void connectChain(); --- 55,62 ---- void appendGuard( const TestExceptionGuardPtr &guard ); ! void removeLastGuard(); ! ! bool protect( Functor0 test ); private: void connectChain(); *************** *** 89,132 **** - class CPPUT_API TestResultsPropagationException : public std::exception - { - public: - TestResultsPropagationException(); - - virtual ~TestResultsPropagationException() // CPPUT_STD_EXCEPTION_THROW_CLAUSE - { - } - - void addResult( Test &test, - const ResultException &e ); - - void handleFailures( TestExceptionHandler &handler ) const; - - private: - struct ResultData - { - ResultData( Test &test, const ResultException &e ) - : test_( test ) - , exception_( e ) - { - } - - Test &test_; - ResultException exception_; - }; - - std::deque<ResultData> results_; - }; - - /* - class CPPUT_API ThreadGuard : public TestExceptionGuardChain - { - public: - ThreadGuard(); - ThreadGuard( const TestExceptionGuardChain &other ); - }; - */ - - } // namespace CppUT --- 68,71 ---- Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** assert.h 20 Nov 2004 12:17:50 -0000 1.5 --- assert.h 20 Nov 2004 15:06:59 -0000 1.6 *************** *** 2,8 **** # define CPPUT_ASSERT_H_INCLUDED - # include <cpput/resultexception.h> # include <cpput/equality.h> - # include <cpput/location.h> # include <cpput/message.h> # include <cpput/stringize.h> --- 2,6 ---- *************** *** 13,26 **** namespace CppUT { - class CPPUT_API ExpressionWrapper - { - public: - virtual ~ExpressionWrapper() - { - } - - virtual void run() const = 0; - }; - void CPPUT_API fail( const Message &message = translate( "Assertion failed." ) ); --- 11,14 ---- --- resultexception.h DELETED --- |
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16247/src/cpputtest Modified Files: cpputtest.vcproj testbasicassertion.cpp testfunctor.cpp testtestcase.cpp testtestcontext.cpp testtestrunresult.cpp testtestsuite.cpp Log Message: * moved the assertion implementation to using TestInfo. * added assertion (tested/failed) counter to TestInfo. Index: testtestrunresult.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestrunresult.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testtestrunresult.cpp 4 Aug 2004 08:01:15 -0000 1.4 --- testtestrunresult.cpp 20 Nov 2004 12:17:52 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- try { + CppUT::TestInfo::startNewTest(); CppUT::TestRunResult result; CppUT::TestContext context; *************** *** 86,90 **** CPPUT_ASSERT_FALSE( result.failureAt(3).isAssertionFailure() ); } ! catch ( CppUT::AssertException &e ) { std::cout << "testResult() failed: " << e.what() << std::endl; --- 87,91 ---- CPPUT_ASSERT_FALSE( result.failureAt(3).isAssertionFailure() ); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testResult() failed: " << e.what() << std::endl; Index: testtestsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestsuite.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testtestsuite.cpp 17 Nov 2004 21:47:10 -0000 1.3 --- testtestsuite.cpp 20 Nov 2004 12:17:52 -0000 1.4 *************** *** 34,37 **** --- 34,38 ---- try { + CppUT::TestInfo::startNewTest(); MockTestVisitor visitor; CppUT::TestSuitePtr suite1 = CppUT::makeTestSuite( "Suite 1" ); *************** *** 56,60 **** CPPUT_ASSERT( test2 == suite1->testAt(1), "returned test[1] is not added test" ); } ! catch ( CppUT::AssertException &e ) { std::cout << "testTestsuite() failed: " << e.what() << std::endl; --- 57,61 ---- CPPUT_ASSERT( test2 == suite1->testAt(1), "returned test[1] is not added test" ); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testTestsuite() failed: " << e.what() << std::endl; Index: cpputtest.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/cpputtest.vcproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cpputtest.vcproj 17 Nov 2004 21:47:10 -0000 1.8 --- cpputtest.vcproj 20 Nov 2004 12:17:51 -0000 1.9 *************** *** 209,212 **** --- 209,218 ---- <File RelativePath=".\testbasicassertion.cpp"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + GeneratePreprocessedFile="0"/> + </FileConfiguration> </File> <File Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testtestcase.cpp 17 Nov 2004 21:47:10 -0000 1.6 --- testtestcase.cpp 20 Nov 2004 12:17:52 -0000 1.7 *************** *** 253,256 **** --- 253,257 ---- try { + CppUT::TestInfo::startNewTest(); testCaseSimpleRun(); testCaseSetUpRunTearDown(); *************** *** 261,265 **** testParametrizedFixture(); } ! catch ( CppUT::AssertException &e ) { std::cout << "testTestCase() failed: " << e.what() << std::endl; --- 262,266 ---- testParametrizedFixture(); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testTestCase() failed: " << e.what() << std::endl; Index: testtestcontext.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcontext.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testtestcontext.cpp 4 Aug 2004 19:41:18 -0000 1.8 --- testtestcontext.cpp 20 Nov 2004 12:17:52 -0000 1.9 *************** *** 128,132 **** static void callbackThrowAssertException() { ! throw CppUT::AssertException( "test assertion" ); } --- 128,132 ---- static void callbackThrowAssertException() { ! throw CppUT::AbortingAssertionException( "test assertion" ); } *************** *** 170,174 **** static void callbackTestRunThrowAssertException( CppUT::TestContext * ) { ! throw CppUT::AssertException( "test assertion" ); } --- 170,174 ---- static void callbackTestRunThrowAssertException( CppUT::TestContext * ) { ! throw CppUT::AbortingAssertionException( "test assertion" ); } *************** *** 379,382 **** --- 379,383 ---- try { + CppUT::TestInfo::startNewTest(); testTestContextProtect(); testTestContextProtectTestRun(); *************** *** 385,389 **** testTestContextGuardChain(); } ! catch ( CppUT::AssertException &e ) { std::cout << "testTestContext() failed: " << e.what() << std::endl; --- 386,390 ---- testTestContextGuardChain(); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testTestContext() failed: " << e.what() << std::endl; Index: testbasicassertion.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testbasicassertion.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testbasicassertion.cpp 4 Aug 2004 08:42:27 -0000 1.3 --- testbasicassertion.cpp 20 Nov 2004 12:17:52 -0000 1.4 *************** *** 6,9 **** --- 6,10 ---- static bool testAssertThrow() { + CppUT::TestInfo::startNewTest(); try { *************** *** 16,26 **** } try { CPPUT_ASSERT_THROW( 1234, std::exception ); ! std::cout << "Test 2: expected AssertException not thrown by CPPUT_ASSERT_THROW." << std::endl; return false; } ! catch ( CppUT::AssertException & ) { } --- 17,28 ---- } + CppUT::TestInfo::startNewTest(); try { CPPUT_ASSERT_THROW( 1234, std::exception ); ! std::cout << "Test 2: expected AbortingAssertionException not thrown by CPPUT_ASSERT_THROW." << std::endl; return false; } ! catch ( CppUT::AbortingAssertionException & ) { } *************** *** 32,53 **** static bool testAssertNoThrow() { try { CPPUT_ASSERT_NO_THROW( 1234 ); } ! catch ( CppUT::AssertException &e ) { ! std::cout << "Test 3: CPPUT_ASSERT_NO_THROW should not have thrown an exception." << std::endl << e.what() << std::endl; return false; } try { CPPUT_ASSERT_NO_THROW( throw std::exception( "dummy" ) ); ! std::cout << "Test 4: expected AssertException not thrown by CPPUT_ASSERT_THROW." << std::endl; return false; } ! catch ( CppUT::AssertException & ) { } --- 34,59 ---- static bool testAssertNoThrow() { + CppUT::TestInfo::startNewTest(); try { CPPUT_ASSERT_NO_THROW( 1234 ); } ! catch ( CppUT::AbortingAssertionException &e ) { ! std::cout << "Test 3: CPPUT_ASSERT_NO_THROW should not " ! "have thrown an exception." << std::endl << e.what() << std::endl; return false; } + CppUT::TestInfo::startNewTest(); try { CPPUT_ASSERT_NO_THROW( throw std::exception( "dummy" ) ); ! std::cout << "Test 4: expected AbortingAssertionException " ! "not thrown by CPPUT_ASSERT_THROW." << std::endl; return false; } ! catch ( CppUT::AbortingAssertionException & ) { } *************** *** 71,79 **** return false; try { - CPPUT_ASSERT_THROW( CPPUT_SUCCEED( CppUT::Message( "warning..." ) ), - CppUT::SuccessException ); - // CPPUT_ASSERT CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT( true ) ); --- 77,83 ---- return false; + CppUT::TestInfo::startNewTest(); try { // CPPUT_ASSERT CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT( true ) ); *************** *** 81,85 **** CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT( true, "should pass" ) ); ! CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT( false, "should throw AssertException" ) ); CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_EXPR( true ) ); --- 85,90 ---- CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT( true, "should pass" ) ); ! CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT( false, ! "should throw AbortingAssertionException" ) ); CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_EXPR( true ) ); *************** *** 91,95 **** CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_FALSE( false, "should pass" ) ); ! CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT_FALSE( true, "should throw AssertException" ) ); CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_EXPR_FALSE( false ) ); --- 96,101 ---- CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_FALSE( false, "should pass" ) ); ! CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT_FALSE( true, ! "should throw AbortingAssertionException" ) ); CPPUT_ASSERT_ASSERTION_PASS( CPPUT_ASSERT_EXPR_FALSE( false ) ); *************** *** 120,124 **** CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT_NOT_EQUAL( "abc", std::string("abc") ) ); } ! catch ( CppUT::AssertException &e ) { std::cout << "testAssertions() failed: " << e.what() << std::endl; --- 126,130 ---- CPPUT_ASSERT_ASSERTION_FAIL( CPPUT_ASSERT_NOT_EQUAL( "abc", std::string("abc") ) ); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testAssertions() failed: " << e.what() << std::endl; Index: testfunctor.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfunctor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** testfunctor.cpp 17 Nov 2004 08:59:34 -0000 1.4 --- testfunctor.cpp 20 Nov 2004 12:17:52 -0000 1.5 *************** *** 194,206 **** try { testFunctor(); testFunctor1(); ! testConstReferenceSupport(); ! testReferenceSupport(); testBindValue(); testBindConstRef(); testBindRef(); } ! catch ( CppUT::AssertException &e ) { std::cout << "testTestContext() failed: " << e.what() << std::endl; --- 194,207 ---- try { + CppUT::TestInfo::startNewTest(); testFunctor(); testFunctor1(); ! testConstReferenceSupport(); ! testReferenceSupport(); testBindValue(); testBindConstRef(); testBindRef(); } ! catch ( CppUT::AbortingAssertionException &e ) { std::cout << "testTestContext() failed: " << e.what() << std::endl; |
From: Baptiste L. <bl...@us...> - 2004-11-20 12:18:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16247/include/cpput Modified Files: assert.h testinfo.h Log Message: * moved the assertion implementation to using TestInfo. * added assertion (tested/failed) counter to TestInfo. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testinfo.h 19 Nov 2004 23:05:20 -0000 1.3 --- testinfo.h 20 Nov 2004 12:17:50 -0000 1.4 *************** *** 45,48 **** --- 45,59 ---- namespace TestInfo { + class CPPUT_API ScopedContextOverride + { + public: + ScopedContextOverride(); + + ~ScopedContextOverride(); + + private: + TestInfoDataPtr context_; + }; + void CPPUT_API setTestResultUpdater( const TestResultUpdaterPtr &updater ); *************** *** 69,72 **** --- 80,89 ---- void CPPUT_API realizeAssertion(); + /// Returns the number of assertions done by the test + unsigned int CPPUT_API assertionCount(); + + /// Returns the number of assertions that failed done by the test + unsigned int CPPUT_API failedAssertionCount(); + void CPPUT_API mergeInResult( const OpenTest::Properties &result ); Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** assert.h 4 Aug 2004 08:42:22 -0000 1.4 --- assert.h 20 Nov 2004 12:17:50 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- # include <cpput/message.h> # include <cpput/stringize.h> + # include <cpput/testinfo.h> # include <cpput/translate.h> # include <cpput/typehelper.h> *************** *** 12,23 **** namespace CppUT { ! void CPPUT_API setCheckPointLocation( const Location &location ); ! Location CPPUT_API getCheckPointLocation(); void CPPUT_API fail( const Message &message = translate( "Assertion failed." ) ); - void CPPUT_API succeed( const Message &message ); - void CPPUT_API checkTrue( bool shouldBeTrue, const Message &message = Message() ); --- 13,28 ---- namespace CppUT { ! class CPPUT_API ExpressionWrapper ! { ! public: ! virtual ~ExpressionWrapper() ! { ! } ! virtual void run() const = 0; ! }; void CPPUT_API fail( const Message &message = translate( "Assertion failed." ) ); void CPPUT_API checkTrue( bool shouldBeTrue, const Message &message = Message() ); *************** *** 26,29 **** --- 31,40 ---- const Message &message = Message() ); + void CPPUT_API checkAssertionFail( bool assertionFailed, + const Message &message = Message() ); + + void CPPUT_API checkAssertionPass( bool assertionFailed, + const Message &message = Message() ); + Message CPPUT_API buildEqualityFailedMessage( const std::string &expected, const std::string &actual, *************** *** 113,118 **** ! # define CPPUT_CHECK_POINT() \ ! ::CppUT::setCheckPointLocation( CPPUT_MAKE_CURRENT_LOCATION() ) # define CPPUT_BEGIN_ASSERTION_MACRO() \ --- 124,130 ---- ! # define CPPUT_CHECK_POINT() \ ! ::CppUT::TestInfo::newAssertion(), \ ! ::CppUT::TestInfo::setAssertionLocation( __FILE__, __LINE__ ) # define CPPUT_BEGIN_ASSERTION_MACRO() \ *************** *** 125,132 **** ::CppUT::fail - # define CPPUT_SUCCEED \ - CPPUT_BEGIN_ASSERTION_MACRO() \ - ::CppUT::succeed - # define CPPUT_ASSERT \ CPPUT_BEGIN_ASSERTION_MACRO() \ --- 137,140 ---- *************** *** 181,189 **** } # define CPPUT_ASSERT_ASSERTION_FAIL( assertion ) \ ! CPPUT_ASSERT_THROW( assertion, ::CppUT::AssertException ) # define CPPUT_ASSERT_ASSERTION_PASS( assertion ) \ ! CPPUT_ASSERT_NO_THROW( assertion ) --- 189,251 ---- } + # define CPPUT_EXPRESSION_WRAPPER( expression, variable ) \ + class Wrapper : public ::CppUT::ExpressionWrapper \ + { \ + public: /* overridden from ExpressionWrapper */ \ + void run() const \ + { \ + expression; \ + } \ + } variable + + // Notes: implementing that assertion checking is a bit tricky since all the state + // about the current test/assertions is stored in a "static" and + // we don't want the tested assertion to polute the test result + // of the current test. + // TestInfo::ScopedContextOverride is used to create a temporary + // context for the tested assertion. After the assertion, the + // result of the assertion (did it failed), and the test result + // properties are captured for later introspection. + # define CPPUT_ASSERT_ASSERTION_FAIL_MESSAGE( assertion, message ) \ + { \ + CPPUT_CHECK_POINT(); \ + OpenTest::Properties result; \ + bool assertionFailed = false; \ + { \ + ::CppUT::TestInfo::ScopedContextOverride contextSwitch; \ + try { \ + assertion; \ + } catch ( const ::CppUT::AbortingAssertionException & ) { \ + } \ + assertionFailed = ::CppUT::TestInfo::failedAssertionCount() != 0; \ + if ( ::CppUT::TestInfo::result().isValid() ) \ + result = ::CppUT::TestInfo::result().properties(); \ + } \ + ::CppUT::checkAssertionFail( assertionFailed, message ); \ + } + # define CPPUT_ASSERT_ASSERTION_FAIL( assertion ) \ ! CPPUT_ASSERT_ASSERTION_FAIL_MESSAGE( assertion, ::CppUT::Message() ) ! ! # define CPPUT_ASSERT_ASSERTION_PASS_MESSAGE( assertion, message ) \ ! { \ ! CPPUT_CHECK_POINT(); \ ! OpenTest::Properties result; \ ! bool assertionFailed = false; \ ! { \ ! ::CppUT::TestInfo::ScopedContextOverride contextSwitch; \ ! try { \ ! assertion; \ ! } catch ( const ::CppUT::AbortingAssertionException & ) { \ ! } \ ! assertionFailed = ::CppUT::TestInfo::failedAssertionCount() != 0; \ ! if ( ::CppUT::TestInfo::result().isValid() ) \ ! result = ::CppUT::TestInfo::result().properties(); \ ! } \ ! ::CppUT::checkAssertionPass( assertionFailed, message ); \ ! } # define CPPUT_ASSERT_ASSERTION_PASS( assertion ) \ ! CPPUT_ASSERT_ASSERTION_PASS_MESSAGE( assertion, ::CppUT::Message() ) |
From: Baptiste L. <bl...@us...> - 2004-11-20 12:18:02
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16247/src/cpput Modified Files: assert.cpp cpput.vcproj testinfo.cpp testrunner.cpp Log Message: * moved the assertion implementation to using TestInfo. * added assertion (tested/failed) counter to TestInfo. Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** assert.cpp 4 Aug 2004 08:42:27 -0000 1.4 --- assert.cpp 20 Nov 2004 12:17:51 -0000 1.5 *************** *** 12,39 **** { - static ThreadLocalStorage<Location> checkPointLocation; - - - void setCheckPointLocation( const Location &location ) - { - checkPointLocation.set( location ); - } - - Location getCheckPointLocation() - { - return checkPointLocation.get(); - } - void fail( const Message &message ) { ! throw AssertException( message, getCheckPointLocation() ); ! } ! ! void ! succeed( const Message &message ) ! { ! throw SuccessException( message, getCheckPointLocation() ); } --- 12,22 ---- { void fail( const Message &message ) { ! for ( int index =0; index < message.count(); ++index ) ! TestInfo::currentAssertion()["message"].append( message.at(index) ); ! TestInfo::realizeAssertion(); } *************** *** 65,68 **** --- 48,77 ---- + void + checkAssertionFail( bool assertionFailed, + const Message &message ) + { + if ( assertionFailed ) + return; + + Message newMessage( translate( "Assertion expression did not fail as expected." ) ); + newMessage.add( message ); + fail( message ); + } + + + void + checkAssertionPass( bool assertionFailed, + const Message &message ) + { + if ( !assertionFailed ) + return; + + Message newMessage( translate( "Assertion expression did not pass as expected." ) ); + newMessage.add( message ); + fail( message ); + } + + Message buildEqualityFailedMessage( const std::string &expected, Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testrunner.cpp 19 Nov 2004 21:39:14 -0000 1.3 --- testrunner.cpp 20 Nov 2004 12:17:51 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- #include <cpput/testcase.h> #include <cpput/testcontext.h> + #include <cpput/testinfo.h> #include <cpput/testlistener.h> #include <cpput/testresult.h> *************** *** 151,154 **** --- 152,156 ---- listener.setTestPlanEntry( entry ); tracker.startTest( entry ); + TestInfo::startNewTest(); if ( itTest == tests_.end() ) // protocol error => unknown test { Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** cpput.vcproj 19 Nov 2004 19:31:38 -0000 1.21 --- cpput.vcproj 20 Nov 2004 12:17:51 -0000 1.22 *************** *** 129,136 **** Filter=""> <File ! RelativePath=".\SConscript"> </File> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File --- 129,136 ---- Filter=""> <File ! RelativePath="..\cpputtest\SConscript"> </File> <File ! RelativePath=".\SConscript"> </File> <File *************** *** 204,207 **** --- 204,210 ---- </File> <File + RelativePath="..\..\include\cpptl\stringtools.h"> + </File> + <File RelativePath="..\..\include\cpptl\typetraits.h"> </File> Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testinfo.cpp 19 Nov 2004 23:05:21 -0000 1.3 --- testinfo.cpp 20 Nov 2004 12:17:51 -0000 1.4 *************** *** 14,17 **** --- 14,24 ---- } + void clear() + { + file_ = 0; + function_ = 0; + line_ = 0; + } + const char *file_; const char *function_; *************** *** 22,25 **** --- 29,39 ---- namespace CppUT { + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // Class TestInfoData + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + + class TestInfoData { *************** *** 27,33 **** --- 41,90 ---- TestInfoData() : assertionType_( abortingAssertion ) + , assertionCount_( 0 ) + , failedAssertionCount_( 0 ) { } + void startNewTest() + { + result_.clear(); + assertion_.clear(); + assertionCount_ = 0; + failedAssertionCount_ = 0; + assertionType_ = abortingAssertion; + assertionLocation_.clear(); + } + + void newAssertion() + { + assertionType_ = abortingAssertion; + assertionLocation_.clear(); + assertion_.clear(); + ++assertionCount_; + } + + void realizeAssertion() + { + ++failedAssertionCount_; + + OpenTest::Properties assertion = assertion_; + if ( assertionLocation_.file_ ) + { + assertion["location"]["file"] = assertionLocation_.file_; + assertion["location"]["line"] = assertionLocation_.line_; + } + if ( assertionLocation_.function_ ) + assertion["location"]["function"] = assertionLocation_.function_; + TestInfo::appendToResult( "assertions", assertion ); // @todo Move appendToResult here + + if ( assertionType_ == abortingAssertion ) + { + std::string message; + if ( abortingAssertionMode_ != fastAbortingAssertion ) + message = result_.toString(); + throw AbortingAssertionException( message ); + } + } + TestResultUpdaterPtr updater_; OpenTest::Properties result_; *************** *** 36,41 **** --- 93,106 ---- CompactLocation assertionLocation_; AbortingAssertionMode abortingAssertionMode_; + unsigned int assertionCount_; + unsigned int failedAssertionCount_; + }; + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // Namespace TestInfo + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// namespace TestInfo { *************** *** 71,75 **** void startNewTest() { ! data().result_.clear(); } --- 136,140 ---- void startNewTest() { ! data().startNewTest(); } *************** *** 81,87 **** void newAssertion() { ! data().assertion_.clear(); ! data().assertionType_ = abortingAssertion; ! data().assertionLocation_ = CompactLocation(); } --- 146,150 ---- void newAssertion() { ! data().newAssertion(); } *************** *** 108,134 **** } - /// Realize the current assertion. - /// Add data about the current assertion to the test result. - /// @exception AbortingAssertionException If assertionType was set to - /// abortingAssertion. void realizeAssertion() { ! OpenTest::Properties assertion = data().assertion_; ! if ( data().assertionLocation_.file_ ) ! { ! assertion["location"]["file"] = data().assertionLocation_.file_; ! assertion["location"]["line"] = data().assertionLocation_.line_; ! } ! if ( data().assertionLocation_.function_ ) ! assertion["location"]["function"] = data().assertionLocation_.function_; ! appendToResult( "assertions", assertion ); ! if ( data().assertionType_ == abortingAssertion ) ! { ! std::string message; ! if ( data().abortingAssertionMode_ != fastAbortingAssertion ) ! message = data().result_.toString(); ! throw AbortingAssertionException( message ); ! } } --- 171,187 ---- } void realizeAssertion() { ! data().realizeAssertion(); ! } ! unsigned int CPPUT_API assertionCount() ! { ! return data().assertionCount_; ! } ! ! unsigned int CPPUT_API failedAssertionCount() ! { ! return data().failedAssertionCount_; } *************** *** 175,178 **** --- 228,248 ---- + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + // Class ScopedContextOverride + // ////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////// + + ScopedContextOverride::ScopedContextOverride() + : context_( saveAndResetContext() ) + { + } + + ScopedContextOverride::~ScopedContextOverride() + { + restoreContext( context_ ); + } + + } // namespace TestInfo |
From: Baptiste L. <bl...@us...> - 2004-11-20 12:12:47
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15362/include/cpput Modified Files: message.h Log Message: * removed ambiguity when called insertAt( const char *) Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** message.h 4 Aug 2004 07:55:37 -0000 1.3 --- message.h 20 Nov 2004 12:12:38 -0000 1.4 *************** *** 33,36 **** --- 33,42 ---- void insertAt( int index, + const char *detail ) + { + insertAt( index, std::string(detail) ); + } + + void insertAt( int index, const std::string &detail ) { |
From: Baptiste L. <bl...@us...> - 2004-11-20 12:12:11
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15246/src/cpput Modified Files: properties.cpp Log Message: * added getter to PropertyAccessor to retreive the valid Properties. Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** properties.cpp 19 Nov 2004 22:57:57 -0000 1.2 --- properties.cpp 20 Nov 2004 12:12:01 -0000 1.3 *************** *** 607,610 **** --- 607,619 ---- + const Properties & + PropertiesAccessor::properties() const + { + CPPTL_ASSERT_MESSAGE( properties_ != 0, + "PropertiesAccessor::properties() called on invalid accessor." ); + return *properties_; + } + + bool PropertiesAccessor::isValid() const *************** *** 1098,1101 **** --- 1107,1112 ---- { str += prefix; + str += "/"; + str += it->name(); str += " = "; str += value.toString(); *************** *** 1106,1115 **** for ( unsigned int index = 0; index < indexedProperties_.size(); ++index ) { ! str += prefix; ! str += "["; ! str += CppTL::toString( index ); ! str += "] = "; ! str += indexedProperties_[index].toString(); ! str += "\n"; } return str; --- 1117,1133 ---- for ( unsigned int index = 0; index < indexedProperties_.size(); ++index ) { ! std::string localPrefix = prefix; ! localPrefix += "["; ! localPrefix += CppTL::toString( index ); ! localPrefix += "]"; ! if ( indexedProperties_[index].isProperties() ) ! str += indexedProperties_[index].asProperties().toString( localPrefix ); ! else ! { ! str += localPrefix; ! str += " = "; ! str += indexedProperties_[index].toString(); ! str += "\n"; ! } } return str; |
From: Baptiste L. <bl...@us...> - 2004-11-20 12:12:11
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15246/include/opentest Modified Files: properties.h Log Message: * added getter to PropertyAccessor to retreive the valid Properties. Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** properties.h 19 Nov 2004 22:57:57 -0000 1.5 --- properties.h 20 Nov 2004 12:12:01 -0000 1.6 *************** *** 229,232 **** --- 229,234 ---- PropertiesAccessor operator[]( const PropertyPath &path ) const; + const Properties &properties() const; + bool isValid() const; |
From: Baptiste L. <bl...@us...> - 2004-11-20 09:15:09
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16757/include/cpptl Modified Files: stringtools.h Log Message: * fixed bug in integerToString() Index: stringtools.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/stringtools.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stringtools.h 19 Nov 2004 22:57:56 -0000 1.1 --- stringtools.h 20 Nov 2004 09:15:00 -0000 1.2 *************** *** 22,26 **** while ( v != 0 ) { ! s.insert( 0, digits[v % 10], 1 ); v /= 10; } --- 22,26 ---- while ( v != 0 ) { ! s.insert( 0, 1, digits[v % 10] ); v /= 10; } |
From: Baptiste L. <bl...@us...> - 2004-11-19 23:05:31
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1230/src/cpput Modified Files: testinfo.cpp Log Message: * added aborting assertion mode to optional carry a string containing the properties in the exception. Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testinfo.cpp 19 Nov 2004 21:39:14 -0000 1.2 --- testinfo.cpp 19 Nov 2004 23:05:21 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- #include <cpput/testinfo.h> + #include <cpput/thread.h> namespace { *************** *** 34,46 **** AssertionType assertionType_; CompactLocation assertionLocation_; }; namespace TestInfo { ! static TestInfoDataPtr staticData( new TestInfoData() ); ! static const TestInfoDataPtr &dataPtr() { ! return staticData; } --- 35,55 ---- AssertionType assertionType_; CompactLocation assertionLocation_; + AbortingAssertionMode abortingAssertionMode_; }; namespace TestInfo { ! // static TestInfoDataPtr staticData( new TestInfoData() ); ! ThreadLocalStorage<TestInfoDataPtr> staticData; ! static TestInfoDataPtr dataPtr() { ! const TestInfoDataPtr &data = staticData.get(); ! if ( !data ) ! { ! staticData.set( TestInfoDataPtr( new TestInfoData() ) ); ! return staticData.get(); ! } ! return data; } *************** *** 116,120 **** if ( data().assertionType_ == abortingAssertion ) ! throw AbortingAssertionException( "" ); } --- 125,134 ---- if ( data().assertionType_ == abortingAssertion ) ! { ! std::string message; ! if ( data().abortingAssertionMode_ != fastAbortingAssertion ) ! message = data().result_.toString(); ! throw AbortingAssertionException( message ); ! } } *************** *** 155,158 **** --- 169,177 ---- } + void setAbortingAssertionMode( AbortingAssertionMode mode ) + { + data().abortingAssertionMode_ = mode; + } + } // namespace TestInfo |
From: Baptiste L. <bl...@us...> - 2004-11-19 23:05:30
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1230/include/cpput Modified Files: testinfo.h Log Message: * added aborting assertion mode to optional carry a string containing the properties in the exception. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testinfo.h 19 Nov 2004 21:39:13 -0000 1.2 --- testinfo.h 19 Nov 2004 23:05:20 -0000 1.3 *************** *** 38,41 **** --- 38,47 ---- }; + enum AbortingAssertionMode + { + fastAbortingAssertion = 1, + richAbortingAssertion + }; + namespace TestInfo { void CPPUT_API setTestResultUpdater( const TestResultUpdaterPtr &updater ); *************** *** 77,80 **** --- 83,89 ---- void CPPUT_API restoreContext( const TestInfoDataPtr &oldContext ); + /// Only for using for unit test of the framework itself + void setAbortingAssertionMode( AbortingAssertionMode mode ); + } // namespace TestInfo |
From: Baptiste L. <bl...@us...> - 2004-11-19 22:58:07
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31257/src/cpput Modified Files: properties.cpp Log Message: * added toString() to Value & Properties. Index: properties.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/properties.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** properties.cpp 19 Nov 2004 19:32:18 -0000 1.1 --- properties.cpp 19 Nov 2004 22:57:57 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- #include <opentest/properties.h> + #include <cpptl/stringtools.h> #include <string.h> *************** *** 438,441 **** --- 439,468 ---- + std::string + Value::toString() const + { + switch ( type() ) + { + case vtNone: + return "<:none:>"; + case vtBoolean: + return CppTL::toString( asBool() ); + case vtSignedInteger: + return CppTL::toString( guts_.intValue_ ); + case vtUnsignedInteger: + return CppTL::toString( guts_.uintValue_ ); + case vtReal: + return CppTL::toString( guts_.realValue_ ); + case vtString: + return "'" + asString() + "'"; /// @todo string should be escaped... + case vtProperties: + return asProperties().toString(); + default: // unreachable + CPPTL_DEBUG_ASSERT_UNREACHABLE; + return false; + } + } + + // Inline implementation of Property *************** *** 1050,1052 **** --- 1077,1118 ---- + std::string + Properties::toString() const + { + return toString( "" ); + } + + + std::string + Properties::toString( const std::string &prefix ) const + { + std::string str; + PropertyList::const_iterator it = properties_.begin(); + PropertyList::const_iterator itEnd = properties_.end(); + for ( ;it != itEnd; ++it ) + { + const Value &value = it->value(); + if ( value.isProperties() ) + str += value.asProperties().toString( prefix + "/" + it->name() ); + else + { + str += prefix; + str += " = "; + str += value.toString(); + str += "\n"; + } + } + + for ( unsigned int index = 0; index < indexedProperties_.size(); ++index ) + { + str += prefix; + str += "["; + str += CppTL::toString( index ); + str += "] = "; + str += indexedProperties_[index].toString(); + str += "\n"; + } + return str; + } + } // namespace OpenTest |
From: Baptiste L. <bl...@us...> - 2004-11-19 22:58:07
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31257/include/opentest Modified Files: properties.h Log Message: * added toString() to Value & Properties. Index: properties.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/properties.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** properties.h 19 Nov 2004 19:31:38 -0000 1.4 --- properties.h 19 Nov 2004 22:57:57 -0000 1.5 *************** *** 140,143 **** --- 140,145 ---- Properties &append( const Value &value ); + std::string toString() const; + private: *************** *** 338,341 **** --- 340,345 ---- PropertyEnum properties() const; + std::string toString() const; + private: // Notes: can not use std::map because VC++6 implementation is buggy and cause *************** *** 366,369 **** --- 370,375 ---- void checkPathNotEmpty( const PropertyPath &path ) const; + std::string toString( const std::string &prefix ) const; + PropertyList properties_; IndexedProperties indexedProperties_; |
From: Baptiste L. <bl...@us...> - 2004-11-19 22:58:07
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31257/include/cpptl Added Files: stringtools.h Log Message: * added toString() to Value & Properties. --- NEW FILE: stringtools.h --- #ifndef CPPTL_STRINGTOOLS_H_INCLUDED # define CPPTL_STRINGTOOLS_H_INCLUDED # include <string> # include <float.h> // toString( double ) namespace CppTL { template<class IntType> std::string integerToString( IntType v ) { static const char *digits = "0123456789"; std::string s; if ( v == 0 ) s += '0'; else { bool isSigned = v < 0; if ( isSigned ) v *= -1; while ( v != 0 ) { s.insert( 0, digits[v % 10], 1 ); v /= 10; } if ( isSigned ) s.insert( 0, "-" ); } return s; } inline std::string toString( char c ) { return std::string( 1, c ); } inline std::string toString( int v ) { return integerToString( v ); } inline std::string toString( unsigned int v ) { return integerToString( v ); } inline std::string toString( long v ) { return integerToString( v ); } inline std::string toString( unsigned long v ) { return integerToString( v ); } inline std::string toString( short v ) { return integerToString( v ); } inline std::string toString( unsigned short v ) { return integerToString( v ); } #ifndef CPPTL_NO_INT64 inline std::string toString( int64_t v ) { return integerToString( v ); } inline std::string toString( uint64_t v ) { return integerToString( v ); } #endif inline std::string toString( float v ) { #ifdef DBL_DIG const int precision = FLT_DIG; #else const int precision = 6; #endif // #ifdef DBL_DIG char buffer[128]; sprintf(buffer, "%.*g", precision, v ); return buffer; } inline std::string toString( double v ) { #ifdef DBL_DIG const int precision = DBL_DIG; #else const int precision = 15; #endif // #ifdef DBL_DIG char buffer[128]; sprintf(buffer, "%.*g", precision, v ); return buffer; } inline std::string toString( long double v ) { #ifdef DBL_DIG const int precision = DBL_DIG; #else const int precision = 15; #endif // #ifdef DBL_DIG char buffer[128]; sprintf(buffer, "%.*g", precision, v ); return buffer; } inline std::string toString( bool v ) { return v ? "true" : "false"; } } // namespace CppTL #endif // CPPTL_STRINGTOOLS_H_INCLUDED |
From: Baptiste L. <bl...@us...> - 2004-11-19 21:39:23
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11378/src/cpput Modified Files: testinfo.cpp testrunner.cpp Log Message: * modified TestRunner/TestDriver protocol to allow incremental result properties update. Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testrunner.cpp 17 Nov 2004 21:47:10 -0000 1.2 --- testrunner.cpp 19 Nov 2004 21:39:14 -0000 1.3 *************** *** 90,94 **** } ! tracker_.addTestInfo( *testEntry_, openResult ); } --- 90,94 ---- } ! tracker_.mergeInTestResult( *testEntry_, openResult ); } *************** *** 156,160 **** openResult["result"]["status"]["success"] = false; openResult["result"]["status"]["type"] = "skip"; ! tracker.addTestInfo( entry, openResult ); } else --- 156,160 ---- openResult["result"]["status"]["success"] = false; openResult["result"]["status"]["type"] = "skip"; ! tracker.mergeInTestResult( entry, openResult ); } else *************** *** 167,171 **** openResult["result"]["status"]["type"] = "skip"; openResult["result"]["status"]["message"] = "Can not run test suite."; ! tracker.addTestInfo( entry, openResult ); } else --- 167,171 ---- openResult["result"]["status"]["type"] = "skip"; openResult["result"]["status"]["message"] = "Can not run test suite."; ! tracker.mergeInTestResult( entry, openResult ); } else Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testinfo.cpp 18 Nov 2004 09:20:33 -0000 1.1 --- testinfo.cpp 19 Nov 2004 21:39:14 -0000 1.2 *************** *** 119,123 **** } ! void mergeInResult( const std::string &path, const OpenTest::Value &value ) { --- 119,131 ---- } ! void mergeInResult( const OpenTest::Properties &result ) ! { ! data().result_.mergeReplacingExisting( result ); ! if ( data().updater_ ) ! data().updater_->mergeInResult( result ); ! } ! ! ! void mergeInResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) { *************** *** 127,131 **** } ! void appendToResult( const std::string &path, const OpenTest::Value &value ) { --- 135,139 ---- } ! void appendToResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) { |
From: Baptiste L. <bl...@us...> - 2004-11-19 21:39:23
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11378/include/opentest Modified Files: testrunner.h texttestdriver.h Log Message: * modified TestRunner/TestDriver protocol to allow incremental result properties update. Index: testrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/testrunner.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testrunner.h 16 Nov 2004 22:46:44 -0000 1.2 --- testrunner.h 19 Nov 2004 21:39:13 -0000 1.3 *************** *** 55,60 **** virtual void startTest( const TestPlanEntry &testEntry ) = 0; ! virtual void addTestInfo( const TestPlanEntry &testEntry, ! const Properties &data ) = 0; virtual void endTest( const TestPlanEntry &testEntry ) = 0; --- 55,68 ---- virtual void startTest( const TestPlanEntry &testEntry ) = 0; ! virtual void mergeInTestResult( const TestPlanEntry &testEntry, ! const OpenTest::Properties &result ) = 0; ! ! virtual void mergeInTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ) = 0; ! ! virtual void appendToTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ) = 0; virtual void endTest( const TestPlanEntry &testEntry ) = 0; Index: texttestdriver.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/texttestdriver.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texttestdriver.h 16 Nov 2004 22:46:44 -0000 1.2 --- texttestdriver.h 19 Nov 2004 21:39:13 -0000 1.3 *************** *** 31,36 **** TestResult( TestPlanEntryId id, TestId test ); - void addTestResultInfo( const Properties &result ); - TestPlanEntryId id() const; --- 31,34 ---- *************** *** 96,101 **** void startTest( const TestPlanEntry &testEntry ); ! void addTestInfo( const TestPlanEntry &testEntry, ! const Properties &data ); void endTest( const TestPlanEntry &testEntry ); --- 94,107 ---- void startTest( const TestPlanEntry &testEntry ); ! void mergeInTestResult( const TestPlanEntry &testEntry, ! const Properties &result ); ! ! void mergeInTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ); ! ! void appendToTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ); void endTest( const TestPlanEntry &testEntry ); *************** *** 201,211 **** - inline void - TestResult::addTestResultInfo( const Properties &result ) - { - result_.mergeReplacingExisting( result ); - } - - inline TestPlanEntryId TestResult::id() const --- 207,210 ---- *************** *** 376,380 **** testEntry.test() ); // should add descriptive test data first ! result.addTestResultInfo( testEntry.configuration() ); results_.push_back( result ); --- 375,379 ---- testEntry.test() ); // should add descriptive test data first ! result.result().mergeReplacingExisting( testEntry.configuration() ); results_.push_back( result ); *************** *** 387,394 **** inline void ! TextTestDriver::addTestInfo( const TestPlanEntry &testEntry, ! const Properties &data ) { ! results_.back().addTestResultInfo( data ); } --- 386,411 ---- inline void ! TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, ! const Properties &result ) { ! results_.back().result().mergeReplacingExisting( result ); ! } ! ! ! inline void ! TextTestDriver::mergeInTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ) ! { ! results_.back().result()[path] = value; ! } ! ! ! inline void ! TextTestDriver::appendToTestResult( const TestPlanEntry &testEntry, ! const PropertyPath &path, ! const Value &value ) ! { ! results_.back().result()[path].append( value ); } |
From: Baptiste L. <bl...@us...> - 2004-11-19 21:39:23
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11378/include/cpput Modified Files: testinfo.h Log Message: * modified TestRunner/TestDriver protocol to allow incremental result properties update. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testinfo.h 18 Nov 2004 09:20:34 -0000 1.1 --- testinfo.h 19 Nov 2004 21:39:13 -0000 1.2 *************** *** 23,30 **** } ! virtual void mergeInResult( const std::string &path, const OpenTest::Value &value ) = 0; ! virtual void appendToResult( const std::string &path, const OpenTest::Value &value ) = 0; }; --- 23,32 ---- } ! virtual void mergeInResult( const OpenTest::Properties &result ) = 0; ! ! virtual void mergeInResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) = 0; ! virtual void appendToResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ) = 0; }; *************** *** 61,68 **** void CPPUT_API realizeAssertion(); ! void CPPUT_API mergeInResult( const std::string &path, const OpenTest::Value &value ); ! void CPPUT_API appendToResult( const std::string &path, const OpenTest::Value &value ); --- 63,72 ---- void CPPUT_API realizeAssertion(); ! void CPPUT_API mergeInResult( const OpenTest::Properties &result ); ! ! void CPPUT_API mergeInResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ); ! void CPPUT_API appendToResult( const OpenTest::PropertyPath &path, const OpenTest::Value &value ); |