My Project
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
CxxTest::RealWorldDescription Class Reference

#include <RealDescriptions.h>

Public Member Functions

unsigned numSuites (void) const
 
unsigned numTotalTests (void) const
 
SuiteDescriptionfirstSuite ()
 
const SuiteDescriptionfirstSuite () const
 
const SuiteDescriptionsuiteDescription (unsigned i) const
 
void activateAllTests ()
 
bool leaveOnly (const char *suiteName, const char *testName=0)
 
bool setUp ()
 
bool tearDown ()
 
- Public Member Functions inherited from CxxTest::WorldDescription
virtual ~WorldDescription ()
 
virtual unsigned numSuites (void) const =0
 
virtual unsigned numTotalTests (void) const =0
 
virtual const SuiteDescriptionsuiteDescription (unsigned) const =0
 
char * strTotalTests (char *) const
 
virtual SuiteDescriptionfirstSuite ()=0
 
virtual const SuiteDescriptionfirstSuite () const =0
 
virtual void activateAllTests ()=0
 
virtual bool leaveOnly (const char *, const char *=0)=0
 

Static Public Member Functions

static Listsuites ()
 
static void reportError (const char *message)
 

Additional Inherited Members

- Public Types inherited from CxxTest::WorldDescription
enum  { MAX_STRLEN_TOTAL_TESTS = 32 }
 

Detailed Description

Definition at line 201 of file RealDescriptions.h.

Member Function Documentation

◆ activateAllTests()

void CxxTest::RealWorldDescription::activateAllTests ( )
virtual

Implements CxxTest::WorldDescription.

Definition at line 241 of file RealDescriptions.cpp.

242 {
244 for ( SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() )
245 sd->activateAllTests();
246 }
virtual SuiteDescription * next()=0
void activateAll()
Definition: LinkedList.cpp:69

◆ firstSuite() [1/2]

SuiteDescription * CxxTest::RealWorldDescription::firstSuite ( )
virtual

Implements CxxTest::WorldDescription.

Definition at line 226 of file RealDescriptions.cpp.

227 {
228 return (RealSuiteDescription *)suites().head();
229 }
Link * head()
Definition: LinkedList.cpp:16

◆ firstSuite() [2/2]

const SuiteDescription * CxxTest::RealWorldDescription::firstSuite ( ) const
virtual

Implements CxxTest::WorldDescription.

Definition at line 231 of file RealDescriptions.cpp.

232 {
233 return (const RealSuiteDescription *)suites().head();
234 }

◆ leaveOnly()

bool CxxTest::RealWorldDescription::leaveOnly ( const char *  suiteName,
const char *  testName = 0 
)
virtual

Implements CxxTest::WorldDescription.

Definition at line 248 of file RealDescriptions.cpp.

249 {
250 for ( SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() ) {
251 if ( stringsEqual( sd->suiteName(), suiteName ) ) {
252 if ( testName )
253 if ( !sd->leaveOnly( testName ) )
254 return false;
255 suites().leaveOnly( *sd );
256 return true;
257 }
258 }
259 return false;
260 }
bool stringsEqual(const char *s1, const char *s2)
Definition: ValueTraits.cpp:39
void leaveOnly(const Link &link)
Definition: LinkedList.cpp:75

◆ numSuites()

unsigned CxxTest::RealWorldDescription::numSuites ( void  ) const
virtual

Implements CxxTest::WorldDescription.

Definition at line 213 of file RealDescriptions.cpp.

214 {
215 return suites().size();
216 }
unsigned size() const
Definition: LinkedList.cpp:53

◆ numTotalTests()

unsigned CxxTest::RealWorldDescription::numTotalTests ( void  ) const
virtual

Implements CxxTest::WorldDescription.

Definition at line 218 of file RealDescriptions.cpp.

219 {
220 unsigned count = 0;
221 for ( const SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next() )
222 count += sd->numTests();
223 return count;
224 }
int status int void size_t count
Definition: si_signals.h:59

◆ reportError()

void CxxTest::RealWorldDescription::reportError ( const char *  message)
static

Definition at line 294 of file RealDescriptions.cpp.

295 {
296 doWarn( __FILE__, 5, message );
297 }
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7512
void doWarn(const char *file, unsigned line, const char *message)
Definition: TestSuite.cpp:61

◆ setUp()

bool CxxTest::RealWorldDescription::setUp ( )
virtual

Implements CxxTest::Link.

Definition at line 262 of file RealDescriptions.cpp.

263 {
264 for ( GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture() ) {
265 bool ok;
266 _TS_TRY { ok = gf->setUpWorld(); }
267 _TS_LAST_CATCH( { ok = false; } );
268
269 if ( !ok ) {
270 reportError( "Error setting up world" );
271 return false;
272 }
273 }
274
275 return true;
276 }
#define _TS_TRY
Definition: TestSuite.h:209
#define _TS_LAST_CATCH(b)
Definition: TestSuite.h:215
GlobalFixture * nextGlobalFixture()
static GlobalFixture * firstGlobalFixture()
static void reportError(const char *message)

◆ suiteDescription()

const SuiteDescription & CxxTest::RealWorldDescription::suiteDescription ( unsigned  i) const
virtual

Implements CxxTest::WorldDescription.

Definition at line 236 of file RealDescriptions.cpp.

237 {
238 return *(const RealSuiteDescription *)suites().nth( i );
239 }
int i
Definition: cfEzgcd.cc:132
Link * nth(unsigned n)
Definition: LinkedList.cpp:61

◆ suites()

List & CxxTest::RealWorldDescription::suites ( )
static

Definition at line 208 of file RealDescriptions.cpp.

209 {
211 }
STATIC_INST_VAR List _suites

◆ tearDown()

bool CxxTest::RealWorldDescription::tearDown ( )
virtual

Implements CxxTest::Link.

Definition at line 278 of file RealDescriptions.cpp.

279 {
280 for ( GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture() ) {
281 bool ok;
282 _TS_TRY { ok = gf->tearDownWorld(); }
283 _TS_LAST_CATCH( { ok = false; } );
284
285 if ( !ok ) {
286 reportError( "Error tearing down world" );
287 return false;
288 }
289 }
290
291 return true;
292 }
GlobalFixture * prevGlobalFixture()
static GlobalFixture * lastGlobalFixture()

The documentation for this class was generated from the following files: