Classes | Namespaces | Macros | Functions | Variables
EventPrincipal_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "art/Framework/Principal/EventPrincipal.h"
#include "art/Framework/Principal/ProcessTag.h"
#include "art/Framework/Principal/RunPrincipal.h"
#include "art/Framework/Principal/Selector.h"
#include "art/Framework/Principal/SubRunPrincipal.h"
#include "art/Persistency/Common/GroupQueryResult.h"
#include "art/Persistency/Provenance/ModuleContext.h"
#include "art/Version/GetReleaseVersion.h"
#include "art/test/TestObjects/ToyProducts.h"
#include "canvas/Persistency/Common/WrappedTypeID.h"
#include "canvas/Persistency/Common/Wrapper.h"
#include "canvas/Persistency/Provenance/BranchDescription.h"
#include "canvas/Persistency/Provenance/EventAuxiliary.h"
#include "canvas/Persistency/Provenance/Parentage.h"
#include "canvas/Persistency/Provenance/ProcessConfiguration.h"
#include "canvas/Persistency/Provenance/ProductID.h"
#include "canvas/Persistency/Provenance/ProductProvenance.h"
#include "canvas/Persistency/Provenance/ProductStatus.h"
#include "canvas/Persistency/Provenance/RunAuxiliary.h"
#include "canvas/Persistency/Provenance/SubRunAuxiliary.h"
#include "canvas/Persistency/Provenance/Timestamp.h"
#include "canvas/Persistency/Provenance/TypeLabel.h"
#include "canvas/Utilities/TypeID.h"
#include "fhiclcpp/ParameterSet.h"
#include <map>
#include <memory>
#include <exception>
#include <string>
#include <typeinfo>

Go to the source code of this file.

Classes

class  ProductTablesFixture
 
struct  EventPrincipalTestFixture
 

Namespaces

 art
 

Macros

#define BOOST_TEST_MODULE   (eventprincipal_t)
 

Functions

std::ostream & art::boost_test_print_type (std::ostream &os, cet::exempt_ptr< BranchDescription const > const pd)
 
 BOOST_AUTO_TEST_CASE (failgetbyIdTest)
 
 BOOST_AUTO_TEST_CASE (failgetbySelectorTest)
 
 BOOST_AUTO_TEST_CASE (failgetbyLabelTest)
 
 BOOST_AUTO_TEST_CASE (failgetManyTest)
 
 BOOST_AUTO_TEST_CASE (failgetManybyTypeTest)
 

Variables

auto const invalid_module_context = ModuleContext::invalid()
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (eventprincipal_t)

Definition at line 2 of file EventPrincipal_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( failgetbyIdTest  )

Definition at line 190 of file EventPrincipal_t.cc.

191 {
192  auto const invalid = art::ProductID::invalid();
193  auto const& h = pEvent_->getByProductID(invalid);
194  BOOST_TEST(h.failed());
195 }
static constexpr ProductID invalid() noexcept
Definition: ProductID.h:26
BOOST_AUTO_TEST_CASE ( failgetbySelectorTest  )

Definition at line 197 of file EventPrincipal_t.cc.

198 {
199  // We don't put ProductIDs into the EventPrincipal, so that's a type
200  // sure not to match any product.
201  auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
202 
203  art::ProcessNameSelector const pnsel{"PROD"};
204  auto const& h = pEvent_->getBySelector(
205  invalid_module_context, wrapped, pnsel, ProcessTag{"PROD"s, "USER2"s});
206  BOOST_TEST(h.failed());
207 }
static QCString * s
Definition: config.cpp:1042
auto const invalid_module_context
BOOST_AUTO_TEST_CASE ( failgetbyLabelTest  )

Definition at line 209 of file EventPrincipal_t.cc.

210 {
211  // We don't put ProductIDs into the EventPrincipal, so that's a type
212  // sure not to match any product.
213  auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
214 
215  std::string const label{"this does not exist"};
216 
217  auto const& h = pEvent_->getByLabel(
218  invalid_module_context, wrapped, label, ""s, ProcessTag{""s, "USER2"s});
219  BOOST_TEST(h.failed());
220 }
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
auto const invalid_module_context
BOOST_AUTO_TEST_CASE ( failgetManyTest  )

Definition at line 222 of file EventPrincipal_t.cc.

223 {
224  // We don't put ProductIDs into the EventPrincipal, so that's a type
225  // sure not to match any product.
226  auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
227 
228  art::ProcessNameSelector const sel{"PROD"};
229  auto const& query_results = pEvent_->getMany(
230  invalid_module_context, wrapped, sel, ProcessTag{"PROD"s, "USER2"s});
231  BOOST_TEST(query_results.empty());
232 }
static QCString * s
Definition: config.cpp:1042
auto const invalid_module_context
BOOST_AUTO_TEST_CASE ( failgetManybyTypeTest  )

Definition at line 234 of file EventPrincipal_t.cc.

235 {
236  // We don't put ProductIDs into the EventPrincipal, so that's a type
237  // sure not to match any product.
238  auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
239 
240  // getManyByType is achieved by providing a selector that matches
241  // everything.
242  auto const& query_results = pEvent_->getMany(invalid_module_context,
243  wrapped,
245  ProcessTag{""s, "USER2"s});
246  BOOST_TEST(query_results.empty());
247 }
static QCString * s
Definition: config.cpp:1042
auto const invalid_module_context

Variable Documentation

auto const invalid_module_context = ModuleContext::invalid()

Definition at line 70 of file EventPrincipal_t.cc.