1
#ifndef __cxxtest_TestRunner_h__
2
#define __cxxtest_TestRunner_h__
5
// TestRunner is the class that runs all the tests.
6
// To use it, create an object that implements the TestListener
7
// interface and call TestRunner::runAllTests( myListener );
10
#include <cxxtest/TestListener.h>
11
#include <cxxtest/RealDescriptions.h>
12
#include <cxxtest/TestSuite.h>
13
#include <cxxtest/TestTracker.h>
20
static void runAllTests( TestListener &listener )
22
tracker().setListener( &listener );
23
_TS_TRY { TestRunner().runWorld(); }
24
_TS_LAST_CATCH( { tracker().failedTest( __FILE__, __LINE__, "Exception thrown from world" ); } );
25
tracker().setListener( 0 );
28
static void runAllTests( TestListener *listener )
31
listener->warning( __FILE__, __LINE__, "Deprecated; Use runAllTests( TestListener & )" );
32
runAllTests( *listener );
39
RealWorldDescription wd;
42
tracker().enterWorld( wd );
44
for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )
50
tracker().leaveWorld( wd );
53
void runSuite( SuiteDescription &sd )
57
tracker().enterSuite( sd );
59
for ( TestDescription *td = sd.firstTest(); td; td = td->next() )
65
tracker().leaveSuite( sd );
68
void runTest( TestDescription &td )
72
tracker().enterTest( td );
77
tracker().leaveTest( td );
82
#ifdef _CXXTEST_HAVE_EH
83
bool _abortTestOnFail;
84
#endif // _CXXTEST_HAVE_EH
85
unsigned _maxDumpSize;
90
#ifdef _CXXTEST_HAVE_EH
91
_abortTestOnFail = abortTestOnFail();
92
#endif // _CXXTEST_HAVE_EH
93
_maxDumpSize = maxDumpSize();
98
#ifdef _CXXTEST_HAVE_EH
99
setAbortTestOnFail( _abortTestOnFail );
100
#endif // _CXXTEST_HAVE_EH
101
setMaxDumpSize( _maxDumpSize );
105
class WorldGuard : public StateGuard
108
WorldGuard() : StateGuard()
110
#ifdef _CXXTEST_HAVE_EH
111
setAbortTestOnFail( CXXTEST_DEFAULT_ABORT );
112
#endif // _CXXTEST_HAVE_EH
113
setMaxDumpSize( CXXTEST_MAX_DUMP_SIZE );
119
// For --no-static-init
125
#endif // __cxxtest_TestRunner_h__