LCOV - code coverage report
Current view: top level - fdreadoutlibs/unittest - DAPHNEStreamSuperChunkTypeAdapter_test.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 100.0 % 19 19
Test Date: 2025-12-21 13:07:08 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /**
       2              :  * @file DAPHNEStreamSuperChunkTypeAdapter_test.cxx DAPHNEStreamSuperChunkTypeAdapter class Unit Tests
       3              :  *
       4              :  * This is part of the DUNE DAQ Application Framework, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "fdreadoutlibs/DAPHNEStreamSuperChunkTypeAdapter.hpp"
      10              : 
      11              : #define BOOST_TEST_MODULE DAPHNEStreamSuperChunkTypeAdapter_test // NOLINT
      12              : 
      13              : #include "boost/test/unit_test.hpp"
      14              : 
      15              : using namespace dunedaq::fdreadoutlibs::types;
      16              : 
      17              : BOOST_AUTO_TEST_SUITE(DAPHNEStreamSuperChunkTypeAdapter_test)
      18              : 
      19            2 : BOOST_AUTO_TEST_CASE(Sizes)
      20              : {
      21            1 :   DAPHNEStreamSuperChunkTypeAdapter blob_of_junk;
      22              :   
      23            1 :   BOOST_REQUIRE(blob_of_junk.end() - blob_of_junk.begin() \
      24              :     == blob_of_junk.get_num_frames());
      25              : 
      26            1 :   BOOST_REQUIRE(reinterpret_cast<uint8_t*>(blob_of_junk.end()) - \
      27              :     reinterpret_cast<uint8_t*>(blob_of_junk.begin()) \
      28              :     == blob_of_junk.get_payload_size());
      29            1 : }
      30              : 
      31            2 : BOOST_AUTO_TEST_CASE(Timestamps)
      32              : {
      33            1 :   DAPHNEStreamSuperChunkTypeAdapter blob_of_junk;
      34            1 :   DAPHNEStreamSuperChunkTypeAdapter blob_of_junk2;
      35              : 
      36            1 :   const uint64_t timestamp = 0xDEADBEEFA0B0C0D0;
      37              : 
      38            1 :   blob_of_junk.set_timestamp(timestamp);
      39            1 :   BOOST_REQUIRE(blob_of_junk.get_timestamp() == timestamp);
      40              : 
      41            1 :   blob_of_junk2.set_timestamp(timestamp + 1);
      42              : 
      43            1 :   BOOST_REQUIRE(blob_of_junk < blob_of_junk2);
      44              : 
      45            1 :   const uint64_t offset = 32;
      46            1 :   blob_of_junk.fake_timestamps(timestamp, offset);
      47              : 
      48           13 :   for (size_t i = 0; i < blob_of_junk.get_num_frames(); ++i) {
      49           12 :     const DAPHNEStreamSuperChunkTypeAdapter::FrameType* frame = blob_of_junk.begin() + i;
      50           12 :     BOOST_REQUIRE(frame->daq_header.get_timestamp() == timestamp + i*offset);
      51              :   }
      52              :   
      53            1 : }
      54              : 
      55              : BOOST_AUTO_TEST_SUITE_END()
        

Generated by: LCOV version 2.0-1