[Cppunit-cvs] cppunit2/src/cpput cpput.vcproj,1.18,1.19 testcase.cpp,1.3,1.4 testcontext.cpp,1.8,1.9
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-17 21:47:22
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv508/src/cpput Modified Files: cpput.vcproj testcase.cpp testcontext.cpp testrunner.cpp testsuite.cpp Log Message: * started removing TestDriver stuff from CppUnit 2 * Removed Test::run(), Test::totalTestCount and Test::parent * User can only subclass AbstractTestSuite or AbstractTestCase. * AbstractTest has been inlined into Test * Test no longer have parent * Removed TestListener::enterTest() & TestListener::exitTest() * Moved responsibility of running TestCase from AbstractTestCase to TestContext::run( AbstractTestCase &test ). * Removed method related to suite and enter/exit event from TestContext. * Disabled some unit tests (rely on running test which will change again shortly) Index: cpput.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/cpput.vcproj,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** cpput.vcproj 17 Nov 2004 09:00:33 -0000 1.18 --- cpput.vcproj 17 Nov 2004 21:47:10 -0000 1.19 *************** *** 251,254 **** --- 251,307 ---- </File> </Filter> + <Filter + Name="experimental" + Filter=""> + <File + RelativePath=".\dllproxy.cpp"> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + DisableLanguageExtensions="FALSE"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + DisableLanguageExtensions="FALSE"/> + </FileConfiguration> + </File> + <File + RelativePath="..\..\include\cpput\dllproxy.h"> + </File> + <File + RelativePath="parametrizedsource.cpp"> + </File> + <File + RelativePath="..\..\include\cpput\parametrizedsource.h"> + </File> + <File + RelativePath="..\..\include\cpput\progresslistener.h"> + </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> + </Filter> + <Filter + Name="obsolete by opentest" + Filter=""> + </Filter> <File RelativePath=".\assert.cpp"> *************** *** 273,294 **** </File> <File - RelativePath=".\dllproxy.cpp"> - <FileConfiguration - Name="Release|Win32"> - <Tool - Name="VCCLCompilerTool" - DisableLanguageExtensions="FALSE"/> - </FileConfiguration> - <FileConfiguration - Name="Debug|Win32"> - <Tool - Name="VCCLCompilerTool" - DisableLanguageExtensions="FALSE"/> - </FileConfiguration> - </File> - <File - RelativePath="..\..\include\cpput\dllproxy.h"> - </File> - <File RelativePath="..\..\include\cpput\enumerator.h"> </File> --- 326,329 ---- *************** *** 312,324 **** </File> <File - RelativePath="parametrizedsource.cpp"> - </File> - <File - RelativePath="..\..\include\cpput\parametrizedsource.h"> - </File> - <File - RelativePath="..\..\include\cpput\progresslistener.h"> - </File> - <File RelativePath="..\..\include\cpput\properties.h"> </File> --- 347,350 ---- *************** *** 339,360 **** </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> --- 365,368 ---- *************** *** 390,393 **** --- 398,404 ---- </File> <File + RelativePath="..\..\include\cpput\testrunner.h"> + </File> + <File RelativePath="..\..\include\cpput\testrunresult.h"> </File> Index: testsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testsuite.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testsuite.cpp 17 Nov 2004 08:59:34 -0000 1.3 --- testsuite.cpp 17 Nov 2004 21:47:10 -0000 1.4 *************** *** 16,20 **** AbstractTestSuite::AbstractTestSuite( const std::string &name ) ! : AbstractTest( name ) { } --- 16,20 ---- AbstractTestSuite::AbstractTestSuite( const std::string &name ) ! : Test( name ) { } *************** *** 27,50 **** } ! ! void ! AbstractTestSuite::run( TestContext &context ) { ! context.protect( *this, bind1( makeMemFn1( this, ! &AbstractTestSuite::runTests ), ! &context ) ); } - int - AbstractTestSuite::totalTestCount() const - { - int total = 0; - int count = testCount(); - for ( int index = 0; index < count; ++index ) - total += testAt( index )->totalTestCount(); - return total; - } - // Class TestSuite --- 27,37 ---- } ! bool ! AbstractTestSuite::isTestCase() const { ! return false; } // Class TestSuite *************** *** 79,83 **** { tests_.push_back( test ); - test->setParentTest( *this ); } --- 66,69 ---- *************** *** 90,106 **** - void - TestSuite::runTests( TestContext *context ) - { - Tests::iterator it = tests_.begin(); - Tests::iterator itEnd = tests_.end(); - while ( it != itEnd ) - { - const TestPtr &test = *it++; - test->run( *context ); - } - } - - TestSuitePtr makeTestSuite( const std::string &name ) { --- 76,79 ---- Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testrunner.cpp 15 Nov 2004 08:37:13 -0000 1.1 --- testrunner.cpp 17 Nov 2004 21:47:10 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- #include <cpput/testrunner.h> #include <cpput/message.h> + #include <cpput/testcase.h> #include <cpput/testcontext.h> #include <cpput/testlistener.h> *************** *** 160,164 **** { Test &test = *( itTest->second ); ! test.run( testContext ); } tracker.endTest( entry ); --- 161,177 ---- { Test &test = *( itTest->second ); ! if ( !test.isTestCase() ) ! { ! OpenTest::Properties openResult; ! openResult["result"]["status"]["success"] = false; ! openResult["result"]["status"]["type"] = "skip"; ! openResult["result"]["status"]["message"] = "Can not run test suite."; ! tracker.addTestInfo( entry, openResult ); ! } ! else ! { ! AbstractTestCase &testCase = static_cast<AbstractTestCase &>( test ); ! testContext.run( testCase ); ! } } tracker.endTest( entry ); Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testcase.cpp 23 Jun 2004 18:45:35 -0000 1.3 --- testcase.cpp 17 Nov 2004 21:47:10 -0000 1.4 *************** *** 14,26 **** AbstractTestCase::AbstractTestCase( const std::string &name ) ! : AbstractTest( name ) ! { ! } ! ! ! void ! AbstractTestCase::run( TestContext &context ) { - context.protectTestRun( *this, makeMemFn1( this, &AbstractTestCase::runTest ) ); } --- 14,19 ---- AbstractTestCase::AbstractTestCase( const std::string &name ) ! : Test( name ) { } *************** *** 33,56 **** ! int ! AbstractTestCase::totalTestCount() const ! { ! return 1; ! } ! ! ! void ! AbstractTestCase::runTest( TestContext *context ) { ! bool initialized = context->protect( *this, ! makeMemFn0( this, ! &AbstractTestCase::setUp ) ); ! ! if ( initialized ) ! { ! context->protect( *this, makeMemFn0( this, &AbstractTestCase::doRun ) ); ! context->protect( *this, ! makeMemFn0( this, &AbstractTestCase::tearDown) ); ! } } --- 26,33 ---- ! bool ! AbstractTestCase::isTestCase() const { ! return true; } *************** *** 101,105 **** void ! TestCase::doRun() { if ( run_ ) --- 78,82 ---- void ! TestCase::run() { if ( run_ ) *************** *** 145,149 **** } private: // overridden from AbstractTestCase ! void doRun() { throw CppUT::AssertException( message_ ); --- 122,126 ---- } private: // overridden from AbstractTestCase ! void run() { throw CppUT::AssertException( message_ ); Index: testcontext.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcontext.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testcontext.cpp 4 Aug 2004 19:41:19 -0000 1.8 --- testcontext.cpp 17 Nov 2004 21:47:10 -0000 1.9 *************** *** 1,6 **** #include <cpput/testcontext.h> #include <cpput/resultexception.h> ! #include <cpput/testresult.h> #include <cpput/testlistener.h> #include <cpput/testsuite.h> #include <cpput/testvisitor.h> --- 1,7 ---- #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> *************** *** 20,36 **** void ! TestContext::protectTestRun( Test &test, ! Functor1<TestContext *> runTest ) { testSucceeded_ = true; ! dispatchTestEvent( test, &TestListener::enterTest ); ! ! guardsChain_.protect( *this, bind1( runTest, this ), test ); if ( testSucceeded_ ) dispatchTestSuccessResult( test ); - - dispatchTestEvent( test, &TestListener::exitTest ); } --- 21,39 ---- 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 ); } *************** *** 80,111 **** void - TestContext::dispatchTestEvent( Test &test, - void (TestListener::*eventMethod)( Test &, TestContext &) ) - { - Listeners::const_iterator it = listeners_.begin(); - Listeners::const_iterator itEnd = listeners_.end(); - while ( it != itEnd ) - { - TestListener &listener = **it++; - (listener.*eventMethod)( test, *this ); - } - } - - - void - TestContext::dispatchSuiteEvent( AbstractTestSuite &suite, - void (TestListener::*eventMethod)( AbstractTestSuite &, TestContext &) ) - { - Listeners::const_iterator it = listeners_.begin(); - Listeners::const_iterator itEnd = listeners_.end(); - while ( it != itEnd ) - { - TestListener &listener = **it++; - (listener.*eventMethod)( suite, *this ); - } - } - - - void TestContext::dispatchTestResult( TestResult &result ) { --- 83,86 ---- |