main.cpp 722 B

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