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
00014 namespace CppUnit {
00015
00016 class Exception;
00017 class Test;
00018 class TestFailure;
00019 class TestListener;
00020
00021 #if CPPUNIT_NEED_DLL_DECL
00022 template class CPPUNIT_API std::deque<TestListener *>;
00023 #endif
00024
00045 class CPPUNIT_API TestResult : protected SynchronizedObject
00046 {
00047 public:
00048 TestResult( SynchronizationObject *syncObject = 0 );
00049 virtual ~TestResult();
00050
00051 virtual void addListener( TestListener *listener );
00052 virtual void removeListener( TestListener *listener );
00053
00054 virtual void reset();
00055 virtual void stop();
00056
00057 virtual bool shouldStop() const;
00058
00059 virtual void startTest( Test *test );
00060 virtual void addError( Test *test, Exception *e );
00061 virtual void addFailure( Test *test, Exception *e );
00062 virtual void endTest( Test *test );
00063
00064 protected:
00065 void addFailure( const TestFailure &failure );
00066
00067 protected:
00068 typedef std::deque<TestListener *> TestListeners;
00069 TestListeners m_listeners;
00070 bool m_stop;
00071
00072 private:
00073 TestResult( const TestResult &other );
00074 TestResult &operator =( const TestResult &other );
00075 };
00076
00077
00078 }
00079
00080
00081 #if CPPUNIT_NEED_DLL_DECL
00082 #pragma warning( pop )
00083 #endif
00084
00085 #endif // CPPUNIT_TESTRESULT_H
00086
00087