1#ifndef __cxxtest__ErrorFormatter_h__
2#define __cxxtest__ErrorFormatter_h__
63 o <<
wd.strTotalTests(
s ) << (
wd.numTotalTests() == 1 ?
" test" :
" tests");
78 if ( !
tracker().testFailed() ) {
79 ((*_o) <<
".").flush();
86 if ( !
tracker().failedTests() ) {
87 (*_o) <<
"OK!" <<
endl;
93 (*_o) <<
"Success rate: " << (
numPassed * 100 /
desc.numTotalTests()) <<
"%" <<
endl;
98 stop( file, line ) <<
"Trace: " <<
104 stop( file, line ) <<
"Warning: " <<
110 stop( file, line ) <<
"Error: Test failed: " <<
116 stop( file, line ) <<
"Error: Assertion failed: " <<
122 const char *
x,
const char *
y )
124 stop( file, line ) <<
"Error: Expected (" <<
125 xStr <<
" == " <<
yStr <<
"), found (" <<
126 x <<
" != " <<
y <<
")" <<
endl;
132 const void *
y,
unsigned size )
134 stop( file, line ) <<
"Error: Expected " <<
sizeStr <<
" (" <<
size <<
") bytes to be equal at (" <<
137 (*_o) <<
" differs from" <<
endl;
143 const char *
x,
const char *
y,
const char *d )
145 stop( file, line ) <<
"Error: Expected (" <<
146 xStr <<
" == " <<
yStr <<
") up to " <<
dStr <<
" (" << d <<
"), found (" <<
147 x <<
" != " <<
y <<
")" <<
endl;
154 stop( file, line ) <<
"Error: Expected (" <<
155 xStr <<
" != " <<
yStr <<
"), found (" <<
156 value <<
")" <<
endl;
161 const char *
x,
const char *
y )
163 stop( file, line ) <<
"Error: Expected (" <<
164 xStr <<
" < " <<
yStr <<
"), found (" <<
165 x <<
" >= " <<
y <<
")" <<
endl;
170 const char *
x,
const char *
y )
172 stop( file, line ) <<
"Error: Expected (" <<
173 xStr <<
" <= " <<
yStr <<
"), found (" <<
174 x <<
" > " <<
y <<
")" <<
endl;
179 const char *
x,
const char *
y )
181 stop( file, line ) <<
"Error: Expected " <<
relation <<
"( " <<
188 stop( file, line ) <<
"Error: Expected " <<
predicate <<
"( " <<
196 stop( file, line ) <<
"Error: Expected (" <<
expression <<
") to throw (" <<
197 type <<
") but it " << (
otherThrown ?
"threw something else" :
"didn't throw") <<
203 stop( file, line ) <<
"Error: Expected (" <<
expression <<
") not to throw, but it did" <<
250 (*_o) <<
" (null)" <<
endl;
259 const unsigned char *
p = (
const unsigned char *)buffer;
265 (*_o) <<
"}" <<
endl;
virtual OutputStream & operator<<(unsigned)
virtual OutputStream & operator<<(const char *)
static void endl(OutputStream &o)
virtual OutputStream & operator<<(Manipulator m)
void(* Manipulator)(OutputStream &)
virtual const char * suiteName() const =0
virtual const char * testName() const =0
static void runAllTests(TestListener &listener)
const SuiteDescription & suite() const
const WorldDescription & world() const
unsigned failedTests() const
const TestDescription & test() const
const CanonicalForm int const CFList const Variable & y
const char * byteToHex(unsigned char byte)