1 #include <cppunit/BriefTestProgressListener.h>
2 #include <cppunit/TextTestProgressListener.h>
3 #include <cppunit/CompilerOutputter.h>
4 #include <cppunit/extensions/TestFactoryRegistry.h>
5 #include <cppunit/TestResult.h>
6 #include <cppunit/TestResultCollector.h>
7 #include <cppunit/TestRunner.h>
10 main( int argc
, char* argv
[] )
12 // Create the event manager and test controller
13 CPPUNIT_NS::TestResult controller
;
15 // Add a listener that colllects test result
16 CPPUNIT_NS::TestResultCollector result
;
17 controller
.addListener( &result
);
19 // Add a listener that print dots as test run.
20 // use BriefTestProgressListener to get names of each test
21 // even when they pass.
22 CPPUNIT_NS::TextTestProgressListener progress
;
23 controller
.addListener( &progress
);
25 // Add the top suite to the test runner
26 CPPUNIT_NS::TestRunner runner
;
27 runner
.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
28 runner
.run( controller
);
30 // Print test in a compiler compatible format.
31 CPPUNIT_NS::CompilerOutputter
outputter( &result
, std::cerr
);
34 return result
.wasSuccessful() ? 0 : 1;