Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members  

D:/new/wxTest/include/wxTest/ITest.h

Go to the documentation of this file.
00001 

00002 // Name:        ITest.h

00003 // Purpose:     Declare abstract binary-decoupled interface for all tests.

00004 // Author:      Marty Saxton

00005 // Modified by:

00006 // Created:     10/27/2001

00007 // RCS-ID:      $Id: ITest_8h-source.html,v 1.1.1.1 2001/11/10 19:00:33 thundercow Exp $

00008 // Copyright:   (c) Marty Saxton, Thundercow Software

00009 // Licence:     wxWindows license

00011 

00012 #ifndef __WXTEST_H__

00013 #define __WXTEST_H__

00014 

00015 #include <wxTest/preprocessor.h>

00016 

00017 WXTEST_BEGIN_NAMESPACE

00018 

00019 class wxITestRunner;

00020 

00029 class wxITest 

00030 {

00031 public:

00032 

00036         virtual void Delete() = 0;

00037 

00043         virtual const char* GetDescription() = 0;

00044 

00053         enum TestState { unknown, running, pass, fail };

00054 

00060         virtual TestState GetState() = 0;

00061 

00067         virtual void SetState( TestState newState ) = 0;

00068 

00074         virtual void Run( wxITestRunner* pResult ) = 0;

00075 

00082         virtual void Run( wxITestRunner* pResult, long unsigned nThreadId ) = 0;

00083 

00089         virtual bool IsThreadSafe() = 0;

00090 

00095         virtual int GetNumSubTests() = 0;

00096 

00102         virtual void GetSubTests( wxITest ** pOutTests ) = 0;

00103 

00109         virtual const wxITest* GetParent() const = 0;

00110         virtual wxITest* GetParent()  = 0;

00111 

00117         virtual void SetParent( wxITest* pParent )  = 0;

00118 };

00119 

00120 

00129 class wxTestAssertion

00130 {

00131 public:

00141         wxTestAssertion( const char* pszMessage, const char* file, long unsigned lineNo ) :

00142                 m_pszFile( file ), m_nLineNo( lineNo )

00143         {

00144                 const char* pSrc = pszMessage;

00145                 char* pDst = m_szMessage;

00146                 while ( *pSrc )

00147                         *pDst++ = *pSrc++;

00148                 *pDst = 0;

00149         }

00150 

00151         char m_szMessage[1024];

00152         const char* m_pszFile;

00153         long unsigned m_nLineNo;

00154 };

00155 

00162 #define WXTASSERT( BOOLEXPR ) if ( !( BOOLEXPR ) ) throw wxTestAssertion( "", __FILE__, __LINE__ );

00163 

00169 #define WXTASSERTMSG( MSG, BOOLEXPR ) if ( !( BOOLEXPR ) ) throw wxTestAssertion( MSG, __FILE__, __LINE__ );

00170 

00175 WXTEST_END_NAMESPACE

00176 

00177 #endif //__WXTEST_H__


ThunderCow Software (c) 2001 Marty Saxton, ThunderCow Software. Generated on Sat Nov 10 12:07:18 2001 for wxTest by Doxygen 1.2.11