CppUnit project page FAQ CppUnit home page

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TestResult.h

Go to the documentation of this file.
00001 #ifndef CPPUNIT_TESTRESULT_H
00002 #define CPPUNIT_TESTRESULT_H
00003 
00004 #include <vector>
00005 #include <cppunit/TestFailure.h>
00006 
00007 namespace CppUnit {
00008 
00009   class Exception;
00010   class Test;
00011   class TestListener;
00012 
00013 
00034   class TestResult
00035   {
00036 
00037     public:
00038       TestResult  ();
00039       virtual                             ~TestResult ();
00040 
00041       virtual void                        addError       (Test *test, Exception *e);
00042       virtual void                        addFailure     (Test *test, Exception *e);
00043       virtual void                        startTest      (Test *test);
00044       virtual void                        endTest        (Test *test);
00045       virtual int                         runTests       ();
00046       virtual int                         testErrors     ();
00047       virtual int                         testFailures   ();
00048       virtual bool                        wasSuccessful  ();
00049       virtual bool                        shouldStop     ();
00050       virtual void                        stop           ();
00051 
00052       virtual std::vector<TestFailure *>& errors         ();
00053       virtual std::vector<TestFailure *>& failures       ();
00054 
00055       virtual void                        addListener    ( TestListener *listener );
00056       virtual void                        removeListener ( TestListener *listener );
00057 
00058 
00059       class SynchronizationObject
00060       {
00061         public:
00062           SynchronizationObject  () {}
00063           virtual                 ~SynchronizationObject () {}
00064 
00065           virtual void            lock                   () {}
00066           virtual void            unlock                 () {}
00067       };
00068 
00069       class ExclusiveZone
00070       {
00071           SynchronizationObject   *m_syncObject;
00072 
00073         public:
00074           ExclusiveZone (SynchronizationObject *syncObject) 
00075             : m_syncObject (syncObject) 
00076           { m_syncObject->lock (); }
00077 
00078           ~ExclusiveZone () 
00079           { m_syncObject->unlock (); }
00080       };
00081 
00082     protected:
00083       virtual void                setSynchronizationObject (SynchronizationObject *syncObject);
00084 
00085       std::vector<TestFailure *>  m_errors;
00086       std::vector<TestFailure *>  m_failures;
00087       std::vector<TestListener *> m_listeners;
00088       int                         m_runTests;
00089       bool                        m_stop;
00090       SynchronizationObject       *m_syncObject;
00091     private: 
00092       TestResult (const TestResult& other); 
00093       TestResult& operator= (const TestResult& other); 
00094 
00095   };
00096 
00097 } // namespace CppUnit
00098 
00099 #endif // CPPUNIT_TESTRESULT_H
00100 
00101 

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