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

            Line data    Source code
       1              : /**
       2              :  * @file HSIEvent_test.cxx HSIEvent 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 "dfmessages/HSIEvent.hpp"
      10              : 
      11              : /**
      12              :  * @brief Name of this test module
      13              :  */
      14              : #define BOOST_TEST_MODULE HSIEvent_test // NOLINT
      15              : 
      16              : #include "TRACE/trace.h"
      17              : #include "boost/test/unit_test.hpp"
      18              : 
      19              : using namespace dunedaq::dfmessages;
      20              : 
      21              : BOOST_AUTO_TEST_SUITE(HSIEvent_test)
      22              : 
      23              : /**
      24              :  * @brief Check that HSIEvents have appropriate Copy/Move semantics
      25              :  */
      26            2 : BOOST_AUTO_TEST_CASE(CopyAndMoveSemantics)
      27              : {
      28            1 :   BOOST_REQUIRE(std::is_copy_constructible_v<HSIEvent>);
      29            1 :   BOOST_REQUIRE(std::is_copy_assignable_v<HSIEvent>);
      30            1 :   BOOST_REQUIRE(std::is_move_constructible_v<HSIEvent>);
      31            1 :   BOOST_REQUIRE(std::is_move_assignable_v<HSIEvent>);
      32            1 : }
      33              : 
      34            2 : BOOST_AUTO_TEST_CASE(DefaultConstructor)
      35              : {
      36            1 :   HSIEvent test_hsievent;
      37            1 :   BOOST_REQUIRE_EQUAL(test_hsievent.header, 0);
      38            1 :   BOOST_REQUIRE_EQUAL(test_hsievent.signal_map, 0);
      39            1 :   BOOST_REQUIRE_EQUAL(test_hsievent.timestamp, TypeDefaults::s_invalid_timestamp);
      40            1 :   BOOST_REQUIRE_EQUAL(test_hsievent.sequence_counter, 0);
      41            1 :   BOOST_REQUIRE_EQUAL(test_hsievent.run_number, 0);
      42            1 : }
      43              : 
      44            2 : BOOST_AUTO_TEST_CASE(SerDes_MsgPack)
      45              : {
      46              : 
      47            1 :   HSIEvent he(0x12345678, 0x11111111, 0x1234123456785678, 0x22222222, 102);
      48              : 
      49            1 :   auto bytes = dunedaq::serialization::serialize(he, dunedaq::serialization::kMsgPack);
      50            3 :   TLOG(TLVL_INFO) << "MsgPack message size: " << bytes.size() << " bytes";
      51              : 
      52            1 :   HSIEvent he_deserialized = dunedaq::serialization::deserialize<HSIEvent>(bytes);
      53              : 
      54            1 :   BOOST_REQUIRE_EQUAL(he.header, he_deserialized.header);
      55            1 :   BOOST_REQUIRE_EQUAL(he.signal_map, he_deserialized.signal_map);
      56            1 :   BOOST_REQUIRE_EQUAL(he.timestamp, he_deserialized.timestamp);
      57            1 :   BOOST_REQUIRE_EQUAL(he.sequence_counter, he_deserialized.sequence_counter);
      58            1 :   BOOST_REQUIRE_EQUAL(he.run_number, he_deserialized.run_number);
      59            1 : }
      60              : 
      61              : BOOST_AUTO_TEST_SUITE_END()
        

Generated by: LCOV version 2.0-1