Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:50

0001 /**
0002  * This file defines the executable that will run the tests.
0003  *
0004  * Author: M. De Mattia demattia@.pd.infn.it
0005  *
0006  * class description:
0007  * 
0008  *
0009  */
0010 
0011 // In case this does not work anymore uncomment the rest
0012 // #include <Utilities/Testing/interface/CppUnit_testdriver.icpp>
0013 
0014 #include <cppunit/TestFixture.h>
0015 #include <cppunit/extensions/HelperMacros.h>
0016 #include <cppunit/TestResult.h>
0017 #include <cppunit/TestCaller.h>
0018 #include <cppunit/TestRunner.h>
0019 #include <cppunit/ui/text/TestRunner.h>
0020 #include <cppunit/TestResultCollector.h>
0021 #include <cppunit/TextTestProgressListener.h>
0022 #include <cppunit/CompilerOutputter.h>
0023 #include <cppunit/extensions/TestFactoryRegistry.h>
0024 #include <cppunit/CompilerOutputter.h>
0025 // #include <cppunit/TextTestProgressListener.h>
0026 #include <cppunit/BriefTestProgressListener.h> 
0027 
0028 /**
0029  * Main function used to run all tests.
0030  * We are not using the one in #include <Utilities/Testing/interface/CppUnit_testdriver.icpp>
0031  * because we use the BriefTestProgressListener to output the name of each test.
0032  */
0033 
0034 int main( int argc, char* argv[] )
0035 {
0036   std::string testPath = (argc > 1) ? std::string(argv[1]) : "";
0037   CppUnit::TextUi::TestRunner runner;
0038   CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
0039   runner.addTest( registry.makeTest() );
0040 
0041   // Outputs the name of each test when it is executed.
0042   CppUnit::BriefTestProgressListener progress;
0043   runner.eventManager().addListener( &progress );
0044   if (!runner.run()) { return 1; }
0045   return 0;
0046 }