1 |
tim |
72 |
#include <cppunit/CompilerOutputter.h> |
2 |
|
|
#include <cppunit/extensions/TestFactoryRegistry.h> |
3 |
|
|
#include <cppunit/ui/text/TestRunner.h> |
4 |
|
|
|
5 |
|
|
|
6 |
|
|
int main(int argc, char* argv[]) |
7 |
|
|
{ |
8 |
|
|
// Get the top level suite from the registry |
9 |
|
|
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); |
10 |
|
|
|
11 |
|
|
// Adds the test to the list of test to run |
12 |
|
|
CPPUNIT_NS::TextUi::TestRunner runner; |
13 |
|
|
runner.addTest( suite ); |
14 |
|
|
|
15 |
|
|
// Change the default outputter to a compiler error format outputter |
16 |
|
|
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(), |
17 |
|
|
std::cerr ) ); |
18 |
|
|
// Run the test. |
19 |
|
|
bool wasSucessful = runner.run(); |
20 |
|
|
|
21 |
|
|
// Return error code 1 if the one of test failed. |
22 |
|
|
return wasSucessful ? 0 : 1; |
23 |
|
|
} |
24 |
|
|
|