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

            Line data    Source code
       1              : /**
       2              :  * @file Named_test.cxx Named/NamedObject class Unit Tests
       3              :  *
       4              :  * The tests here primarily confirm that the move and copy semantics
       5              :  * are what we expect them to be
       6              :  *
       7              :  * This is part of the DUNE DAQ Application Framework, copyright 2020.
       8              :  * Licensing/copyright details are in the COPYING file that you should have
       9              :  * received with this code.
      10              :  */
      11              : 
      12              : #include "utilities/NamedObject.hpp"
      13              : 
      14              : #define BOOST_TEST_MODULE NamedObject_test // NOLINT
      15              : 
      16              : #include "boost/test/unit_test.hpp"
      17              : 
      18              : #include <string>
      19              : #include <type_traits>
      20              : 
      21              : BOOST_AUTO_TEST_SUITE(NamedObject_test)
      22              : 
      23            2 : BOOST_AUTO_TEST_CASE(Named)
      24              : {
      25              : 
      26            1 :   class DerivesFromNamed : public dunedaq::utilities::Named
      27              :   {
      28              :   public:
      29              :     explicit DerivesFromNamed(const std::string& name)
      30              :       : m_my_name(name)
      31              :     {
      32              :     }
      33              :     virtual const std::string& get_name() const { return m_my_name; }
      34              : 
      35              :   private:
      36              :     std::string m_my_name;
      37              :   };
      38              : 
      39            1 :   BOOST_REQUIRE(!std::is_copy_constructible_v<DerivesFromNamed>);
      40            1 :   BOOST_REQUIRE(!std::is_copy_assignable_v<DerivesFromNamed>);
      41            1 :   BOOST_REQUIRE(std::is_move_constructible_v<DerivesFromNamed>);
      42            1 :   BOOST_REQUIRE(std::is_move_assignable_v<DerivesFromNamed>);
      43            1 : }
      44              : 
      45            2 : BOOST_AUTO_TEST_CASE(NamedObject)
      46              : {
      47            1 :   class DerivesFromNamedObject : public dunedaq::utilities::NamedObject
      48              :   {
      49              :     // No implementation needed
      50              :   };
      51              : 
      52            1 :   BOOST_REQUIRE(!std::is_copy_constructible_v<DerivesFromNamedObject>);
      53            1 :   BOOST_REQUIRE(!std::is_copy_assignable_v<DerivesFromNamedObject>);
      54            1 :   BOOST_REQUIRE(std::is_move_constructible_v<DerivesFromNamedObject>);
      55            1 :   BOOST_REQUIRE(std::is_move_assignable_v<DerivesFromNamedObject>);
      56            1 : }
      57              : 
      58              : BOOST_AUTO_TEST_SUITE_END()
        

Generated by: LCOV version 2.0-1