mirror of
https://github.com/nlohmann/json.git
synced 2024-08-25 06:17:02 +02:00
made tests independent of "C" locale
This commit is contained in:
parent
0b60d970e9
commit
a744c62696
|
@ -12383,7 +12383,18 @@ TEST_CASE("regression tests")
|
||||||
json j3b = json::parse("10E3");
|
json j3b = json::parse("10E3");
|
||||||
json j3c = 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(j1a.dump() == "23.42");
|
||||||
CHECK(j1b.dump() == "23.42");
|
CHECK(j1b.dump() == "23.42");
|
||||||
|
|
Loading…
Reference in a new issue