Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:29

0001 #include "catch.hpp"
0002 
0003 #include "FWCore/Framework/interface/InputProcessBlockCacheImpl.h"
0004 #include "FWCore/Framework/interface/moduleAbilities.h"
0005 #include "FWCore/Framework/interface/stream/dummy_helpers.h"
0006 #include "FWCore/Framework/interface/stream/EDAnalyzer.h"
0007 #include "FWCore/Framework/interface/stream/EDFilter.h"
0008 #include "FWCore/Framework/interface/stream/EDProducer.h"
0009 
0010 #include <memory>
0011 #include <type_traits>
0012 
0013 namespace edmtest {
0014 
0015   class TestAnalyzerWithInputProcessBlockAbility
0016       : public edm::stream::EDAnalyzer<edm::GlobalCache<int>, edm::InputProcessBlockCache<int, unsigned int, int>> {};
0017 
0018   class TestAnalyzerWithoutInputProcessBlockAbility : public edm::stream::EDAnalyzer<edm::GlobalCache<int>> {};
0019 
0020   class TestFilterWithInputProcessBlockAbility
0021       : public edm::stream::EDFilter<edm::GlobalCache<int>, edm::InputProcessBlockCache<int, unsigned int, int>> {};
0022 
0023   class TestFilterWithoutInputProcessBlockAbility : public edm::stream::EDFilter<edm::GlobalCache<int>> {};
0024 
0025   class TestProducerWithInputProcessBlockAbility
0026       : public edm::stream::EDProducer<edm::GlobalCache<int>, edm::InputProcessBlockCache<int, unsigned int, int>> {};
0027 
0028   class TestProducerWithoutInputProcessBlockAbility : public edm::stream::EDProducer<edm::GlobalCache<int>> {};
0029 
0030 }  // namespace edmtest
0031 
0032 TEST_CASE("test InputProcessBlock", "[InputProcessBlock]") {
0033   SECTION("test HasAbility") {
0034     STATIC_REQUIRE(edmtest::TestAnalyzerWithInputProcessBlockAbility::HasAbility::kInputProcessBlockCache);
0035     STATIC_REQUIRE(!edmtest::TestAnalyzerWithoutInputProcessBlockAbility::HasAbility::kInputProcessBlockCache);
0036   }
0037   SECTION("test type aliases") {
0038     STATIC_REQUIRE(std::is_same<edmtest::TestAnalyzerWithInputProcessBlockAbility::InputProcessBlockCache,
0039                                 edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>());
0040     STATIC_REQUIRE(std::is_same<edmtest::TestAnalyzerWithoutInputProcessBlockAbility::InputProcessBlockCache, void>());
0041     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0042                                     edmtest::TestAnalyzerWithInputProcessBlockAbility::InputProcessBlockCache>::type,
0043                                 std::unique_ptr<edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>>());
0044     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0045                                     edmtest::TestAnalyzerWithoutInputProcessBlockAbility::InputProcessBlockCache>::type,
0046                                 edm::stream::impl::dummy_ptr>());
0047 
0048     STATIC_REQUIRE(std::is_same<edmtest::TestFilterWithInputProcessBlockAbility::InputProcessBlockCache,
0049                                 edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>());
0050     STATIC_REQUIRE(std::is_same<edmtest::TestFilterWithoutInputProcessBlockAbility::InputProcessBlockCache, void>());
0051     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0052                                     edmtest::TestFilterWithInputProcessBlockAbility::InputProcessBlockCache>::type,
0053                                 std::unique_ptr<edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>>());
0054     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0055                                     edmtest::TestFilterWithoutInputProcessBlockAbility::InputProcessBlockCache>::type,
0056                                 edm::stream::impl::dummy_ptr>());
0057 
0058     STATIC_REQUIRE(std::is_same<edmtest::TestProducerWithInputProcessBlockAbility::InputProcessBlockCache,
0059                                 edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>());
0060     STATIC_REQUIRE(std::is_same<edmtest::TestProducerWithoutInputProcessBlockAbility::InputProcessBlockCache, void>());
0061     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0062                                     edmtest::TestProducerWithInputProcessBlockAbility::InputProcessBlockCache>::type,
0063                                 std::unique_ptr<edm::impl::InputProcessBlockCacheImpl<int, unsigned int, int>>>());
0064     STATIC_REQUIRE(std::is_same<edm::stream::impl::choose_unique_ptr<
0065                                     edmtest::TestProducerWithoutInputProcessBlockAbility::InputProcessBlockCache>::type,
0066                                 edm::stream::impl::dummy_ptr>());
0067   }
0068 }