LCOV - code coverage report
Current view: top level - tests - catch_timed_getchar.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 6 6
Test Date: 2026-08-02 20:00:41 Functions: 100.0 % 1 1
Legend: Lines: hit not hit

            Line data    Source code
       1              : // Copyright (c) 2026  Made to Order Software Corp.  All Rights Reserved
       2              : //
       3              : // https://snapwebsites.org/project/snapdev
       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 that the timed_getch compiles & times out.
      21              :  *
      22              :  * Since we cannot run standalone tests if we need the user to hit a key
      23              :  * on his keyboard this test is limited to a timeout.
      24              :  *
      25              :  * At least we make sure that the file compiles that way.
      26              :  */
      27              : 
      28              : // self
      29              : //
      30              : #include    <snapdev/timed_getchar.h>
      31              : 
      32              : #include    "catch_main.h"
      33              : 
      34              : 
      35              : // snapdev
      36              : //
      37              : #include    <snapdev/not_reached.h>
      38              : 
      39              : 
      40              : // last include
      41              : //
      42              : #include    <snapdev/poison.h>
      43              : 
      44              : 
      45              : namespace
      46              : {
      47              : 
      48              : 
      49              : 
      50              : 
      51              : } // no name namespace
      52              : 
      53              : 
      54            1 : CATCH_TEST_CASE("timed_getchar_timeout", "[terminal]")
      55              : {
      56            1 :     CATCH_START_SECTION("timed_getchar_timeout: make sure that our getchar() times out")
      57              :     {
      58            1 :         int const r(snapdev::timed_getchar(0.3));
      59            1 :         CATCH_REQUIRE(r == 0); // 0 in case of a timeout (-1 error, more than 0 user hit a character)
      60              :     }
      61            1 :     CATCH_END_SECTION()
      62            1 : }
      63              : 
      64              : 
      65              : 
      66              : // vim: ts=4 sw=4 et
        

Generated by: LCOV version 2.0-1

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