LCOV - code coverage report
Current view: top level - tests - catch_base_connection.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 15 86.7 %
Date: 2024-06-09 22:27:44 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2011-2024  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/communicator
       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             : /** \file
      20             :  * \brief Verify the base_connection class.
      21             :  *
      22             :  * This file implements tests to verify that the base_connection
      23             :  * class functions as expected.
      24             :  */
      25             : 
      26             : // self
      27             : //
      28             : #include    "catch_main.h"
      29             : 
      30             : 
      31             : // communicatord
      32             : //
      33             : #include    <daemon/base_connection.h>
      34             : 
      35             : 
      36             : 
      37             : class test_connection
      38             :     : public communicator_daemon::base_connection
      39             : {
      40             : public:
      41           1 :     test_connection(communicator_daemon::server::pointer_t s)
      42           1 :         : base_connection(s, false)
      43             :     {
      44           1 :     }
      45             : 
      46           0 :     virtual int get_socket() const override
      47             :     {
      48           0 :         return -1;
      49             :     }
      50             : };
      51             : 
      52             : 
      53           1 : CATCH_TEST_CASE("base_connection", "[connection]")
      54             : {
      55           1 :     CATCH_START_SECTION("base_connection: verify default object")
      56             :     {
      57           1 :         communicator_daemon::server::pointer_t s;
      58           2 :         test_connection tc(s);
      59             : 
      60             :         // verify defaults
      61             :         //
      62           1 :         CATCH_REQUIRE(tc.get_connection_started() == -1);
      63           1 :         CATCH_REQUIRE(tc.get_connection_ended() == -1);
      64           1 :         CATCH_REQUIRE(tc.get_server_name().empty());
      65           1 :     }
      66           1 :     CATCH_END_SECTION()
      67           1 : }
      68             : 
      69             : 
      70             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.14

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