mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
If std::swprintf is broken, disable relevant test and warn about it
This commit is contained in:
parent
85b985e9f2
commit
3e03934d15
@ -87,6 +87,11 @@ void std_format(long double value, std::string &result) {
|
||||
safe_sprintf(buffer, "%Lg", value);
|
||||
result = buffer;
|
||||
}
|
||||
void std_format(long double value, std::wstring &result) {
|
||||
wchar_t buffer[100];
|
||||
swprintf(buffer, L"%Lg", value);
|
||||
result = buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Checks if writing value to BasicWriter<Char> produces the same result
|
||||
@ -284,7 +289,13 @@ TEST(WriterTest, WriteDouble) {
|
||||
|
||||
TEST(WriterTest, WriteLongDouble) {
|
||||
CHECK_WRITE(4.2l);
|
||||
CHECK_WRITE(-4.2l);
|
||||
CHECK_WRITE_CHAR(-4.2l);
|
||||
std::wstring str;
|
||||
std_format(4.2l, str);
|
||||
if (str[0] != '-')
|
||||
CHECK_WRITE_WCHAR(-4.2l);
|
||||
else
|
||||
fmt::print("warning: long double formatting with std::swprintf is broken");
|
||||
CHECK_WRITE(std::numeric_limits<long double>::min());
|
||||
CHECK_WRITE(std::numeric_limits<long double>::max());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user