LCOV - code coverage report
Current view: top level - dbe/unittest - config_api_set_test.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 84.6 % 26 22
Test Date: 2026-10-11 15:05:20 Functions: 100.0 % 3 3

            Line data    Source code
       1              : // DUNE DAQ modification notice:
       2              : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
       3              : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
       4              : // Renamed since fork: yes (from test/config_api_set_test.cpp to unittest/config_api_set_test.cxx).
       5              : 
       6              : /*
       7              :  * config_api_test.cpp
       8              :  *
       9              :  *  Created on: Nov 2, 2015
      10              :  *      Author: Leonidas Georgopoulos
      11              :  */
      12              : 
      13              : #define BOOST_TEST_MAIN
      14              : 
      15              : #include "dbe/confaccessor.hpp"
      16              : #include "dbe/config_api.hpp"
      17              : #include "dbe/config_api_info.hpp"
      18              : #include "dbe/config_api_set.hpp"
      19              : #include "dbe_test_defs.hpp"
      20              : 
      21              : #include <boost/test/unit_test.hpp>
      22              : 
      23              : #include <algorithm>
      24              : 
      25              : namespace dbe {
      26              : namespace config {
      27              : namespace test {
      28              : //------------------------------------------------------------------------------------------
      29              : struct class_facilities_fix : dbe::test::oksfix
      30              : {
      31              :   std::string const aclass = "OnlineSegment";
      32              :   std::string const object_to_modify = "ToyOnlineSegment";
      33              :   std::string const relation_to_modify = "Segments";
      34              : 
      35            1 :   class_facilities_fix()
      36            1 :   {
      37            1 :     confaccessor::setdbinfo(QString::fromStdString(cdbpath + fn), dbtype);
      38            1 :     confaccessor::load();
      39            1 :   }
      40              : };
      41              : 
      42              : BOOST_FIXTURE_TEST_SUITE(info_class_facilities_suite, class_facilities_fix)
      43              : 
      44            2 : BOOST_AUTO_TEST_CASE(unset_multi_relation)
      45              : {
      46            1 :   BOOST_TEST_MESSAGE("=====================================================");
      47            1 :   BOOST_TEST_MESSAGE("OKS DB required at :");
      48            1 :   BOOST_TEST_MESSAGE(cdbpath.c_str());
      49            1 :   BOOST_TEST_MESSAGE("=====================================================");
      50              : 
      51            1 :   BOOST_CHECK(confaccessor::is_database_loaded());
      52            1 :   {
      53              : 
      54            1 :     using namespace dbe::config::api;
      55              : 
      56              :     // Returns an empty object
      57            1 :     dunedaq::conffwk::class_t definition = { info::onclass::definition(aclass, false) };
      58              : 
      59            1 :     dbe::tref oref = dbe::inner::dbcontroller::get({ object_to_modify, aclass });
      60              : 
      61            1 :     std::vector<dbe::cokey> empty{};
      62              : 
      63            1 :     dunedaq::conffwk::relationship_t relation = info::relation::match(relation_to_modify, aclass);
      64            1 :     BOOST_CHECK_EQUAL(relation_to_modify, relation.p_name);
      65              : 
      66            1 :     try {
      67            1 :       set::noactions::relation(oref, relation, empty);
      68            0 :     } catch (const ers::Issue& e) {
      69            0 :       ers::error(e);
      70            0 :       BOOST_FAIL("Error: ERS exception thrown from relation function");
      71            0 :     }
      72            1 :   }
      73            1 : }
      74              : 
      75              : BOOST_AUTO_TEST_SUITE_END()
      76              : //------------------------------------------------------------------------------------------
      77              : 
      78              : } /* namespace test */
      79              : } /* namespace config */
      80              : } /* namespace dbe */
        

Generated by: LCOV version 2.0-1