Skip to content

Commit

Permalink
made tests independent of "C" locale
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Apr 5, 2016
1 parent 0b60d97 commit a744c62
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12383,7 +12383,18 @@ TEST_CASE("regression tests")
json j3b = json::parse("10E3");
json j3c = json::parse("10e3");

std::locale::global(std::locale("de_DE"));
// class to create a locale that would use a comma for decimals
class CommaDecimalSeparator : public std::numpunct<char>
{
protected:
char do_decimal_point() const
{
return ',';
}
};

// change locale to mess with decimal points
std::locale::global(std::locale(std::locale(), new CommaDecimalSeparator));

CHECK(j1a.dump() == "23.42");
CHECK(j1b.dump() == "23.42");
Expand Down

0 comments on commit a744c62

Please sign in to comment.