catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Outline catch_strnlen's definition into catch_tostring.cpp
- Commit
a9223b2bb363c6e33bf1532b9cba0a472a69a023- Author
- ZXShady ·
- Committer
- Martin Hořeňovský
- Parents
363ca5af1816
Changes
src/catch2/catch_tostring.cpp | 6 ++++++ src/catch2/catch_tostring.hpp | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/catch2/catch_tostring.cpp b/src/catch2/catch_tostring.cpp index cc686567..20b0a629 100644 --- a/src/catch2/catch_tostring.cpp +++ b/src/catch2/catch_tostring.cpp @@ -57,6 +57,12 @@ namespace Detail { } } // end unnamed namespace + std::size_t catch_strnlen( const char* str, std::size_t n ) { + auto ret = std::char_traits<char>::find( str, n, '\0' ); + if ( ret != nullptr ) { return static_cast<std::size_t>( ret - str ); } + return n; + } + std::string convertIntoString(StringRef string, bool escapeInvisibles) { std::string ret; // This is enough for the "don't escape invisibles" case, and a good diff --git a/src/catch2/catch_tostring.hpp b/src/catch2/catch_tostring.hpp index 41f89413..aca1f7e0 100644 --- a/src/catch2/catch_tostring.hpp +++ b/src/catch2/catch_tostring.hpp @@ -40,13 +40,7 @@ namespace Catch { namespace Detail { - inline std::size_t catch_strnlen(const char *str, std::size_t n) { - auto ret = std::char_traits<char>::find(str, n, '\0'); - if (ret != nullptr) { - return static_cast<std::size_t>(ret - str); - } - return n; - } + std::size_t catch_strnlen(const char *str, std::size_t n); constexpr StringRef unprintableString = "{?}"_sr;