🚨 fix a maybe-uninitialized warning

This commit is contained in:
Niels Lohmann 2020-06-09 16:57:06 +02:00
parent 14881cf901
commit 262d9cc67d
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69

View file

@ -359,9 +359,9 @@ TEST_CASE("formatting")
{
auto check_float = [](float number, const std::string & expected)
{
char buf[33];
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
std::string actual(buf, end);
std::array<char, 33> buf{};
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
std::string actual(buf.data(), end);
CHECK(actual == expected);
};
@ -419,9 +419,9 @@ TEST_CASE("formatting")
{
auto check_double = [](double number, const std::string & expected)
{
char buf[33];
char* end = nlohmann::detail::to_chars(buf, buf + 32, number);
std::string actual(buf, end);
std::array<char, 33> buf{};
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
std::string actual(buf.data(), end);
CHECK(actual == expected);
};