LCOV - code coverage report
Current view: top level - libs/capy/src - error.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 80.0 % 10 8
Test Date: 2026-01-17 12:16:19 Functions: 100.0 % 3 3

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/capy
       8              : //
       9              : 
      10              : #include <boost/capy/error.hpp>
      11              : 
      12              : namespace boost {
      13              : namespace capy {
      14              : 
      15              : namespace detail {
      16              : 
      17              : const char*
      18           27 : error_cat_type::
      19              : name() const noexcept
      20              : {
      21           27 :     return "boost.capy";
      22              : }
      23              : 
      24              : std::string
      25           27 : error_cat_type::
      26              : message(int code) const
      27              : {
      28           54 :     return message(code, nullptr, 0);
      29              : }
      30              : 
      31              : char const*
      32           27 : error_cat_type::
      33              : message(
      34              :     int code,
      35              :     char*,
      36              :     std::size_t) const noexcept
      37              : {
      38           27 :     switch(static_cast<error>(code))
      39              :     {
      40            1 :     case error::eof: return "eof";
      41           26 :     case error::test_failure: return "test failure";
      42            0 :     default:
      43            0 :         return "unknown";
      44              :     }
      45              : }
      46              : 
      47              : //-----------------------------------------------
      48              : 
      49              : // msvc 14.0 has a bug that warns about inability
      50              : // to use constexpr construction here, even though
      51              : // there's no constexpr construction
      52              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      53              : # pragma warning( push )
      54              : # pragma warning( disable : 4592 )
      55              : #endif
      56              : 
      57              : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
      58              : constinit error_cat_type error_cat;
      59              : #else
      60              : error_cat_type error_cat;
      61              : #endif
      62              : 
      63              : #if defined(_MSC_VER) && _MSC_VER <= 1900
      64              : # pragma warning( pop )
      65              : #endif
      66              : 
      67              : } // detail
      68              : 
      69              : } // capy
      70              : } // boost
        

Generated by: LCOV version 2.3