Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <cppunit/BriefTestProgressListener.h>
00012 #include <cppunit/CompilerOutputter.h>
00013 #include <cppunit/extensions/TestFactoryRegistry.h>
00014 #include <cppunit/TestResult.h>
00015 #include <cppunit/TestResultCollector.h>
00016 #include <cppunit/TestRunner.h>
00017 #include <exception>
00018 #include <iostream>
00019
00020 int main(int argc, char** argv)
00021 {
00022 try
00023 {
00024 CPPUNIT_NS::TestResult controller;
00025 CPPUNIT_NS::TestResultCollector result;
00026 controller.addListener(&result);
00027 CPPUNIT_NS::BriefTestProgressListener progress;
00028 controller.addListener(&progress);
00029 CPPUNIT_NS::TestRunner runner;
00030 runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
00031 runner.run(controller);
00032 CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
00033 outputter.write();
00034 return result.wasSuccessful() ? 0 : -1;
00035 }
00036 catch(const std::exception& exc)
00037 {
00038 std::cout << exc.what() << std::endl;
00039 }
00040 catch(...)
00041 {
00042 std::cout << "Unknown exception." << std::endl;
00043 }
00044 return -1;
00045 }