mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 22:05:39 +02:00
Cleanup and optimize stringifying of string-like types
More specifically, made the actual implementation of string-like type handling take argument as `Catch::StringRef`, instead of taking `std::string const&`. This means that string-like types that are not `std::string` no longer need to pay for an extra construction of `std::string` (including the potential allocation), before they can be stringified. The actual string stringification routine is now also better about reserving sufficient space.
This commit is contained in:
@@ -10865,6 +10865,54 @@ String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.size() == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying char arrays with statically known sizes - char
|
||||
-------------------------------------------------------------------------------
|
||||
ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying char arrays with statically known sizes - signed char
|
||||
-------------------------------------------------------------------------------
|
||||
ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying char arrays with statically known sizes - unsigned char
|
||||
-------------------------------------------------------------------------------
|
||||
ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s )
|
||||
with expansion:
|
||||
""abc"" == ""abc""
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying std::chrono::duration helpers
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -16782,6 +16830,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 360 | 268 passed | 86 failed | 6 failed as expected
|
||||
assertions: 2101 | 1932 passed | 146 failed | 23 failed as expected
|
||||
test cases: 363 | 271 passed | 86 failed | 6 failed as expected
|
||||
assertions: 2107 | 1938 passed | 146 failed | 23 failed as expected
|
||||
|
||||
|
Reference in New Issue
Block a user