Skip to content

Commit

Permalink
Add check of put values to unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
wddgit committed Nov 18, 2022
1 parent 8de4a67 commit ef53993
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions FWCore/Integration/test/SwitchProducer_t.cpp
Expand Up @@ -259,9 +259,23 @@ TEST_CASE("Configuration with different transient branches", s_tag) {
SECTION("Different transient branches are allowed") {
edm::test::TestProcessor::Config config1{baseConfig1};
edm::test::TestProcessor testProcessor1{config1};
auto event1 = testProcessor1.test();
REQUIRE(event1.get<edmtest::IntProduct>()->value == 2);

// It would be better if the next line of executable code would
// throw an exception, but that is not the current expected behavior.
// It would be nice to have all cases of a SwitchProducer fail if
// any case fails on a "get" (but it is intentional and desirable
// that it does not fail only because a case declares it produces
// different transient products). We decided it was not worth the
// effort and complexity to implement this behavior (at least not yet).
REQUIRE(event1.get<edmtest::TransientIntProduct>("foo")->value == 3);

edm::test::TestProcessor::Config config2{baseConfig2};
edm::test::TestProcessor testProcessor2{config2};
auto event2 = testProcessor2.test();
REQUIRE(event2.get<edmtest::IntProduct>()->value == 1);
REQUIRE_THROWS(event2.get<edmtest::TransientIntProduct>()->value == 3);
}
}

Expand Down

0 comments on commit ef53993

Please sign in to comment.