Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:09

0001 #include "catch.hpp"
0002 #include "FWCore/TestProcessor/interface/TestProcessor.h"
0003 #include "FWCore/Utilities/interface/Exception.h"
0004 
0005 static constexpr auto s_tag = "[__class__]";
0006 
0007 TEST_CASE("Standard checks of __class__", s_tag) {
0008   const std::string baseConfig{
0009       R"_(from FWCore.TestProcessor.TestProcess import *
0010 process = TestProcess()
0011 process.toTest = cms.EDProducer("__class__"
0012 #necessary configuration parameters
0013  )
0014 process.moduleToTest(process.toTest)
0015 )_"};
0016 
0017   edm::test::TestProcessor::Config config{baseConfig};
0018   SECTION("base configuration is OK") { REQUIRE_NOTHROW(edm::test::TestProcessor(config)); }
0019 
0020   SECTION("No event data") {
0021     edm::test::TestProcessor tester(config);
0022 
0023     REQUIRE_THROWS_AS(tester.test(), cms::Exception);
0024     //If the module does not throw when given no data, substitute
0025     //REQUIRE_NOTHROW for REQUIRE_THROWS_AS
0026   }
0027 
0028   SECTION("beginJob and endJob only") {
0029     edm::test::TestProcessor tester(config);
0030 
0031     REQUIRE_NOTHROW(tester.testBeginAndEndJobOnly());
0032   }
0033 
0034   SECTION("Run with no LuminosityBlocks") {
0035     edm::test::TestProcessor tester(config);
0036 
0037     REQUIRE_NOTHROW(tester.testRunWithNoLuminosityBlocks());
0038   }
0039 
0040   SECTION("LuminosityBlock with no Events") {
0041     edm::test::TestProcessor tester(config);
0042 
0043     REQUIRE_NOTHROW(tester.testLuminosityBlockWithNoEvents());
0044   }
0045 }
0046 
0047 //Add additional TEST_CASEs to exercise the modules capabilities