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

            Line data    Source code
       1              : /**
       2              :  * @file TriggerCandidateData_test.cxx TriggerCandidateData 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 "trgdataformats/TriggerCandidateData.hpp"
      10              : 
      11              : /**
      12              :  * @brief Name of this test module
      13              :  */
      14              : #define BOOST_TEST_MODULE TriggerCandidateData_test // NOLINT
      15              : 
      16              : #include "boost/test/unit_test.hpp"
      17              : 
      18              : #include <string>
      19              : #include <vector>
      20              : 
      21              : using namespace dunedaq::trgdataformats;
      22              : 
      23              : BOOST_AUTO_TEST_SUITE(TriggerCandidateData_test)
      24              : 
      25            2 : BOOST_AUTO_TEST_CASE(FragmentTypeConversion)
      26              : {
      27            1 :   BOOST_REQUIRE_EQUAL(static_cast<int>(string_to_trigger_candidate_type("kTiming")),
      28              :                       static_cast<int>(TriggerCandidateData::Type::kTiming));
      29            1 :   BOOST_REQUIRE_EQUAL(trigger_candidate_type_to_string(TriggerCandidateData::Type::kTiming), "kTiming");
      30              : 
      31            1 :   auto type_map = get_trigger_candidate_type_names();
      32              :   // sanity check
      33           40 :   for (auto& type_pair : type_map) {
      34           39 :     BOOST_TEST_MESSAGE("TriggerCandidateData type "
      35              :                        << int(type_pair.first) << " " << type_pair.second
      36              :                        << " with conversions: " << int(string_to_trigger_candidate_type(type_pair.second)) << " "
      37              :                        << trigger_candidate_type_to_string(type_pair.first));
      38           39 :     BOOST_REQUIRE_EQUAL(static_cast<int>(string_to_trigger_candidate_type(type_pair.second)),
      39              :                         static_cast<int>(type_pair.first));
      40           39 :     BOOST_REQUIRE_EQUAL(trigger_candidate_type_to_string(type_pair.first), type_pair.second);
      41              :   }
      42              : 
      43            1 :   BOOST_REQUIRE_EQUAL(static_cast<int>(string_to_trigger_candidate_type("thisIsABadFragmentType")),
      44              :                       static_cast<int>(TriggerCandidateData::Type::kUnknown));
      45            1 :   BOOST_REQUIRE_EQUAL(trigger_candidate_type_to_string(static_cast<TriggerCandidateData::Type>(-10)), "kUnknown");
      46            1 : }
      47              : 
      48              : BOOST_AUTO_TEST_SUITE_END()
        

Generated by: LCOV version 2.0-1