10# pragma clang diagnostic push
11# pragma clang diagnostic ignored "-Wexit-time-destructors"
12# pragma clang diagnostic ignored "-Wglobal-constructors"
16#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
17#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
35 const int hexThreshold = 255;
38 enum Arch { Big, Little };
43 char asChar[
sizeof (int)];
47 return ( u.asChar[
sizeof(
int)-1] == 1 ) ? Big : Little;
54 int i = 0, end =
static_cast<int>( size ),
inc = 1;
55 if( Endianness::which() == Endianness::Little ) {
60 unsigned char const *bytes =
static_cast<unsigned char const *
>(
object);
62 rss <<
"0x" << std::setfill(
'0') << std::hex;
63 for( ; i !=
end; i +=
inc )
64 rss << std::setw(2) <<
static_cast<unsigned>(bytes[i]);
77 rss << std::setprecision( precision )
80 std::string
d = rss.
str();
81 std::size_t i =
d.find_last_not_of(
'0' );
82 if( i != std::string::npos && i !=
d.size()-1 ) {
85 d =
d.substr( 0, i+1 );
99 return '"' + str +
'"';
120#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
122 return ::Catch::Detail::stringify(std::string{ str });
128 return ::Catch::Detail::stringify(std::string{
str });
130 return{
"{null string}" };
135 return ::Catch::Detail::stringify(std::string{ str });
137 return{
"{null string}" };
141#ifdef CATCH_CONFIG_WCHAR
144 s.reserve(wstr.size());
145 for (
auto c : wstr) {
146 s += (c <= 0xff) ? static_cast<char>(c) :
'?';
148 return ::Catch::Detail::stringify(
s);
151# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
159 return ::Catch::Detail::stringify(std::wstring{ str });
161 return{
"{null string}" };
166 return ::Catch::Detail::stringify(std::wstring{ str });
168 return{
"{null string}" };
175 return ::Catch::Detail::stringify(
static_cast<long long>(
value));
178 return ::Catch::Detail::stringify(
static_cast<long long>(
value));
183 if (
value > Detail::hexThreshold) {
184 rss <<
" (0x" << std::hex <<
value <<
')';
190 return ::Catch::Detail::stringify(
static_cast<unsigned long long>(
value));
193 return ::Catch::Detail::stringify(
static_cast<unsigned long long>(
value));
196 ReusableStringStream rss;
198 if (
value > Detail::hexThreshold) {
199 rss <<
" (0x" << std::hex <<
value <<
')';
206 return b ?
"true" :
"false";
212 }
else if (
value ==
'\f') {
214 }
else if (
value ==
'\n') {
216 }
else if (
value ==
'\t') {
219 return ::Catch::Detail::stringify(
static_cast<unsigned int>(
value));
221 char chstr[] =
"' '";
227 return ::Catch::Detail::stringify(
static_cast<signed char>(c));
230 return ::Catch::Detail::stringify(
static_cast<char>(c));
244std::string ratio_string<std::atto>::symbol() {
return "a"; }
245std::string ratio_string<std::femto>::symbol() {
return "f"; }
246std::string ratio_string<std::pico>::symbol() {
return "p"; }
247std::string ratio_string<std::nano>::symbol() {
return "n"; }
248std::string ratio_string<std::micro>::symbol() {
return "u"; }
249std::string ratio_string<std::milli>::symbol() {
return "m"; }
253#if defined(__clang__)
254# pragma clang diagnostic pop
auto str() const -> std::string
const std::string unprintableString
std::string rawMemoryToString(const void *object, std::size_t size)
IContext & getCurrentContext()
std::string fpToString(T value, int precision)
#define T(meth, val, expected)
static std::enable_if<::Catch::Detail::IsStreamInsertable< Fake >::value, std::string >::type convert(const Fake &value)
void inc(const Operand &op)
yh_object_descriptor object