Macros | Functions
wrapper_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "canvas/Persistency/Common/Sampled.h"
#include "canvas/Persistency/Common/Wrapper.h"
#include "canvas/Utilities/InputTag.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (Tests of Wrapper interface)
 

Functions

 BOOST_AUTO_TEST_CASE (sampled_product)
 
 BOOST_AUTO_TEST_CASE (no_sampled_product_recursion)
 
 BOOST_AUTO_TEST_CASE (print_size)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (Tests of Wrapper interface)

Definition at line 1 of file wrapper_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( sampled_product  )

Definition at line 24 of file wrapper_t.cc.

25 {
27  auto edp = w.createEmptySampledProduct(invalid);
28  BOOST_TEST_REQUIRE(edp.get());
29  BOOST_TEST(edp->isPresent());
30 
31  auto const& sampled = static_cast<Wrapper<Sampled<int>> const&>(*edp);
32  BOOST_TEST(sampled->empty());
33 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
std::unique_ptr< EDProduct > createEmptySampledProduct(InputTag const &tag) const
Definition: EDProduct.h:94
BOOST_AUTO_TEST_CASE ( no_sampled_product_recursion  )

Definition at line 35 of file wrapper_t.cc.

36 {
38  BOOST_CHECK_EXCEPTION(
39  w.createEmptySampledProduct(invalid), Exception, [](auto const& e) {
40  return e.categoryCode() == errors::LogicError and
41  e.explain_self().find("recursion is not allowed") !=
42  std::string::npos;
43  });
44 }
const double e
std::unique_ptr< EDProduct > createEmptySampledProduct(InputTag const &tag) const
Definition: EDProduct.h:94
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
BOOST_AUTO_TEST_CASE ( print_size  )

Definition at line 46 of file wrapper_t.cc.

47 {
48  auto int_product = make_product(3);
49  BOOST_TEST(int_product->productSize() == "-");
50 
51  auto map_product = make_product<std::map<int, double>>({{1, 1.5}, {2, 3.}});
52  BOOST_TEST(map_product->productSize() == "2");
53 
54  struct CustomTypeWithSize {
55  size_t
56  size() const noexcept
57  {
58  return 3;
59  }
60  };
61  auto custom_product = make_product<CustomTypeWithSize>({});
62  BOOST_TEST(custom_product->productSize() == "3");
63 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92