9 #pragma GCC diagnostic push 10 #pragma GCC diagnostic ignored "-Wsign-compare" 12 #define BOOST_TEST_MODULE(MilliSlice_t) 15 BOOST_AUTO_TEST_SUITE(FelixAVXReorder_test)
23 std::vector<std::string> filenames;
43 filenames.push_back(
"/nfs/home/np04daq/milo/frametests/channelid/felix-data-milo.dat");
47 std::ifstream in(
filename, std::ios::binary);
49 std::cout <<
"Could not open file " <<
filename <<
".\n";
52 std::string contents((std::istreambuf_iterator<char>(in)),
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());
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';
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";
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));
102 for (
unsigned j = 0; j < 4; ++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)
139 BOOST_AUTO_TEST_SUITE_END()
141 #pragma GCC diagnostic pop size_t total_frames() const
uint8_t version(const unsigned &frame_ID=0) const
bool do_reorder(uint8_t *dst, const uint8_t *src, const unsigned num_frames)
uint8_t slot_no(const unsigned &frame_ID=0) const
uint8_t crate_no(const unsigned &frame_ID=0) const
uint16_t checksum_b(const unsigned &frame_ID, const uint8_t &block_num) const
uint8_t hdr(const unsigned &frame_ID, const uint8_t &block_num, const uint8_t &hdr_num) const
QTextStream & hex(QTextStream &s)
BOOST_AUTO_TEST_CASE(BaselineTest)
adc_t get_ADC(const unsigned &frame_ID, const uint8_t channel_ID) const
uint16_t checksum_a(const unsigned &frame_ID, const uint8_t &block_num) const
uint16_t error_register(const unsigned &frame_ID, const uint8_t &block_num) const
size_t total_words() const
uint16_t coldata_convert_count(const unsigned &frame_ID, const uint8_t &block_num) const
QTextStream & dec(QTextStream &s)
uint8_t s1_error(const unsigned &frame_ID, const uint8_t &block_num) const
FragmentType toFragmentType(std::string t_string)
millisecond milliseconds
Alias for common language habits.
uint8_t fiber_no(const unsigned &frame_ID=0) const
static constexpr size_t m_num_bytes_per_reord_frame
uint8_t s2_error(const unsigned &frame_ID, const uint8_t &block_num) const
size_t total_adc_values() const
uint8_t sof(const unsigned &frame_ID=0) const
uint64_t timestamp(const unsigned &frame_ID=0) const