1#ifndef __cxxtest__ErrorFormatter_h__
2#define __cxxtest__ErrorFormatter_h__
78 if ( !
tracker().testFailed() ) {
79 ((*_o) <<
".").flush();
86 if ( !
tracker().failedTests() ) {
87 (*_o) <<
"OK!" <<
endl;
93 (*_o) <<
"Success rate: " << (numPassed * 100 / desc.
numTotalTests()) <<
"%" <<
endl;
96 void trace(
const char *file,
unsigned line,
const char *expression )
98 stop( file, line ) <<
"Trace: " <<
102 void warning(
const char *file,
unsigned line,
const char *expression )
104 stop( file, line ) <<
"Warning: " <<
108 void failedTest(
const char *file,
unsigned line,
const char *expression )
110 stop( file, line ) <<
"Error: Test failed: " <<
114 void failedAssert(
const char *file,
unsigned line,
const char *expression )
116 stop( file, line ) <<
"Error: Assertion failed: " <<
121 const char *xStr,
const char *yStr,
122 const char *
x,
const char *
y )
124 stop( file, line ) <<
"Error: Expected (" <<
125 xStr <<
" == " << yStr <<
"), found (" <<
126 x <<
" != " <<
y <<
")" <<
endl;
130 const char *xStr,
const char *yStr,
131 const char *sizeStr,
const void *
x,
132 const void *
y,
unsigned size )
134 stop( file, line ) <<
"Error: Expected " << sizeStr <<
" (" <<
size <<
") bytes to be equal at (" <<
135 xStr <<
") and (" << yStr <<
"), found:" <<
endl;
137 (*_o) <<
" differs from" <<
endl;
142 const char *xStr,
const char *yStr,
const char *dStr,
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;
151 const char *xStr,
const char *yStr,
154 stop( file, line ) <<
"Error: Expected (" <<
155 xStr <<
" != " << yStr <<
"), found (" <<
156 value <<
")" <<
endl;
160 const char *xStr,
const char *yStr,
161 const char *
x,
const char *
y )
163 stop( file, line ) <<
"Error: Expected (" <<
164 xStr <<
" < " << yStr <<
"), found (" <<
165 x <<
" >= " <<
y <<
")" <<
endl;
169 const char *xStr,
const char *yStr,
170 const char *
x,
const char *
y )
172 stop( file, line ) <<
"Error: Expected (" <<
173 xStr <<
" <= " << yStr <<
"), found (" <<
174 x <<
" > " <<
y <<
")" <<
endl;
178 const char *relation,
const char *xStr,
const char *yStr,
179 const char *
x,
const char *
y )
181 stop( file, line ) <<
"Error: Expected " << relation <<
"( " <<
182 xStr <<
", " << yStr <<
" ), found !" << relation <<
"( " <<
x <<
", " <<
y <<
" )" <<
endl;
186 const char *predicate,
const char *xStr,
const char *
x )
188 stop( file, line ) <<
"Error: Expected " << predicate <<
"( " <<
189 xStr <<
" ), found !" << predicate <<
"( " <<
x <<
" )" <<
endl;
193 const char *expression,
const char *type,
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;
255 unsigned dumpSize =
size;
259 const unsigned char *
p = (
const unsigned char *)buffer;
261 for (
unsigned i = 0;
i < dumpSize; ++
i )
263 if ( dumpSize <
size )
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
char * strTotalTests(char *) const
virtual unsigned numTotalTests(void) const =0
const CanonicalForm int const CFList const Variable & y
const char * byteToHex(unsigned char byte)