LCOV - code coverage report
Current view: top level - dbe/unittest - config_api_set_test.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 85.2 % 27 23
Test Date: 2026-07-12 15:23:06 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_test_defs.hpp"
      16              : #include "dbe/config_api_info.hpp"
      17              : #include "dbe/config_api_set.hpp"
      18              : #include "dbe/config_api.hpp"
      19              : #include "dbe/confaccessor.hpp"
      20              : 
      21              : #include <boost/test/unit_test.hpp>
      22              : 
      23              : #include <algorithm>
      24              : 
      25              : namespace dbe
      26              : {
      27              : namespace config
      28              : {
      29              : namespace test
      30              : {
      31              : //------------------------------------------------------------------------------------------
      32              : struct class_facilities_fix:    dbe::test::oksfix
      33              : {
      34              :                 std::string const aclass = "OnlineSegment";
      35              :                 std::string const object_to_modify = "ToyOnlineSegment";
      36              :                 std::string const relation_to_modify = "Segments";
      37              : 
      38            1 :                 class_facilities_fix()
      39            1 :                 {
      40            1 :                         confaccessor::setdbinfo(QString::fromStdString(cdbpath + fn), dbtype);
      41            1 :                         confaccessor::load();
      42            1 :                 }
      43              : };
      44              : 
      45              : BOOST_FIXTURE_TEST_SUITE(info_class_facilities_suite, class_facilities_fix)
      46              : 
      47            2 : BOOST_AUTO_TEST_CASE(unset_multi_relation)
      48              : {
      49            1 :         BOOST_TEST_MESSAGE("=====================================================");
      50            1 :         BOOST_TEST_MESSAGE("OKS DB required at :");
      51            1 :         BOOST_TEST_MESSAGE(cdbpath.c_str());
      52            1 :         BOOST_TEST_MESSAGE("=====================================================");
      53              : 
      54            1 :         BOOST_CHECK(confaccessor::is_database_loaded());
      55            1 :         {
      56              : 
      57            1 :                 using namespace dbe::config::api;
      58              : 
      59              :                 // Returns an empty object
      60            1 :                 dunedaq::conffwk::class_t definition =
      61            1 :                 { info::onclass::definition(aclass, false) };
      62              : 
      63            1 :                 dbe::tref oref = dbe::inner::dbcontroller::get({object_to_modify,aclass});
      64              : 
      65            1 :                 std::vector<dbe::cokey> empty {};
      66              :                 
      67            1 :                 dunedaq::conffwk::relationship_t relation = info::relation::match(relation_to_modify, aclass);
      68            1 :                 BOOST_CHECK_EQUAL(relation_to_modify,relation.p_name );
      69              : 
      70            1 :                 try {
      71            1 :                   set::noactions::relation(oref, relation, empty);
      72            0 :                 } catch (const ers::Issue& e) {
      73            0 :                   ers::error(e);
      74            0 :                   BOOST_FAIL("Error: ERS exception thrown from relation function");
      75            0 :                 }
      76            1 :         }
      77            1 : }
      78              : 
      79              : BOOST_AUTO_TEST_SUITE_END()
      80              : //------------------------------------------------------------------------------------------
      81              : 
      82              : }/* namespace test */
      83              : } /* namespace config */
      84              : } /* namespace dbe */
        

Generated by: LCOV version 2.0-1