LCOV - code coverage report
Current view: top level - src/util - check.cpp (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 54.5 % 11 6
Test Date: 2024-08-28 04:44:32 Functions: 66.7 % 3 2
Branches: 33.3 % 6 2

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2022 The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       5                 :             : #include <util/check.h>
       6                 :             : 
       7                 :             : #include <config/bitcoin-config.h> // IWYU pragma: keep
       8                 :             : 
       9                 :             : #include <clientversion.h>
      10                 :             : #include <tinyformat.h>
      11                 :             : 
      12                 :             : #include <cstdio>
      13                 :             : #include <cstdlib>
      14                 :             : #include <string>
      15                 :             : #include <string_view>
      16                 :             : 
      17                 :           8 : std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func)
      18                 :             : {
      19                 :           8 :     return strprintf("Internal bug detected: %s\n%s:%d (%s)\n"
      20                 :             :                      "%s %s\n"
      21                 :             :                      "Please report this issue here: %s\n",
      22         [ +  - ]:          16 :                      msg, file, line, func, PACKAGE_NAME, FormatFullVersion(), PACKAGE_BUGREPORT);
      23                 :             : }
      24                 :             : 
      25                 :           8 : NonFatalCheckError::NonFatalCheckError(std::string_view msg, std::string_view file, int line, std::string_view func)
      26         [ +  - ]:           8 :     : std::runtime_error{StrFormatInternalBug(msg, file, line, func)}
      27                 :             : {
      28                 :           8 : }
      29                 :             : 
      30                 :           0 : void assertion_fail(std::string_view file, int line, std::string_view func, std::string_view assertion)
      31                 :             : {
      32                 :           0 :     auto str = strprintf("%s:%s %s: Assertion `%s' failed.\n", file, line, func, assertion);
      33         [ #  # ]:           0 :     fwrite(str.data(), 1, str.size(), stderr);
      34                 :           0 :     std::abort();
      35                 :           0 : }
        

Generated by: LCOV version 2.0-1