20 #ifndef _MAINTEST_HXX_
21 #define _MAINTEST_HXX_
23 #include <cppunit/CompilerOutputter.h>
24 #include <cppunit/TestResult.h>
25 #include <cppunit/TestResultCollector.h>
26 #include <cppunit/TextTestProgressListener.h>
27 #include <cppunit/BriefTestProgressListener.h>
28 #include <cppunit/extensions/TestFactoryRegistry.h>
29 #include <cppunit/TestRunner.h>
42 int main(
int argc,
char* argv[])
45 CPPUNIT_NS::TestResult controller;
48 CPPUNIT_NS::TestResultCollector result;
49 controller.addListener( &result );
53 CPPUNIT_NS::TextTestProgressListener progress;
55 CPPUNIT_NS::BriefTestProgressListener progress;
57 controller.addListener( &progress );
61 CPPUNIT_NS::Test *suite =
62 CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
66 CPPUNIT_NS::TestRunner runner;
67 runner.addTest( suite );
68 runner.run( controller);
72 std::ofstream testFile;
73 testFile.open(
"UnitTestsResult.txt", std::ios::out | std::ios::trunc);
75 CPPUNIT_NS::CompilerOutputter outputter( &result, testFile );
80 bool wasSucessful = result.wasSuccessful();
85 return wasSucessful ? 0 : 1;