Macros | Functions
ProductRegistryHelper_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "art/Framework/Core/ProductRegistryHelper.h"
#include "art/Persistency/Provenance/ModuleDescription.h"
#include "canvas/Persistency/Common/Assns.h"
#include "canvas/Utilities/Exception.h"
#include "fhiclcpp/ParameterSet.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (ProductRegistryHelper_t)
 

Functions

 BOOST_AUTO_TEST_CASE (produces)
 
 BOOST_AUTO_TEST_CASE (reconstitutes)
 
 BOOST_AUTO_TEST_CASE (reconstitutes_different_module_labels)
 
 BOOST_AUTO_TEST_CASE (reconstitutes_assns_reversed_types)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (ProductRegistryHelper_t)

Definition at line 1 of file ProductRegistryHelper_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( produces  )

Definition at line 37 of file ProductRegistryHelper_t.cc.

38 {
39  ProductRegistryHelper prh{product_creation_mode::produces};
40  prh.produces<int>();
41  BOOST_CHECK_EXCEPTION((prh.reconstitutes<int, InEvent>("label", "instance")),
42  Exception,
43  matches{"'produces' should have been called instead"});
44 }
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( reconstitutes  )

Definition at line 46 of file ProductRegistryHelper_t.cc.

47 {
48  ProductRegistryHelper prh{product_creation_mode::reconstitutes};
49  prh.reconstitutes<int, InEvent>("label", "instance");
50  BOOST_CHECK_EXCEPTION(
51  prh.produces<int>(),
53  matches{"'reconstitutes' should have been called instead"});
54 }
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( reconstitutes_different_module_labels  )

Definition at line 56 of file ProductRegistryHelper_t.cc.

57 {
58  ProductRegistryHelper prh{product_creation_mode::reconstitutes};
59  prh.reconstitutes<int, InEvent>("label1");
60  prh.reconstitutes<int, InEvent>("label2");
61  BOOST_CHECK_NO_THROW(prh.fillDescriptions(md));
62 }
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
BOOST_AUTO_TEST_CASE ( reconstitutes_assns_reversed_types  )

Definition at line 64 of file ProductRegistryHelper_t.cc.

65 {
66  ProductRegistryHelper prh{product_creation_mode::reconstitutes};
68  prh.reconstitutes<Assns<double, int>, InEvent>("label");
69  BOOST_CHECK_EXCEPTION(
70  prh.fillDescriptions(md),
71  Exception,
72  matches{"That friendly name has already been registered for this module."});
73 }
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66