LCOV - code coverage report
Current view: top level - tests - catch_main.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 17 17
Test Date: 2025-05-30 15:24:13 Functions: 100.0 % 3 3
Legend: Lines: hit not hit

            Line data    Source code
       1              : // Copyright (c) 2012-2024  Made to Order Software Corp.  All Rights Reserved
       2              : //
       3              : // https://snapwebsites.org/project/eventdispatcher
       4              : // contact@m2osw.com
       5              : //
       6              : // This program is free software: you can redistribute it and/or modify
       7              : // it under the terms of the GNU General Public License as published by
       8              : // the Free Software Foundation, either version 3 of the License, or
       9              : // (at your option) any later version.
      10              : //
      11              : // This program is distributed in the hope that it will be useful,
      12              : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13              : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14              : // GNU General Public License for more details.
      15              : //
      16              : // You should have received a copy of the GNU General Public License
      17              : // along with this program.  If not, see <https://www.gnu.org/licenses/>.
      18              : 
      19              : // Tell catch we want it to add the runner code in this file.
      20              : #define CATCH_CONFIG_RUNNER
      21              : 
      22              : // self
      23              : //
      24              : #include    "catch_main.h"
      25              : 
      26              : 
      27              : // eventdispatcher
      28              : //
      29              : #include    <eventdispatcher/message_definition.h>
      30              : #include    <eventdispatcher/tcp_bio_options.h>
      31              : #include    <eventdispatcher/version.h>
      32              : 
      33              : 
      34              : // libexcept
      35              : //
      36              : #include    <libexcept/exception.h>
      37              : 
      38              : 
      39              : // snaplogger
      40              : //
      41              : #include    <snaplogger/logger.h>
      42              : 
      43              : 
      44              : // C++
      45              : //
      46              : #include    <sstream>
      47              : 
      48              : 
      49              : // last include
      50              : //
      51              : #include    <snapdev/poison.h>
      52              : 
      53              : 
      54              : 
      55              : namespace SNAP_CATCH2_NAMESPACE
      56              : {
      57              : 
      58              : 
      59              : char **         g_argv = nullptr;
      60              : 
      61              : 
      62              : } // SNAP_CATCH2_NAMESPACE namespace
      63              : 
      64              : 
      65            1 : int setup_test(Catch::Session & session)
      66              : {
      67            1 :     snapdev::NOT_USED(session);
      68              : 
      69              :     // at this point, I setup all the paths in one place
      70              :     //
      71              :     // note that it is possible to change this list at any time
      72              :     //
      73              :     // WARNING: the order matters, we want to test with our source
      74              :     //          (i.e. original) files first
      75              :     //
      76            2 :     ed::set_message_definition_paths(
      77            2 :         SNAP_CATCH2_NAMESPACE::g_source_dir() + "/tests/message-definitions:"
      78            4 :             + SNAP_CATCH2_NAMESPACE::g_source_dir() + "/eventdispatcher/message-definitions:"
      79            4 :             + SNAP_CATCH2_NAMESPACE::g_dist_dir() + "/share/eventdispatcher/messages");
      80              : 
      81            1 :     return 0;
      82              : }
      83              : 
      84              : 
      85            2 : int main(int argc, char * argv[])
      86              : {
      87            2 :     SNAP_CATCH2_NAMESPACE::g_argv = argv;
      88              : 
      89            2 :     snaplogger::logger::pointer_t l(snaplogger::logger::get_instance());
      90            2 :     l->add_console_appender();
      91            2 :     l->set_severity(snaplogger::severity_t::SEVERITY_ALL);
      92              : 
      93            2 :     ed::bio_auto_cleanup auto_bio_cleanup;
      94              : 
      95            2 :     return SNAP_CATCH2_NAMESPACE::snap_catch2_main(
      96              :               "eventdispatcher"
      97              :             , EVENTDISPATCHER_VERSION_STRING
      98              :             , argc
      99              :             , argv
     100            4 :             , []() { libexcept::set_collect_stack(libexcept::collect_stack_t::COLLECT_STACK_NO); }
     101              :             , nullptr
     102              :             , &setup_test
     103            2 :         );
     104            2 : }
     105              : 
     106              : 
     107              : // vim: ts=4 sw=4 et
        

Generated by: LCOV version 2.0-1

Snap C++ | List of projects | List of versions