diff --git a/test/format-test.cc b/test/format-test.cc index ac908b8c..4f6fc5fe 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -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 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::min()); CHECK_WRITE(std::numeric_limits::max()); }