diff options
| author | Stuart Dootson | 2019-07-13 13:47:56 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-07-13 14:47:56 +0200 |
| commit | 87739ad3feed09ba0284731cacaed14def894aff (patch) | |
| tree | a5e42bebf73ac1341a76ab1a14516dbeb74cc909 /projects/SelfTest/UsageTests/ToStringByte.tests.cpp | |
| parent | 0c27554af52b8fd0e6c9972326096a1b00e1e7bf (diff) | |
| download | catch3-87739ad3feed09ba0284731cacaed14def894aff.tar.gz | |
Add `std::byte` stringification support (#1686)
* Add `std::byte` support
1. Add byte detection in Catch config
2. Add a `std::byte`specialisation for Catch2::Detail::StringMaker
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringByte.tests.cpp')
| -rw-r--r-- | projects/SelfTest/UsageTests/ToStringByte.tests.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/projects/SelfTest/UsageTests/ToStringByte.tests.cpp b/projects/SelfTest/UsageTests/ToStringByte.tests.cpp new file mode 100644 index 00000000..0aad679f --- /dev/null +++ b/projects/SelfTest/UsageTests/ToStringByte.tests.cpp @@ -0,0 +1,15 @@ +#include "catch.hpp" + +#if defined(CATCH_CONFIG_CPP17_BYTE) + +TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) { + using type = std::byte; + REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); +} + +TEST_CASE( "std::vector<std::byte> -> toString", "[toString][byte][approvals]" ) { + using type = std::vector<std::byte>; + REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) ); +} + +#endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE |