From d2e9ce270a642e4ca7e00fc160c81eadb55a5639 Mon Sep 17 00:00:00 2001 From: Alex Astashyn Date: Tue, 6 Dec 2016 22:18:20 -0500 Subject: [PATCH] Trying to coerce setlocale to make snprintf use commas as delimiter; the behavior appears to be compiler/platform-specific --- test/src/unit-regression.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 2787fe261..17616a3e6 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -407,21 +407,21 @@ TEST_CASE("regression tests") { const std::string orig_locale_name(setlocale(LC_ALL, NULL)); - setlocale(LC_NUMERIC, "de_DE"); + setlocale(LC_NUMERIC, "fr_Fr.UTF-8"); std::array buf; { // verify that snprintf now uses commas as decimal-separator std::snprintf(buf.data(), buf.size(), "%.2f", 3.14); - assert(std::strcmp(buf.data(), "3,14") == 0); + CHECK(std::strcmp(buf.data(), "3,14") == 0); // verify that strtod now uses commas as decimal-separator const double d1 = std::strtod(buf.data(), nullptr); - assert(d1 == 3.14); + CHECK(d1 == 3.14); // verify that strtod does not understand dots as decimal separator const double d2 = std::strtod("3.14", nullptr); - assert(d2 == 3); + CHECK(d2 == 3); } const json j1 = json::parse("3.14");