CMS 3D CMS Logo

test_catch2_EDAnalyzer.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 
18  SECTION("base configuration is OK") { REQUIRE_NOTHROW(edm::test::TestProcessor(config)); }
19 
20  SECTION("No event data") {
22 
23  REQUIRE_THROWS_AS(tester.test(), cms::Exception);
24  //If the module does not throw when given no data, substitute
25  //REQUIRE_NOTHROW for REQUIRE_THROWS_AS
26  }
27 
28  SECTION("beginJob and endJob only") {
30 
31  REQUIRE_NOTHROW(tester.testBeginAndEndJobOnly());
32  }
33 
34  SECTION("Run with no LuminosityBlocks") {
36 
37  REQUIRE_NOTHROW(tester.testRunWithNoLuminosityBlocks());
38  }
39 
40  SECTION("LuminosityBlock with no Events") {
42 
43  REQUIRE_NOTHROW(tester.testLuminosityBlockWithNoEvents());
44  }
45 }
46 
47 //Add additional TEST_CASEs to exercise the modules capabilities
Definition: config.py:1
edm::test::Event test(T &&... iArgs)
TEST_CASE("Standard checks of __class__", s_tag)
static constexpr auto s_tag