GCC Code Coverage Report


Directory: ./
File: libs/beast2/src/server/router_types.cpp
Date: 2025-11-20 15:35:53
Exec Total Coverage
Lines: 9 14 64.3%
Functions: 2 3 66.7%
Branches: 6 8 75.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot 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/beast2
8 //
9
10 #include <boost/beast2/server/router_types.hpp>
11 #include <boost/http_proto/string_body.hpp>
12 #include <boost/assert.hpp>
13 #include <cstring>
14
15 namespace boost {
16 namespace beast2 {
17
18 namespace detail {
19
20 const char*
21 route_cat_type::
22 name() const noexcept
23 {
24 return "boost.http_proto.route";
25 }
26
27 std::string
28 290 route_cat_type::
29 message(int code) const
30 {
31
1/1
✓ Branch 2 taken 290 times.
580 return message(code, nullptr, 0);
32 }
33
34 char const*
35 290 route_cat_type::
36 message(
37 int code,
38 char*,
39 std::size_t) const noexcept
40 {
41
5/7
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 96 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 186 times.
✗ Branch 6 not taken.
290 switch(static_cast<route>(code))
42 {
43 2 case route::close: return "http_proto::route::close";
44 2 case route::complete: return "http_proto::route::complete";
45 4 case route::detach: return "http_proto::route::detach";
46 96 case route::next: return "http_proto::route::next";
47 case route::next_route: return "http_proto::route::next_route";
48 186 case route::send: return "http_proto::route::send";
49 default:
50 return "http_proto::route::?";
51 }
52 }
53
54 // msvc 14.0 has a bug that warns about inability
55 // to use constexpr construction here, even though
56 // there's no constexpr construction
57 #if defined(_MSC_VER) && _MSC_VER <= 1900
58 # pragma warning( push )
59 # pragma warning( disable : 4592 )
60 #endif
61
62 #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
63 constinit route_cat_type route_cat;
64 #else
65 route_cat_type route_cat;
66 #endif
67
68 #if defined(_MSC_VER) && _MSC_VER <= 1900
69 # pragma warning( pop )
70 #endif
71
72 } // detail
73
74 } // beast2
75 } // boost
76