1 #include "artdaq-core/Data/ContainerFragmentLoader.hh"
2 #include "artdaq-core/Data/FragmentNameHelper.hh"
4 #define BOOST_TEST_MODULE(FragmentNameHelper_t)
5 #include <cetlib/quiet_unit_test.hpp>
7 BOOST_AUTO_TEST_SUITE(FragmentNameHelper_test)
9 BOOST_AUTO_TEST_CASE(FNH_Construct)
12 auto names = helper->GetAllProductInstanceNames();
13 BOOST_REQUIRE(names.size() > 0);
16 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
19 BOOST_AUTO_TEST_CASE(FNH_ExtraTypesInConstructor)
24 auto names = helper->GetAllProductInstanceNames();
25 BOOST_REQUIRE(names.size() > 0);
30 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
33 BOOST_AUTO_TEST_CASE(FNH_ExtraTypesOverwriteInConstructor)
38 auto names = helper->GetAllProductInstanceNames();
39 BOOST_REQUIRE(names.size() > 0);
42 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
45 BOOST_AUTO_TEST_CASE(FNH_ExtraTypesMethod)
48 auto names = helper->GetAllProductInstanceNames();
49 BOOST_REQUIRE(names.size() > 0);
52 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
58 BOOST_AUTO_TEST_CASE(FNH_ExtraTypesOverwriteMethod)
61 auto names = helper->GetAllProductInstanceNames();
62 BOOST_REQUIRE(names.size() > 0);
65 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
71 BOOST_AUTO_TEST_CASE(FNH_DecodeFragment)
74 auto names = helper->GetAllProductInstanceNames();
75 BOOST_REQUIRE(names.size() > 0);
78 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
82 auto res = helper->GetInstanceNameForFragment(frag);
83 BOOST_REQUIRE_EQUAL(res.first,
true);
84 BOOST_REQUIRE_EQUAL(res.second,
"Data");
87 res = helper->GetInstanceNameForFragment(frag);
88 BOOST_REQUIRE_EQUAL(res.first,
false);
89 BOOST_REQUIRE_EQUAL(res.second,
"testunidentified");
92 BOOST_AUTO_TEST_CASE(FNH_DecodeContainerFragment)
95 auto names = helper->GetAllProductInstanceNames();
96 BOOST_REQUIRE(names.size() > 0);
99 BOOST_REQUIRE_EQUAL(helper->GetUnidentifiedInstanceName(),
"testunidentified");
103 auto res = helper->GetInstanceNameForFragment(frag);
104 BOOST_REQUIRE_EQUAL(res.first,
true);
105 BOOST_REQUIRE_EQUAL(res.second,
"ContainerData");
108 BOOST_AUTO_TEST_SUITE_END()
A Read-Write version of the ContainerFragment, used for filling ContainerFragment objects with other ...
static constexpr type_t DataFragmentType
Copy DataFragmentType from RawFragmentHeader.
std::shared_ptr< FragmentNameHelper > makeNameHelper(std::string const &plugin_name, std::string const &unidentified_instance_name, std::vector< std::pair< artdaq::Fragment::type_t, std::string >> extraTypes)
Create a FragmentNameHelper.
static constexpr type_t FirstUserFragmentType
Copy FIRST_USER_TYPE from RawFragmentHeader.
A Fragment contains the data from one piece of the DAQ system for one event The artdaq::Fragment is t...