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 <cppunit/portability/CppUnitDeque.h>
00013
00014 CPPUNIT_NS_BEGIN
00015
00016
00017 class Exception;
00018 class Functor;
00019 class Protector;
00020 class ProtectorChain;
00021 class Test;
00022 class TestFailure;
00023 class TestListener;
00024
00025
00026 #if CPPUNIT_NEED_DLL_DECL
00027
00028 #endif
00029
00050 class CPPUNIT_API TestResult : protected SynchronizedObject
00051 {
00052 public:
00054 TestResult( SynchronizationObject *syncObject = 0 );
00055
00057 virtual ~TestResult();
00058
00059 virtual void addListener( TestListener *listener );
00060
00061 virtual void removeListener( TestListener *listener );
00062
00064 virtual void reset();
00065
00067 virtual void stop();
00068
00070 virtual bool shouldStop() const;
00071
00073 virtual void startTest( Test *test );
00074
00079 virtual void addError( Test *test, Exception *e );
00080
00084 virtual void addFailure( Test *test, Exception *e );
00085
00087 virtual void endTest( Test *test );
00088
00090 virtual void startSuite( Test *test );
00091
00093 virtual void endSuite( Test *test );
00094
00099 virtual void runTest( Test *test );
00100
00116 virtual bool protect( const Functor &functor,
00117 Test *test,
00118 const std::string &shortDescription = std::string("") );
00119
00121 virtual void pushProtector( Protector *protector );
00122
00124 virtual void popProtector();
00125
00126 protected:
00129 void addFailure( const TestFailure &failure );
00130
00131 virtual void startTestRun( Test *test );
00132 virtual void endTestRun( Test *test );
00133
00134 protected:
00135 typedef CppUnitDeque<TestListener *> TestListeners;
00136 TestListeners m_listeners;
00137 ProtectorChain *m_protectorChain;
00138 bool m_stop;
00139
00140 private:
00141 TestResult( const TestResult &other );
00142 TestResult &operator =( const TestResult &other );
00143 };
00144
00145
00146 CPPUNIT_NS_END
00147
00148
00149 #if CPPUNIT_NEED_DLL_DECL
00150 #pragma warning( pop )
00151 #endif
00152
00153 #endif // CPPUNIT_TESTRESULT_H
00154
00155