1
0
mirror of https://github.com/nlohmann/json synced 2024-11-23 20:40:08 +00:00

🐛 make SAX output locale-independent #4084

This commit is contained in:
Niels Lohmann 2024-11-22 11:25:51 +01:00
parent 0b8da375b9
commit 77284a4763
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69

View File

@ -114,7 +114,7 @@ TEST_CASE("locale-dependent test (LC_NUMERIC=C)")
SECTION("check if locale is properly set") SECTION("check if locale is properly set")
{ {
std::array<char, 6> buffer = {}; std::array<char, 6> buffer = {};
CHECK(std::snprintf(buffer.data(), buffer.size(), "%.2f", 12.34) == 5); // NOLINT(cppcoreguidelines-pro-type-vararg) CHECK(std::snprintf(buffer.data(), buffer.size(), "%.2f", 12.34) == 5); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
CHECK(std::string(buffer.data()) == "12.34"); CHECK(std::string(buffer.data()) == "12.34");
} }
@ -138,7 +138,7 @@ TEST_CASE("locale-dependent test (LC_NUMERIC=de_DE)")
SECTION("check if locale is properly set") SECTION("check if locale is properly set")
{ {
std::array<char, 6> buffer = {}; std::array<char, 6> buffer = {};
CHECK(std::snprintf(buffer.data(), buffer.size(), "%.2f", 12.34) == 5); // NOLINT(cppcoreguidelines-pro-type-vararg) CHECK(std::snprintf(buffer.data(), buffer.size(), "%.2f", 12.34) == 5); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
CHECK(std::string(buffer.data()) == "12,34"); CHECK(std::string(buffer.data()) == "12,34");
} }