GCC Code Coverage Report


Directory: libs/json/include/boost/json/
File: impl/kind.ipp
Date: 2025-12-23 17:20:53
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 2 2 100.0%
Branches: 8 8 100.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2019 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/boostorg/json
8 //
9
10 #ifndef BOOST_JSON_IMPL_KIND_IPP
11 #define BOOST_JSON_IMPL_KIND_IPP
12
13 #include <boost/json/kind.hpp>
14 #include <ostream>
15
16 namespace boost {
17 namespace json {
18
19 string_view
20 16 to_string(kind k) noexcept
21 {
22
8/8
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 2 times.
16 switch(k)
23 {
24 2 case kind::array: return "array";
25 2 case kind::object: return "object";
26 2 case kind::string: return "string";
27 2 case kind::int64: return "int64";
28 2 case kind::uint64: return "uint64";
29 2 case kind::double_: return "double";
30 2 case kind::bool_: return "bool";
31 2 default: // satisfy warnings
32 2 case kind::null: return "null";
33 }
34 }
35
36 std::ostream&
37 8 operator<<(std::ostream& os, kind k)
38 {
39 8 os << to_string(k);
40 8 return os;
41 }
42
43 } // namespace json
44 } // namespace boost
45
46 #endif
47