CppUnit project page FAQ CppUnit home page

TestResult.h
Go to the documentation of this file.
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 #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 
00027 #if CPPUNIT_NEED_DLL_DECL
00028 //  template class CPPUNIT_API std::deque<TestListener *>;
00029 #endif
00030 
00051 class CPPUNIT_API TestResult : protected SynchronizedObject
00052 {
00053 public:
00055   TestResult( SynchronizationObject *syncObject = 0 );
00056 
00058   virtual ~TestResult();
00059 
00060   virtual void addListener( TestListener *listener );
00061 
00062   virtual void removeListener( TestListener *listener );
00063 
00065   virtual void reset();
00066   
00068   virtual void stop();
00069 
00071   virtual bool shouldStop() const;
00072 
00074   virtual void startTest( Test *test );
00075 
00080   virtual void addError( Test *test, Exception *e );
00081 
00085   virtual void addFailure( Test *test, Exception *e );
00086 
00088   virtual void endTest( Test *test );
00089 
00091   virtual void startSuite( Test *test );
00092 
00094   virtual void endSuite( Test *test );
00095 
00100   virtual void runTest( Test *test );
00101 
00117   virtual bool protect( const Functor &functor,
00118                         Test *test,
00119                         const std::string &shortDescription = std::string("") );
00120 
00122   virtual void pushProtector( Protector *protector );
00123 
00125   virtual void popProtector();
00126 
00127 protected:
00130   void addFailure( const TestFailure &failure );
00131 
00132   virtual void startTestRun( Test *test );
00133   virtual void endTestRun( Test *test );
00134   
00135 protected:
00136   typedef CppUnitDeque<TestListener *> TestListeners;
00137   TestListeners m_listeners;
00138   ProtectorChain *m_protectorChain;
00139   bool m_stop;
00140 
00141 private: 
00142   TestResult( const TestResult &other );
00143   TestResult &operator =( const TestResult &other );
00144 };
00145 
00146 
00147 CPPUNIT_NS_END
00148 
00149 
00150 #if CPPUNIT_NEED_DLL_DECL
00151 #pragma warning( pop )
00152 #endif
00153 
00154 #endif // CPPUNIT_TESTRESULT_H
00155 
00156 

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers