artdaq_core  v1_05_06
 All Classes Namespaces Functions
RawEvent_t.cc
1 #include "artdaq-core/Data/RawEvent.hh"
2 #include "artdaq-core/Data/Fragment.hh"
3 
4 #define BOOST_TEST_MODULE(RawEvent_t)
5 #ifdef HAVE_CANVAS
6 #include "cetlib/quiet_unit_test.hpp"
7 #else
8 #include "boost/test/auto_unit_test.hpp"
9 #endif
10 
11 BOOST_AUTO_TEST_SUITE(RawEvent_test)
12 
13 BOOST_AUTO_TEST_CASE(InsertFragment)
14 {
15  // SCF - The RawEvent::insertFragment() method used to check and verify that
16  // the sequence ID of the fragment equaled the sequence ID in the RawEvent
17  // header. This doesn't work for the DS50 aggregator as it packs multiple
18  // fragments with different sequence IDs into a single RawEvent. This test
19  // verifies that the we're able to do this.
20  artdaq::RawEvent r1(1, 1, 1);
21  std::unique_ptr<artdaq::Fragment> f1(new artdaq::Fragment(1, 1));
22  std::unique_ptr<artdaq::Fragment> f2(new artdaq::Fragment(2, 1));
23  std::unique_ptr<artdaq::Fragment> f3(new artdaq::Fragment(3, 1));
24 
25  try {
26  r1.insertFragment(std::move(f1));
27  r1.insertFragment(std::move(f2));
28  r1.insertFragment(std::move(f3));
29  //BOOST_REQUIRE_EQUAL(r1.numFragments(), 3);
30  }
31  catch (...) {
32  BOOST_REQUIRE(0 && "Should not have thrown exception");
33  }
34 }
35 
36 BOOST_AUTO_TEST_SUITE_END()
37