CMS 3D CMS Logo

test_catch2_EDProducer.cc
Go to the documentation of this file.
1 #include "catch.hpp"
4 
5 static constexpr auto s_tag = "[__class__]";
6 
7 TEST_CASE("Standard checks of __class__", s_tag) {
8  const std::string baseConfig{
9 R"_(from FWCore.TestProcessor.TestProcess import *
10 process = TestProcess()
11 process.toTest = cms.EDProducer("__class__"
12 #necessary configuration parameters
13  )
14 process.moduleToTest(process.toTest)
15 )_"
16  };
17 
19  SECTION("base configuration is OK") {
20  REQUIRE_NOTHROW(edm::test::TestProcessor(config));
21  }
22 
23  SECTION("No event data") {
25 
26  REQUIRE_THROWS_AS(tester.test(), cms::Exception);
27  //If the module does not throw when given no data, substitute
28  //REQUIRE_NOTHROW for REQUIRE_THROWS_AS
29  }
30 
31  SECTION("beginJob and endJob only") {
33 
34  REQUIRE_NOTHROW(tester.testBeginAndEndJobOnly());
35  }
36 
37  SECTION("Run with no LuminosityBlocks") {
39 
40  REQUIRE_NOTHROW(tester.testRunWithNoLuminosityBlocks());
41  }
42 
43  SECTION("LuminosityBlock with no Events") {
45 
46  REQUIRE_NOTHROW(tester.testLuminosityBlockWithNoEvents());
47  }
48 
49 }
50 
51 //Add additional TEST_CASEs to exercise the modules capabilities
Definition: config.py:1
#define constexpr
edm::test::Event test(T &&...iArgs)
static auto s_tag
TEST_CASE("Standard checks of __class__", s_tag)