From 01930357f7bd52672bffbb3aef76f241d03e4906 Mon Sep 17 00:00:00 2001 From: Alex Astashyn Date: Thu, 8 Dec 2016 22:39:38 -0500 Subject: [PATCH] Tweaking unit test, as digits grouping is failing to be invoked in CI --- test/src/unit-regression.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 3e303fbb0..c4b87399a 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -403,37 +403,19 @@ TEST_CASE("regression tests") SECTION("issue #378 - locale-independent num-to-str") { - setlocale(LC_NUMERIC, ""); - - auto loc = localeconv(); - auto orig_decimal_point = loc->decimal_point; - auto orig_thousands_sep = loc->thousands_sep; - char comma[] = ","; - char thsep[] = "'"; - - loc->decimal_point = comma; - loc->thousands_sep = thsep; + setlocale(LC_NUMERIC, "de_DE.UTF-8"); // verify that snprintf uses special decimal and grouping characters { std::array buf; std::snprintf(buf.data(), buf.size(), "%.2f", 12345.67); CHECK(strcmp(buf.data(), "12345,67") == 0); - - buf.fill(0); - std::snprintf(buf.data(), buf.size(), "%'d", 1234567); - CHECK(strcmp(buf.data(), "1'234'567") == 0); } // verify that dumped correctly with '.' and no grouping const json j1 = 12345.67; - CHECK(j1.dump() == "12345.67"); - - const json j2 = 1234567; - CHECK(j2.dump() == "1234567"); - - loc->decimal_point = orig_decimal_point; - loc->thousands_sep = orig_thousands_sep; + CHECK(json(12345.67).dump() == "12345.67"); + setlocale(LC_NUMERIC, "C"); } SECTION("issue #233 - Can't use basic_json::iterator as a base iterator for std::move_iterator")