16 #include "canvas/Persistency/Common/FindMany.h" 17 #include "canvas/Persistency/Common/FindManyP.h" 18 #include "canvas/Persistency/Common/FindOne.h" 19 #include "canvas/Persistency/Common/FindOneP.h" 26 #include "boost/type_traits.hpp" 29 #include <type_traits> 32 class AssnsReaderTest;
35 #include <initializer_list> 99 template <
typename A,
typename B,
typename D>
109 std::size_t wanted = 0ull;
111 if (isVoid && wantVoid !=
"ALL"s && wantAmbiguous) {
125 if (process ==
"ASSNSW2") {
133 template <
typename A,
typename B,
typename D>
142 BOOST_CHECK_EQUAL(v.size(),
143 (expectedSize<A, B, D>(
144 wantVoid, wantMV, wantMany, wantAmbiguous, process)));
151 std::size_t
const vSize = (
wantVoid_ ==
"ALL"s) ? 4ull : 3ull;
152 std::size_t
const mvVSize = (
wantVoid_ !=
"NONE"s) ? 4ull : 3ull;
154 auto const vSizeM = vSize + ((
wantVoid_ ==
"ALL"s) ? 2ull : 1ull);
155 auto const mvVSizeM = mvVSize + ((wantVoid_ !=
"NONE"s) ? 2ull : 1ull);
161 BOOST_CHECK_EQUAL(hABV->
size(), vSize);
173 "getByLabel: Found 2 products rather than one which match all criteria"s);
180 BOOST_CHECK_EQUAL(hBAV->size(), vSize);
182 BOOST_CHECK_EQUAL(hBAV.provenance()->processName(),
process_);
192 "getByLabel: Found 2 products rather than one which match all criteria"s);
198 BOOST_CHECK_EQUAL(hABVM->size(), vSizeM);
200 BOOST_CHECK_EQUAL(hBAVM->size(), vSizeM);
202 BOOST_CHECK_EQUAL(hABVM.provenance()->processName(),
process_);
203 BOOST_CHECK_EQUAL(hBAVM.provenance()->processName(),
process_);
208 BOOST_CHECK_EQUAL(hmvABV->size(), mvVSize);
210 BOOST_CHECK_EQUAL(hmvBAV->size(), mvVSize);
212 BOOST_CHECK_EQUAL(hmvABV.provenance()->processName(),
process_);
213 BOOST_CHECK_EQUAL(hmvBAV.provenance()->processName(),
process_);
218 BOOST_CHECK_EQUAL(hmvABVM->size(), mvVSizeM);
221 BOOST_CHECK_EQUAL(hmvBAVM->size(), mvVSizeM);
223 BOOST_CHECK_EQUAL(hmvABVM.provenance()->processName(),
process_);
224 BOOST_CHECK_EQUAL(hmvBAVM.provenance()->processName(),
process_);
230 BOOST_CHECK_EQUAL(e.getValidHandle<AssnsABX_t>(
inputLabel_)->size(), 3ull);
231 BOOST_CHECK_EQUAL(e.getValidHandle<AssnsBAX_t>(
inputLabel_)->size(), 3ull);
234 e.getValidHandle<AssnsABX_t>({inputLabel_,
"many"s})->size(), 4ull);
236 e.getValidHandle<AssnsBAX_t>({inputLabel_,
"many"s})->size(), 4ull);
240 e.getValidHandle<AssnsABX_t>({inputLabel_,
"mapvec"s})->size(), 3ull);
242 e.getValidHandle<AssnsBAX_t>({inputLabel_,
"mapvec"s})->size(), 3ull);
245 e.getValidHandle<AssnsABX_t>({inputLabel_,
"manymapvec"s})->size(),
248 e.getValidHandle<AssnsBAX_t>({inputLabel_,
"manymapvec"s})->size(),
254 std::vector<art::Handle<AssnsABV_t>> hSet1;
255 e.getManyByType(hSet1);
258 std::vector<art::Handle<AssnsBAV_t>> hSet2;
259 e.getManyByType(hSet2);
262 std::vector<art::Handle<AssnsABX_t>> hSet3;
263 e.getManyByType(hSet3);
266 std::vector<art::Handle<AssnsBAX_t>> hSet4;
267 e.getManyByType(hSet4);
bool const wantAmbiguous_
art::Assns< A_t, B_t > AssnsABV_t
AssnsReaderTest(fhicl::ParameterSet const &p)
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string const inputLabel_
std::string const wantVoid_
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
Provenance const * provenance() const
void analyze(art::Event const &e) override
std::string const process_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
auto const & get(AssnsNode< L, R, D > const &r)
art::Assns< B_t, size_t > AssnsBAV_t