FWCore
Skeletons
mkTemplates
EDProducer
test_catch2_EDProducer.cc
Go to the documentation of this file.
1
#include "catch.hpp"
2
#include "
FWCore/TestProcessor/interface/TestProcessor.h
"
3
#include "
FWCore/Utilities/interface/Exception.h
"
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
edm::test::TestProcessor::Config
config
{baseConfig};
18
SECTION(
"base configuration is OK"
) { REQUIRE_NOTHROW(
edm::test::TestProcessor
(
config
)); }
19
20
SECTION(
"No event data"
) {
21
edm::test::TestProcessor
tester(
config
);
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"
) {
29
edm::test::TestProcessor
tester(
config
);
30
31
REQUIRE_NOTHROW(tester.
testBeginAndEndJobOnly
());
32
}
33
34
SECTION(
"Run with no LuminosityBlocks"
) {
35
edm::test::TestProcessor
tester(
config
);
36
37
REQUIRE_NOTHROW(tester.
testRunWithNoLuminosityBlocks
());
38
}
39
40
SECTION(
"LuminosityBlock with no Events"
) {
41
edm::test::TestProcessor
tester(
config
);
42
43
REQUIRE_NOTHROW(tester.
testLuminosityBlockWithNoEvents
());
44
}
45
}
46
47
//Add additional TEST_CASEs to exercise the modules capabilities
edm::test::TestProcessor::testLuminosityBlockWithNoEvents
void testLuminosityBlockWithNoEvents()
Definition:
TestProcessor.h:231
s_tag
static constexpr auto s_tag
Definition:
test_catch2_EDProducer.cc:5
edm::test::TestProcessor::test
edm::test::Event test(T &&... iArgs)
Definition:
TestProcessor.h:171
edm::test::TestProcessorConfig
Definition:
TestProcessor.h:90
TestProcessor.h
config
Definition:
config.py:1
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::test::TestProcessor::testBeginAndEndJobOnly
void testBeginAndEndJobOnly()
Definition:
TestProcessor.h:204
edm::test::TestProcessor
Definition:
TestProcessor.h:158
edm::test::TestProcessor::testRunWithNoLuminosityBlocks
void testRunWithNoLuminosityBlocks()
Definition:
TestProcessor.h:220
Exception
Definition:
hltDiff.cc:245
Exception.h
TEST_CASE
TEST_CASE("Standard checks of __class__", s_tag)
Definition:
test_catch2_EDProducer.cc:7
Generated for CMSSW Reference Manual by
1.8.16