1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#include <tut/tut.hpp>
#include <tut/tut_reporter.hpp>
#include <exception>
#include <iostream>
using tut::runner;
using std::exception;
using std::cout;
using std::cerr;
using std::endl;
namespace tut
{
test_runner_singleton runner;
}
int main()
{
tut::reporter reporter;
try
{
tut::runner.get().set_callback(&reporter);
tut::runner.get().run_tests();
if (!reporter.all_ok())
{
cout << endl;
cout << "*********************************************************"
<< endl;
cout << "WARNING: THIS VERSION OF TUT IS UNUSABLE DUE TO ERRORS!!!"
<< endl;
cout << "*********************************************************"
<< endl;
}
else
{
cout << endl;
cout << "THIS VERSION OF TUT IS CORRECT" << endl;
}
}
catch (const std::exception& ex)
{
cerr << "tut raised ex: " << ex.what() << endl;
return 1;
}
catch( ... )
{
cerr << "tut raised unknown exception" << endl;
return 1;
}
return !reporter.all_ok();
}
|