7 namespace HeliosTests {
57 virtual bool run() = 0;
66 void operator()(std::ostream &out=std::cout,
bool color=
true)
75 bool test(std::ostream &out=std::cout,
bool color=
true);
82 bool const status =
run();
85 if(color) out <<
"\033[1m";
87 if(color) out <<
"\033[0m";
88 out << std::setw(52) << std::left <<
name.c_str() <<
" ";
89 if(color) out <<
"\033[1m";
92 if(status) out <<
"\033[32m";
93 else out <<
"\033[31m";
95 out << (status ?
"PASSED" :
"FAILED");
96 if(color) out <<
"\033[0m\033[1m";
98 if(color) out <<
"\033[0m";
BaseTest class.
Definition: BaseTest.h:20
void operator()(std::ostream &out=std::cout, bool color=true)
Another way to call test function.
Definition: BaseTest.h:66
std::string getName()
Obtain the test name.
Definition: BaseTest.h:43
virtual bool run()=0
Test behavior.
std::string const name
The name for the test.
Definition: BaseTest.h:27
bool test(std::ostream &out=std::cout, bool color=true)
Perform the test and output its final status.
Definition: BaseTest.h:80
BaseTest(std::string const &name)
Base test constructor.
Definition: BaseTest.h:35