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: 2025-12-21 13:07:08 Functions: 100.0 % 3 3

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

Generated by: LCOV version 2.0-1