Loading...
Searching...
No Matches
TestSuite.cpp
Go to the documentation of this file.
#ifndef __cxxtest__TestSuite_cpp__
#define __cxxtest__TestSuite_cpp__
#include <cxxtest/TestSuite.h>
namespace CxxTest
{
//
// TestSuite members
//
TestSuite::~TestSuite() {}
void TestSuite::setUp() {}
void TestSuite::tearDown() {}
//
// Test-aborting stuff
//
static bool currentAbortTestOnFail = false;
bool abortTestOnFail()
{
return currentAbortTestOnFail;
}
void setAbortTestOnFail( bool value )
{
currentAbortTestOnFail = value;
}
void doAbortTest()
{
# if defined(_CXXTEST_HAVE_EH)
if ( currentAbortTestOnFail )
throw AbortTest();
# endif // _CXXTEST_HAVE_EH
}
//
// Max dump size
//
static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE;
unsigned maxDumpSize()
{
return currentMaxDumpSize;
}
void setMaxDumpSize( unsigned value )
{
currentMaxDumpSize = value;
}
//
// Some non-template functions
//
void doTrace( const char *file, unsigned line, const char *message )
{
tracker().trace( file, line, message );
}
void doWarn( const char *file, unsigned line, const char *message )
{
tracker().warning( file, line, message );
}
void doFailTest( const char *file, unsigned line, const char *message )
{
tracker().failedTest( file, line, message );
TS_ABORT();
}
void doFailAssert( const char *file, unsigned line,
const char *expression, const char *message )
{
if ( message )
tracker().failedTest( file, line, message );
tracker().failedAssert( file, line, expression );
TS_ABORT();
}
bool sameData( const void *x, const void *y, unsigned size )
{
if ( size == 0 )
return true;
if ( x == y )
return true;
if ( !x || !y )
return false;
const char *cx = (const char *)x;
const char *cy = (const char *)y;
while ( size -- )
if ( *cx++ != *cy++ )
return false;
return true;
}
void doAssertSameData( const char *file, unsigned line,
const char *xExpr, const void *x,
const char *yExpr, const void *y,
const char *sizeExpr, unsigned size,
const char *message )
{
if ( !sameData( x, y, size ) ) {
if ( message )
tracker().failedTest( file, line, message );
tracker().failedAssertSameData( file, line, xExpr, yExpr, sizeExpr, x, y, size );
TS_ABORT();
}
}
void doFailAssertThrows( const char *file, unsigned line,
const char *expr, const char *type,
bool otherThrown,
const char *message )
{
if ( message )
tracker().failedTest( file, line, message );
tracker().failedAssertThrows( file, line, expr, type, otherThrown );
TS_ABORT();
}
void doFailAssertThrowsNot( const char *file, unsigned line,
const char *expression, const char *message )
{
if ( message )
tracker().failedTest( file, line, message );
tracker().failedAssertThrowsNot( file, line, expression );
TS_ABORT();
}
};
#endif // __cxxtest__TestSuite_cpp__
CXXTEST_MAX_DUMP_SIZE
#define CXXTEST_MAX_DUMP_SIZE
Definition Flags.h:52
TestSuite.h
TS_ABORT
#define TS_ABORT()
Definition TestSuite.h:31
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
x
Variable x
Definition cfModGcd.cc:4090
CxxTest::TestSuite::setUp
virtual void setUp()
Definition TestSuite.cpp:12
CxxTest::TestSuite::~TestSuite
virtual ~TestSuite()
Definition TestSuite.cpp:11
CxxTest::TestSuite::tearDown
virtual void tearDown()
Definition TestSuite.cpp:13
CxxTest::TestTracker::trace
void trace(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:115
CxxTest::TestTracker::failedAssertThrows
void failedAssertThrows(const char *file, unsigned line, const char *expression, const char *type, bool otherThrown)
Definition TestTracker.cpp:202
CxxTest::TestTracker::failedTest
void failedTest(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:126
CxxTest::TestTracker::failedAssert
void failedAssert(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:132
CxxTest::TestTracker::warning
void warning(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:120
CxxTest::TestTracker::failedAssertThrowsNot
void failedAssertThrowsNot(const char *file, unsigned line, const char *expression)
Definition TestTracker.cpp:210
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
y
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53
message
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
CxxTest
Definition Descriptions.cpp:7
CxxTest::currentMaxDumpSize
static unsigned currentMaxDumpSize
Definition TestSuite.cpp:41
CxxTest::abortTestOnFail
bool abortTestOnFail()
Definition TestSuite.cpp:20
CxxTest::doFailAssert
void doFailAssert(const char *file, unsigned line, const char *expression, const char *message)
Definition TestSuite.cpp:72
CxxTest::doFailAssertThrows
void doFailAssertThrows(const char *file, unsigned line, const char *expr, const char *type, bool otherThrown, const char *message)
Definition TestSuite.cpp:115
CxxTest::maxDumpSize
unsigned maxDumpSize()
Definition TestSuite.cpp:43
CxxTest::doAbortTest
void doAbortTest()
Definition TestSuite.cpp:30
CxxTest::doAssertSameData
void doAssertSameData(const char *file, unsigned line, const char *xExpr, const void *x, const char *yExpr, const void *y, const char *sizeExpr, unsigned size, const char *message)
Definition TestSuite.cpp:101
CxxTest::doFailAssertThrowsNot
void doFailAssertThrowsNot(const char *file, unsigned line, const char *expression, const char *message)
Definition TestSuite.cpp:127
CxxTest::doTrace
void doTrace(const char *file, unsigned line, const char *message)
Definition TestSuite.cpp:56
CxxTest::doWarn
void doWarn(const char *file, unsigned line, const char *message)
Definition TestSuite.cpp:61
CxxTest::setMaxDumpSize
void setMaxDumpSize(unsigned value)
Definition TestSuite.cpp:48
CxxTest::currentAbortTestOnFail
static bool currentAbortTestOnFail
Definition TestSuite.cpp:18
CxxTest::doFailTest
void doFailTest(const char *file, unsigned line, const char *message)
Definition TestSuite.cpp:66
CxxTest::tracker
TestTracker & tracker()
Definition TestTracker.h:111
CxxTest::sameData
bool sameData(const void *x, const void *y, unsigned size)
Definition TestSuite.cpp:81
CxxTest::setAbortTestOnFail
void setAbortTestOnFail(bool value)
Definition TestSuite.cpp:25
CxxTest::AbortTest
Definition TestSuite.h:29