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