72.73% Lines (8/11)
100.00% Functions (3/3)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // | 3 | // | |||||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 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) | 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 6 | // | 6 | // | |||||
| 7 | // Official repository: https://github.com/cppalliance/http | 7 | // Official repository: https://github.com/cppalliance/http | |||||
| 8 | // | 8 | // | |||||
| 9 | 9 | |||||||
| 10 | #include <boost/http/bcrypt.hpp> | 10 | #include <boost/http/bcrypt.hpp> | |||||
| 11 | 11 | |||||||
| 12 | namespace boost { | 12 | namespace boost { | |||||
| 13 | namespace http { | 13 | namespace http { | |||||
| 14 | namespace bcrypt { | 14 | namespace bcrypt { | |||||
| 15 | namespace detail { | 15 | namespace detail { | |||||
| 16 | 16 | |||||||
| 17 | const char* | 17 | const char* | |||||
| HITCBC | 18 | 2 | error_cat_type:: | 18 | 2 | error_cat_type:: | ||
| 19 | name() const noexcept | 19 | name() const noexcept | |||||
| 20 | { | 20 | { | |||||
| HITCBC | 21 | 2 | return "boost.http.bcrypt"; | 21 | 2 | return "boost.http.bcrypt"; | ||
| 22 | } | 22 | } | |||||
| 23 | 23 | |||||||
| 24 | std::string | 24 | std::string | |||||
| HITCBC | 25 | 4 | error_cat_type:: | 25 | 4 | error_cat_type:: | ||
| 26 | message(int ev) const | 26 | message(int ev) const | |||||
| 27 | { | 27 | { | |||||
| HITCBC | 28 | 8 | return message(ev, nullptr, 0); | 28 | 8 | return message(ev, nullptr, 0); | ||
| 29 | } | 29 | } | |||||
| 30 | 30 | |||||||
| 31 | char const* | 31 | char const* | |||||
| HITCBC | 32 | 4 | error_cat_type:: | 32 | 4 | error_cat_type:: | ||
| 33 | message( | 33 | message( | |||||
| 34 | int ev, | 34 | int ev, | |||||
| 35 | char*, | 35 | char*, | |||||
| 36 | std::size_t) const noexcept | 36 | std::size_t) const noexcept | |||||
| 37 | { | 37 | { | |||||
| HITCBC | 38 | 4 | switch(static_cast<error>(ev)) | 38 | 4 | switch(static_cast<error>(ev)) | ||
| 39 | { | 39 | { | |||||
| MISUBC | 40 | ✗ | case error::ok: return "success"; | 40 | ✗ | case error::ok: return "success"; | ||
| HITCBC | 41 | 1 | case error::invalid_salt: return "invalid salt"; | 41 | 1 | case error::invalid_salt: return "invalid salt"; | ||
| HITCBC | 42 | 3 | case error::invalid_hash: return "invalid hash"; | 42 | 3 | case error::invalid_hash: return "invalid hash"; | ||
| MISUBC | 43 | ✗ | default: | 43 | ✗ | default: | ||
| MISUBC | 44 | ✗ | return "unknown"; | 44 | ✗ | return "unknown"; | ||
| 45 | } | 45 | } | |||||
| 46 | } | 46 | } | |||||
| 47 | 47 | |||||||
| 48 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | 48 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | |||||
| 49 | constinit error_cat_type error_cat; | 49 | constinit error_cat_type error_cat; | |||||
| 50 | #else | 50 | #else | |||||
| 51 | error_cat_type error_cat; | 51 | error_cat_type error_cat; | |||||
| 52 | #endif | 52 | #endif | |||||
| 53 | 53 | |||||||
| 54 | } // detail | 54 | } // detail | |||||
| 55 | } // bcrypt | 55 | } // bcrypt | |||||
| 56 | } // http | 56 | } // http | |||||
| 57 | } // boost | 57 | } // boost | |||||