1 #ifndef TUT_CONSOLE_REPORTER
2 #define TUT_CONSOLE_REPORTER
23 os <<
'[' << tr.
test <<
"=F]";
25 case tut::test_result::ex_ctor:
26 os <<
'[' << tr.
test <<
"=C]";
29 os <<
'[' << tr.
test <<
"=X]";
32 os <<
'[' << tr.
test <<
"=W]";
35 os <<
'[' << tr.
test <<
"=T]";
37 case tut::test_result::rethrown:
38 os <<
'[' << tr.
test <<
"=P]";
40 case tut::test_result::skipped:
41 os <<
'[' << tr.
test <<
"=S]";
43 case tut::test_result::dummy:
44 throw tut::tut_error(
"console reporter called for dummy test result");
60 std::string current_group;
61 typedef std::vector<tut::test_result> not_passed_list;
62 not_passed_list not_passed;
72 int terminations_count;
83 terminations_count(0),
97 terminations_count(0),
112 if (tr.
group != current_group)
114 os << std::endl << tr.
group <<
": " << std::flush;
115 current_group = tr.
group;
118 os << tr << std::flush;
126 case test_result::rethrown:
130 case test_result::ex_ctor:
137 terminations_count++;
139 case test_result::skipped:
142 case tut::test_result::dummy:
143 assert( (tr.result != tut::test_result::dummy) &&
"Should never be called");
147 (tr.result != tut::test_result::skipped) )
149 not_passed.push_back(tr);
157 if (not_passed.size() > 0)
159 not_passed_list::const_iterator i = not_passed.begin();
160 while (i != not_passed.end())
166 os <<
"---> " <<
"group: " << tr.
group
167 <<
", test: test<" << tr.
test <<
">"
168 << (!tr.
name.empty() ? (std::string(
" : ") + tr.
name) : std::string())
171 #if defined(TUT_USE_POSIX)
172 if(tr.pid != getpid())
174 os <<
" child pid: " << tr.pid << std::endl;
180 case test_result::rethrown:
181 os <<
"assertion failed in child" << std::endl;
184 os <<
"assertion failed" << std::endl;
187 case test_result::ex_ctor:
188 os <<
"unexpected exception" << std::endl;
189 if( tr.exception_typeid !=
"" )
191 os <<
" exception typeid: "
192 << tr.exception_typeid << std::endl;
196 os <<
"would be terminated" << std::endl;
199 os <<
"test passed, but cleanup code (destructor) raised"
200 " an exception" << std::endl;
210 os <<
" failed assertion: `" << tr.
message <<
"`"
215 os <<
" message: `" << tr.
message <<
"`"
226 os <<
"tests summary:";
227 if (terminations_count > 0)
229 os <<
" terminations:" << terminations_count;
231 if (exceptions_count > 0)
233 os <<
" exceptions:" << exceptions_count;
235 if (failures_count > 0)
237 os <<
" failures:" << failures_count;
239 if (warnings_count > 0)
241 os <<
" warnings:" << warnings_count;
244 os <<
" ok:" << ok_count;
246 if(skipped_count > 0)
248 os <<
" skipped:" << skipped_count;
253 virtual bool all_ok()
const
255 return not_passed.empty();
263 exceptions_count = 0;
265 terminations_count = 0;
Definition: tut_exception.hpp:13
void test_completed(const tut::test_result &tr)
Definition: tut_console_reporter.hpp:110
std::string group
Definition: tut_result.hpp:74
test finished successfully
Definition: tut_result.hpp:91
Definition: tut_console_reporter.hpp:58
int test
Definition: tut_result.hpp:79
void run_completed()
Definition: tut_console_reporter.hpp:153
std::string name
Definition: tut_result.hpp:84
void run_started()
Definition: tut_console_reporter.hpp:105
test finished successfully, but test destructor throwed
Definition: tut_result.hpp:94
test failed with ensure() or fail() methods
Definition: tut_result.hpp:92
std::string message
Definition: tut_result.hpp:107
Definition: tut_result.hpp:69
test forced test application to terminate abnormally
Definition: tut_result.hpp:95
test throwed an exceptions
Definition: tut_result.hpp:93
Definition: tut_runner.hpp:38