]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testMain.cc
/tmp/cvsZKn66v
[thirdparty/squid.git] / src / tests / testMain.cc
CommitLineData
f5691f9c 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>
8
9
10int
11main( int argc, char* argv[] )
12{
13 // Create the event manager and test controller
14 CPPUNIT_NS::TestResult controller;
15
16 // Add a listener that colllects test result
17 CPPUNIT_NS::TestResultCollector result;
18 controller.addListener( &result );
19
20 // Add a listener that print dots as test run.
21 // use BriefTestProgressListener to get names of each test
22 // even when they pass.
23 CPPUNIT_NS::TextTestProgressListener progress;
24 controller.addListener( &progress );
25
26 // Add the top suite to the test runner
27 CPPUNIT_NS::TestRunner runner;
28 runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
29 runner.run( controller );
30
31 // Print test in a compiler compatible format.
32 CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr );
33 outputter.write();
34
35 return result.wasSuccessful() ? 0 : 1;
36}
37
38