My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes
CxxTest::RealTestDescription Class Referenceabstract

#include <RealDescriptions.h>

Public Member Functions

 RealTestDescription ()
 
 RealTestDescription (List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName)
 
void initialize (List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName)
 
const char * file () const
 
unsigned line () const
 
const char * testName () const
 
const char * suiteName () const
 
TestDescriptionnext ()
 
const TestDescriptionnext () const
 
TestSuitesuite () const
 
bool setUp ()
 
void run ()
 
bool tearDown ()
 
- Public Member Functions inherited from CxxTest::TestDescription
virtual ~TestDescription ()
 
virtual const char * file () const =0
 
virtual unsigned line () const =0
 
virtual const char * testName () const =0
 
virtual const char * suiteName () const =0
 
virtual void run ()=0
 
virtual const TestDescriptionnext () const =0
 
virtual TestDescriptionnext ()=0
 

Private Member Functions

 RealTestDescription (const RealTestDescription &)
 
RealTestDescriptionoperator= (const RealTestDescription &)
 
virtual void runTest ()=0
 

Private Attributes

SuiteDescription_suite
 
unsigned _line
 
const char * _testName
 

Detailed Description

Definition at line 14 of file RealDescriptions.h.

Constructor & Destructor Documentation

◆ RealTestDescription() [1/3]

CxxTest::RealTestDescription::RealTestDescription ( )

Definition at line 13 of file RealDescriptions.cpp.

14 {
15 }

◆ RealTestDescription() [2/3]

CxxTest::RealTestDescription::RealTestDescription ( List argList,
SuiteDescription argSuite,
unsigned  argLine,
const char *  argTestName 
)

Definition at line 17 of file RealDescriptions.cpp.

21 {
22 initialize( argList, argSuite, argLine, argTestName );
23 }
void initialize()

◆ RealTestDescription() [3/3]

CxxTest::RealTestDescription::RealTestDescription ( const RealTestDescription )
private

Member Function Documentation

◆ file()

const char * CxxTest::RealTestDescription::file ( ) const
virtual

Implements CxxTest::TestDescription.

Definition at line 84 of file RealDescriptions.cpp.

84{ return _suite->file(); }
virtual const char * file() const =0

◆ initialize()

void CxxTest::RealTestDescription::initialize ( List argList,
SuiteDescription argSuite,
unsigned  argLine,
const char *  argTestName 
)

Definition at line 25 of file RealDescriptions.cpp.

29 {
30 _suite = &argSuite;
31 _line = argLine;
32 _testName = argTestName;
33 attach( argList );
34 }

◆ line()

unsigned CxxTest::RealTestDescription::line ( ) const
virtual

Implements CxxTest::TestDescription.

Definition at line 85 of file RealDescriptions.cpp.

85{ return _line; }

◆ next() [1/2]

TestDescription * CxxTest::RealTestDescription::next ( )
virtual

Implements CxxTest::TestDescription.

Definition at line 89 of file RealDescriptions.cpp.

◆ next() [2/2]

const TestDescription * CxxTest::RealTestDescription::next ( ) const
virtual

Implements CxxTest::TestDescription.

Definition at line 90 of file RealDescriptions.cpp.

90{ return (const RealTestDescription *)Link::next(); }

◆ operator=()

RealTestDescription & CxxTest::RealTestDescription::operator= ( const RealTestDescription )
private

◆ run()

void CxxTest::RealTestDescription::run ( )
virtual

Implements CxxTest::TestDescription.

Definition at line 94 of file RealDescriptions.cpp.

95 {
96 _TS_TRY { runTest(); }
97 _TS_CATCH_ABORT( {} )
98 ___TSM_CATCH( file(), line(), "Exception thrown from test" );
99 }
#define _TS_TRY
Definition: TestSuite.h:209
#define _TS_CATCH_ABORT(b)
Definition: TestSuite.h:216
#define ___TSM_CATCH(f, l, m)
Definition: TestSuite.h:210

◆ runTest()

virtual void CxxTest::RealTestDescription::runTest ( )
privatepure virtual

◆ setUp()

bool CxxTest::RealTestDescription::setUp ( )
virtual

Implements CxxTest::Link.

Definition at line 36 of file RealDescriptions.cpp.

37 {
38 if ( !suite() )
39 return false;
40
41 for ( GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture() ) {
42 bool ok;
43 _TS_TRY { ok = gf->setUp(); }
44 _TS_LAST_CATCH( { ok = false; } );
45
46 if ( !ok ) {
47 doFailTest( file(), line(), "Error in GlobalFixture::setUp()" );
48 return false;
49 }
50 }
51
52 _TS_TRY {
53 _TSM_ASSERT_THROWS_NOTHING( file(), line(), "Exception thrown from setUp()", suite()->setUp() );
54 }
55 _TS_CATCH_ABORT( { return false; } );
56
57 return true;
58 }
#define _TS_LAST_CATCH(b)
Definition: TestSuite.h:215
#define _TSM_ASSERT_THROWS_NOTHING(f, l, m, e)
Definition: TestSuite.h:465
GlobalFixture * nextGlobalFixture()
static GlobalFixture * firstGlobalFixture()
void doFailTest(const char *file, unsigned line, const char *message)
Definition: TestSuite.cpp:66

◆ suite()

TestSuite * CxxTest::RealTestDescription::suite ( ) const

Definition at line 92 of file RealDescriptions.cpp.

92{ return _suite->suite(); }
virtual TestSuite * suite() const =0

◆ suiteName()

const char * CxxTest::RealTestDescription::suiteName ( ) const
virtual

Implements CxxTest::TestDescription.

Definition at line 87 of file RealDescriptions.cpp.

87{ return _suite->suiteName(); }
virtual const char * suiteName() const =0

◆ tearDown()

bool CxxTest::RealTestDescription::tearDown ( )
virtual

Implements CxxTest::Link.

Definition at line 60 of file RealDescriptions.cpp.

61 {
62 if ( !suite() )
63 return false;
64
65 _TS_TRY {
66 _TSM_ASSERT_THROWS_NOTHING( file(), line(), "Exception thrown from tearDown()", suite()->tearDown() );
67 }
68 _TS_CATCH_ABORT( { return false; } );
69
70 for ( GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture() ) {
71 bool ok;
72 _TS_TRY { ok = gf->tearDown(); }
73 _TS_LAST_CATCH( { ok = false; } );
74
75 if ( !ok ) {
76 doFailTest( file(), line(), "Error in GlobalFixture::tearDown()" );
77 return false;
78 }
79 }
80
81 return true;
82 }
GlobalFixture * prevGlobalFixture()
static GlobalFixture * lastGlobalFixture()

◆ testName()

const char * CxxTest::RealTestDescription::testName ( ) const
virtual

Implements CxxTest::TestDescription.

Definition at line 86 of file RealDescriptions.cpp.

86{ return _testName; }

Field Documentation

◆ _line

unsigned CxxTest::RealTestDescription::_line
private

Definition at line 42 of file RealDescriptions.h.

◆ _suite

SuiteDescription* CxxTest::RealTestDescription::_suite
private

Definition at line 41 of file RealDescriptions.h.

◆ _testName

const char* CxxTest::RealTestDescription::_testName
private

Definition at line 43 of file RealDescriptions.h.


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