23 std::vector<std::string> filenames;
43 filenames.push_back(
"/nfs/home/np04daq/milo/frametests/channelid/felix-data-milo.dat");
49 std::cout <<
"Could not open file " <<
filename <<
".\n";
53 (std::istreambuf_iterator<char>()));
55 std::string bufferstring =
"abcdefghijklmnopqrstuvwxyzabcdef";
56 contents.insert(0, bufferstring);
59 std::unique_ptr<artdaq::Fragment> frag_ptr(artdaq::Fragment::FragmentBytes(
61 frag_ptr->resizeBytes(contents.size()-bufferstring.size());
62 memcpy(frag_ptr->dataBeginBytes(), contents.c_str(), contents.size()-bufferstring.size());
66 const size_t frames = flxfrg.total_frames();
69 std::cout <<
"### MEOW -> Reordered FELIX Fragment test.\n";
72 artdaq::Fragment reordfrg;
74 my_reorderer.do_reorder(reordfrg.dataBeginBytes(), frag_ptr->dataBeginBytes() + bufferstring.size(), frames);
77 std::cout <<
" -> Total words: " << reordflxfrg.total_words() <<
'\n';
78 std::cout <<
" -> Total frames: " << reordflxfrg.total_frames() <<
'\n';
79 std::cout <<
" -> Total adc values: " << reordflxfrg.total_adc_values()
82 std::cout <<
"### WOOF -> Reordered WIB frame test.\n";
83 std::cout <<
" -> SOF: " << unsigned(reordflxfrg.sof(0)) <<
"\n";
84 std::cout <<
" -> Version: " << unsigned(reordflxfrg.version(0)) <<
"\n";
85 std::cout <<
" -> FiberNo: " << unsigned(reordflxfrg.fiber_no(0)) <<
"\n";
86 std::cout <<
" -> SlotNo: " << unsigned(reordflxfrg.slot_no(0)) <<
"\n";
87 std::cout <<
" -> CrateNo: " << unsigned(reordflxfrg.crate_no(0)) <<
"\n";
88 std::cout <<
" -> Timestamp: " <<
std::hex << reordflxfrg.timestamp(0)
92 std::cout <<
"### MEOW -> Comparing " << frames <<
" frames.\n";
94 for (
unsigned i = 0; i < frames; ++i) {
95 BOOST_REQUIRE_EQUAL(flxfrg.sof(i), reordflxfrg.sof(i));
96 BOOST_REQUIRE_EQUAL(flxfrg.version(i), reordflxfrg.version(i));
97 BOOST_REQUIRE_EQUAL(flxfrg.fiber_no(i), reordflxfrg.fiber_no(i));
98 BOOST_REQUIRE_EQUAL(flxfrg.slot_no(i), reordflxfrg.slot_no(i));
99 BOOST_REQUIRE_EQUAL(flxfrg.crate_no(i), reordflxfrg.crate_no(i));
100 BOOST_REQUIRE_EQUAL(flxfrg.timestamp(i), reordflxfrg.timestamp(i));
102 for (
unsigned j = 0; j < 4; ++j) {
103 BOOST_REQUIRE_EQUAL(flxfrg.s1_error(i, j), reordflxfrg.s1_error(i, j));
104 BOOST_REQUIRE_EQUAL(flxfrg.s2_error(i, j), reordflxfrg.s2_error(i, j));
105 BOOST_REQUIRE_EQUAL(flxfrg.checksum_a(i, j),
106 reordflxfrg.checksum_a(i, j));
107 BOOST_REQUIRE_EQUAL(flxfrg.checksum_b(i, j),
108 reordflxfrg.checksum_b(i, j));
109 BOOST_REQUIRE_EQUAL(flxfrg.coldata_convert_count(i, j),
110 reordflxfrg.coldata_convert_count(i, j));
111 BOOST_REQUIRE_EQUAL(flxfrg.error_register(i, j),
112 reordflxfrg.error_register(i, j));
113 for (
unsigned h = 0;
h < 8; ++
h) {
114 BOOST_REQUIRE_EQUAL(flxfrg.hdr(i, j,
h), reordflxfrg.hdr(i, j,
h));
117 for (
unsigned ch = 0; ch < 256; ++ch) {
118 BOOST_REQUIRE_EQUAL(flxfrg.get_ADC(i, ch), reordflxfrg.get_ADC(i, ch));
122 std::cout <<
"### MEOW -> Tests successful.\n";
125 compare_end - compare_begin)
QTextStream & hex(QTextStream &s)
QTextStream & dec(QTextStream &s)
FragmentType toFragmentType(std::string t_string)
millisecond milliseconds
Alias for common language habits.
static constexpr size_t m_num_bytes_per_reord_frame