Loading...
Searching...
No Matches
TestTracker.h
Go to the documentation of this file.
#ifndef __cxxtest__TestTracker_h__
#define __cxxtest__TestTracker_h__
//
// The TestTracker tracks running tests
// The actual work is done in CountingListenerProxy,
// but this way avoids cyclic references TestListener<->CountingListenerProxy
//
#include "factory/globaldefs.h"
#include <cxxtest/TestListener.h>
#include <cxxtest/DummyDescriptions.h>
namespace CxxTest
{
class TestListener;
class TestTracker : public TestListener
{
public:
virtual ~TestTracker();
static TestTracker &tracker();
const TestDescription *fixTest( const TestDescription *d ) const;
const SuiteDescription *fixSuite( const SuiteDescription *d ) const;
const WorldDescription *fixWorld( const WorldDescription *d ) const;
const TestDescription &test() const { return *_test; }
const SuiteDescription &suite() const { return *_suite; }
const WorldDescription &world() const { return *_world; }
bool testFailed() const { return (testFailedAsserts() > 0); }
bool suiteFailed() const { return (suiteFailedTests() > 0); }
bool worldFailed() const { return (failedSuites() > 0); }
unsigned warnings() const { return _warnings; }
unsigned failedTests() const { return _failedTests; }
unsigned testFailedAsserts() const { return _testFailedAsserts; }
unsigned suiteFailedTests() const { return _suiteFailedTests; }
unsigned failedSuites() const { return _failedSuites; }
void enterWorld( const WorldDescription &wd );
void enterSuite( const SuiteDescription &sd );
void enterTest( const TestDescription &td );
void leaveTest( const TestDescription &td );
void leaveSuite( const SuiteDescription &sd );
void leaveWorld( const WorldDescription &wd );
void trace( const char *file, unsigned line, const char *expression );
void warning( const char *file, unsigned line, const char *expression );
void failedTest( const char *file, unsigned line, const char *expression );
void failedAssert( const char *file, unsigned line, const char *expression );
void failedAssertEquals( const char *file, unsigned line,
const char *xStr, const char *yStr,
const char *x, const char *y );
void failedAssertSameData( const char *file, unsigned line,
const char *xStr, const char *yStr,
const char *sizeStr, const void *x,
const void *y, unsigned size );
void failedAssertDelta( const char *file, unsigned line,
const char *xStr, const char *yStr, const char *dStr,
const char *x, const char *y, const char *d );
void failedAssertDiffers( const char *file, unsigned line,
const char *xStr, const char *yStr,
const char *value );
void failedAssertLessThan( const char *file, unsigned line,
const char *xStr, const char *yStr,
const char *x, const char *y );
void failedAssertLessThanEquals( const char *file, unsigned line,
const char *xStr, const char *yStr,
const char *x, const char *y );
void failedAssertPredicate( const char *file, unsigned line,
const char *predicate, const char *xStr, const char *x );
void failedAssertRelation( const char *file, unsigned line,
const char *relation, const char *xStr, const char *yStr,
const char *x, const char *y );
void failedAssertThrows( const char *file, unsigned line,
const char *expression, const char *type,
bool otherThrown );
void failedAssertThrowsNot( const char *file, unsigned line, const char *expression );
private:
TestTracker( const TestTracker & );
TestTracker &operator=( const TestTracker & );
STATIC_VAR bool _created;
TestListener _dummyListener;
DummyWorldDescription _dummyWorld;
unsigned _warnings, _failedTests, _testFailedAsserts, _suiteFailedTests, _failedSuites;
TestListener *_l;
const WorldDescription *_world;
const SuiteDescription *_suite;
const TestDescription *_test;
const TestDescription &dummyTest() const;
const SuiteDescription &dummySuite() const;
const WorldDescription &dummyWorld() const;
void setWorld( const WorldDescription *w );
void setSuite( const SuiteDescription *s );
void setTest( const TestDescription *t );
void countWarning();
void countFailure();
friend class TestRunner;
TestTracker();
void initialize();
void setListener( TestListener *l );
};
inline TestTracker &tracker() { return TestTracker::tracker(); }
};
#endif // __cxxtest__TestTracker_h__
DummyDescriptions.h
TestListener.h
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
l
int l
Definition cfEzgcd.cc:100
x
Variable x
Definition cfModGcd.cc:4090
CxxTest::DummyWorldDescription
Definition DummyDescriptions.h:55
CxxTest::SuiteDescription
Definition Descriptions.h:32
CxxTest::TestDescription
Definition Descriptions.h:16
CxxTest::TestListener
Definition TestListener.h:18
CxxTest::TestListener::TestListener
TestListener()
Definition TestListener.h:20
CxxTest::TestTracker
Definition TestTracker.h:18
CxxTest::TestTracker::failedAssertRelation
void failedAssertRelation(const char *file, unsigned line, const char *relation, const char *xStr, const char *yStr, const char *x, const char *y)
Definition TestTracker.cpp:194
CxxTest::TestTracker::_failedTests
unsigned _failedTests
Definition TestTracker.h:88
CxxTest::TestTracker::~TestTracker
virtual ~TestTracker()
Definition TestTracker.cpp:18
CxxTest::TestTracker::operator=
TestTracker & operator=(const TestTracker &)
CxxTest::TestTracker::suiteFailed
bool suiteFailed() const
Definition TestTracker.h:33
CxxTest::TestTracker::_test
const TestDescription * _test
Definition TestTracker.h:92
CxxTest::TestTracker::_world
const WorldDescription * _world
Definition TestTracker.h:90
CxxTest::TestTracker::fixSuite
const SuiteDescription * fixSuite(const SuiteDescription *d) const
Definition TestTracker.cpp:46
CxxTest::TestTracker::fixWorld
const WorldDescription * fixWorld(const WorldDescription *d) const
Definition TestTracker.cpp:51
CxxTest::TestTracker::trace
void trace(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:115
CxxTest::TestTracker::leaveWorld
void leaveWorld(const WorldDescription &wd)
Definition TestTracker.cpp:109
CxxTest::TestTracker::enterTest
void enterTest(const TestDescription &td)
Definition TestTracker.cpp:90
CxxTest::TestTracker::testFailed
bool testFailed() const
Definition TestTracker.h:32
CxxTest::TestTracker::_warnings
unsigned _warnings
Definition TestTracker.h:88
CxxTest::TestTracker::countWarning
void countWarning()
Definition TestTracker.cpp:233
CxxTest::TestTracker::failedAssertThrows
void failedAssertThrows(const char *file, unsigned line, const char *expression, const char *type, bool otherThrown)
Definition TestTracker.cpp:202
CxxTest::TestTracker::failedAssertPredicate
void failedAssertPredicate(const char *file, unsigned line, const char *predicate, const char *xStr, const char *x)
Definition TestTracker.cpp:187
CxxTest::TestTracker::TestTracker
TestTracker(const TestTracker &)
CxxTest::TestTracker::enterWorld
void enterWorld(const WorldDescription &wd)
Definition TestTracker.cpp:76
CxxTest::TestTracker::TestTracker
TestTracker()
Definition TestTracker.cpp:10
CxxTest::TestTracker::failedAssertLessThanEquals
void failedAssertLessThanEquals(const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y)
Definition TestTracker.cpp:179
CxxTest::TestTracker::failedSuites
unsigned failedSuites() const
Definition TestTracker.h:40
CxxTest::TestTracker::countFailure
void countFailure()
Definition TestTracker.cpp:238
CxxTest::TestTracker::warnings
unsigned warnings() const
Definition TestTracker.h:36
CxxTest::TestTracker::dummyWorld
const WorldDescription & dummyWorld() const
Definition TestTracker.cpp:66
CxxTest::TestTracker::dummySuite
const SuiteDescription & dummySuite() const
Definition TestTracker.cpp:61
CxxTest::TestTracker::_created
STATIC_VAR bool _created
Definition TestTracker.h:85
CxxTest::TestTracker::suite
const SuiteDescription & suite() const
Definition TestTracker.h:29
CxxTest::TestTracker::world
const WorldDescription & world() const
Definition TestTracker.h:30
CxxTest::TestTracker::failedTest
void failedTest(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:126
CxxTest::TestTracker::setListener
void setListener(TestListener *l)
Definition TestTracker.cpp:71
CxxTest::TestTracker::testFailedAsserts
unsigned testFailedAsserts() const
Definition TestTracker.h:38
CxxTest::TestTracker::failedAssert
void failedAssert(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:132
CxxTest::TestTracker::enterSuite
void enterSuite(const SuiteDescription &sd)
Definition TestTracker.cpp:83
CxxTest::TestTracker::failedAssertDiffers
void failedAssertDiffers(const char *file, unsigned line, const char *xStr, const char *yStr, const char *value)
Definition TestTracker.cpp:163
CxxTest::TestTracker::failedAssertEquals
void failedAssertEquals(const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y)
Definition TestTracker.cpp:138
CxxTest::TestTracker::setWorld
void setWorld(const WorldDescription *w)
Definition TestTracker.cpp:216
CxxTest::TestTracker::tracker
static TestTracker & tracker()
Definition TestTracker.cpp:22
CxxTest::TestTracker::_dummyListener
TestListener _dummyListener
Definition TestTracker.h:86
CxxTest::TestTracker::failedTests
unsigned failedTests() const
Definition TestTracker.h:37
CxxTest::TestTracker::setSuite
void setSuite(const SuiteDescription *s)
Definition TestTracker.cpp:222
CxxTest::TestTracker::_testFailedAsserts
unsigned _testFailedAsserts
Definition TestTracker.h:88
CxxTest::TestTracker::_dummyWorld
DummyWorldDescription _dummyWorld
Definition TestTracker.h:87
CxxTest::TestTracker::initialize
void initialize()
Definition TestTracker.cpp:28
CxxTest::TestTracker::worldFailed
bool worldFailed() const
Definition TestTracker.h:34
CxxTest::TestTracker::fixTest
const TestDescription * fixTest(const TestDescription *d) const
Definition TestTracker.cpp:41
CxxTest::TestTracker::test
const TestDescription & test() const
Definition TestTracker.h:28
CxxTest::TestTracker::_failedSuites
unsigned _failedSuites
Definition TestTracker.h:88
CxxTest::TestTracker::suiteFailedTests
unsigned suiteFailedTests() const
Definition TestTracker.h:39
CxxTest::TestTracker::_l
TestListener * _l
Definition TestTracker.h:89
CxxTest::TestTracker::failedAssertDelta
void failedAssertDelta(const char *file, unsigned line, const char *xStr, const char *yStr, const char *dStr, const char *x, const char *y, const char *d)
Definition TestTracker.cpp:155
CxxTest::TestTracker::dummyTest
const TestDescription & dummyTest() const
Definition TestTracker.cpp:56
CxxTest::TestTracker::warning
void warning(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:120
CxxTest::TestTracker::setTest
void setTest(const TestDescription *t)
Definition TestTracker.cpp:228
CxxTest::TestTracker::leaveSuite
void leaveSuite(const SuiteDescription &sd)
Definition TestTracker.cpp:103
CxxTest::TestTracker::failedAssertThrowsNot
void failedAssertThrowsNot(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:210
CxxTest::TestTracker::_suite
const SuiteDescription * _suite
Definition TestTracker.h:91
CxxTest::TestTracker::leaveTest
void leaveTest(const TestDescription &td)
Definition TestTracker.cpp:97
CxxTest::TestTracker::_suiteFailedTests
unsigned _suiteFailedTests
Definition TestTracker.h:88
CxxTest::TestTracker::TestRunner
friend class TestRunner
Definition TestTracker.h:104
CxxTest::TestTracker::failedAssertLessThan
void failedAssertLessThan(const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, const char *y)
Definition TestTracker.cpp:171
CxxTest::TestTracker::failedAssertSameData
void failedAssertSameData(const char *file, unsigned line, const char *xStr, const char *yStr, const char *sizeStr, const void *x, const void *y, unsigned size)
Definition TestTracker.cpp:146
CxxTest::WorldDescription
Definition Descriptions.h:54
y
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53
w
const CanonicalForm & w
Definition facAbsFact.cc:51
globaldefs.h
STATIC_VAR
#define STATIC_VAR
Definition globaldefs.h:7
CxxTest
Definition Descriptions.cpp:7
CxxTest::s
char * s
Definition ValueTraits.h:143
CxxTest::tracker
TestTracker & tracker()
Definition TestTracker.h:111