[Cppunit-cvs] cppunit2/include/cpput assert.h,1.5,1.6 testcontext.h,1.8,1.9 testfailureguard.h,1.10,
Brought to you by:
blep
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 --- |