artdaq_core  v3_06_07
RawEvent_t.cc
1 #include "artdaq-core/Data/Fragment.hh"
2 #include "artdaq-core/Data/RawEvent.hh"
3 
4 #define BOOST_TEST_MODULE(RawEvent_t)
5 #include <cetlib/quiet_unit_test.hpp>
6 
7 BOOST_AUTO_TEST_SUITE(RawEvent_test)
8 
9 BOOST_AUTO_TEST_CASE(InsertFragment)
10 {
11  // SCF - The RawEvent::insertFragment() method used to check and verify that
12  // the sequence ID of the fragment equaled the sequence ID in the RawEvent
13  // header. This doesn't work for the DS50 aggregator as it packs multiple
14  // fragments with different sequence IDs into a single RawEvent. This test
15  // verifies that the we're able to do this.
16  artdaq::RawEvent r1(1, 2, 3, 4, 5);
17  std::unique_ptr<artdaq::Fragment> f1(new artdaq::Fragment(1, 1));
18  std::unique_ptr<artdaq::Fragment> f2(new artdaq::Fragment(2, 1));
19  std::unique_ptr<artdaq::Fragment> f3(new artdaq::Fragment(3, 1));
20 
21  r1.insertFragment(std::move(f1));
22  r1.insertFragment(std::move(f2));
23  r1.insertFragment(std::move(f3));
24  BOOST_REQUIRE_EQUAL(r1.numFragments(), 3);
25 
26  f1.reset(nullptr);
27  BOOST_REQUIRE_EXCEPTION(r1.insertFragment(std::move(f1)), cet::exception,
28  [&](cet::exception e) { return e.category() == "LogicError"; });
29 }
30 
31 BOOST_AUTO_TEST_SUITE_END()
A Fragment contains the data from one piece of the DAQ system for one event The artdaq::Fragment is t...
Definition: Fragment.hh:85
RawEvent is the artdaq view of a generic event, containing a header and zero or more Fragments...
Definition: RawEvent.hh:101