00001 #ifndef CPPUNIT_TESTRESULT_H
00002 #define CPPUNIT_TESTRESULT_H
00003
00004 #include <cppunit/Portability.h>
00005
00006 #if CPPUNIT_NEED_DLL_DECL
00007 #pragma warning( push )
00008 #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
00009 #endif
00010
00011 #include <cppunit/SynchronizedObject.h>
00012 #include <deque>
00013 #include <string>
00014
00015 CPPUNIT_NS_BEGIN
00016
00017
00018 class Exception;
00019 class Functor;
00020 class Protector;
00021 class ProtectorChain;
00022 class Test;
00023 class TestFailure;
00024 class TestListener;
00025
00026
00047 class CPPUNIT_API TestResult : protected SynchronizedObject
00048 {
00049 public:
00051 TestResult( SynchronizationObject *syncObject = 0 );
00052
00054 virtual ~TestResult();
00055
00056 virtual void addListener( TestListener *listener );
00057
00058 virtual void removeListener( TestListener *listener );
00059
00061 virtual void reset();
00062
00064 virtual void stop();
00065
00067 virtual bool shouldStop() const;
00068
00070 virtual void startTest( Test *test );
00071
00076 virtual void addError( Test *test, Exception *e );
00077
00081 virtual void addFailure( Test *test, Exception *e );
00082
00084 virtual void endTest( Test *test );
00085
00087 virtual void startSuite( Test *test );
00088
00090 virtual void endSuite( Test *test );
00091
00096 virtual void runTest( Test *test );
00097
00113 virtual bool protect( const Functor &functor,
00114 Test *test,
00115 const std::string &shortDescription = std::string("") );
00116
00118 virtual void pushProtector( Protector *protector );
00119
00121 virtual void popProtector();
00122
00123 protected:
00126 void addFailure( const TestFailure &failure );
00127
00128 virtual void startTestRun( Test *test );
00129 virtual void endTestRun( Test *test );
00130
00131 protected:
00132 typedef std::deque<TestListener *> TestListeners;
00133 TestListeners m_listeners;
00134 ProtectorChain *m_protectorChain;
00135 bool m_stop;
00136
00137 private:
00138 TestResult( const TestResult &other );
00139 TestResult &operator =( const TestResult &other );
00140 };
00141
00142
00143 CPPUNIT_NS_END
00144
00145
00146 #if CPPUNIT_NEED_DLL_DECL
00147 #pragma warning( pop )
00148 #endif
00149
00150 #endif // CPPUNIT_TESTRESULT_H
00151
00152