Line data Source code
1 : /*
2 : * File: TestDistanceToBoxRunner.cpp
3 : * Author: chung
4 : *
5 : * Created on Oct 28, 2015, 7:28:27 PM
6 : */
7 :
8 : #include <cppunit/BriefTestProgressListener.h>
9 : #include <cppunit/CompilerOutputter.h>
10 : #include <cppunit/extensions/TestFactoryRegistry.h>
11 : #include <cppunit/TestResult.h>
12 : #include <cppunit/TestResultCollector.h>
13 : #include <cppunit/TestRunner.h>
14 :
15 1 : int main() {
16 : // Create the event manager and test controller
17 1 : CPPUNIT_NS::TestResult controller;
18 :
19 : // Add a listener that colllects test result
20 2 : CPPUNIT_NS::TestResultCollector result;
21 1 : controller.addListener(&result);
22 :
23 : // Add a listener that print dots as test run.
24 2 : CPPUNIT_NS::BriefTestProgressListener progress;
25 1 : controller.addListener(&progress);
26 :
27 : // Add the top suite to the test runner
28 2 : CPPUNIT_NS::TestRunner runner;
29 1 : runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
30 1 : runner.run(controller);
31 :
32 : // Print test in a compiler compatible format.
33 2 : CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
34 1 : outputter.write();
35 :
36 2 : return result.wasSuccessful() ? 0 : 1;
37 3 : }
|