neslib / Neslib.Json

Fast and memory-efficient JSON for Delphi
Other
79 stars 23 forks source link

UnitTest fails when decimal symbol is comma #2

Closed dados closed 5 years ago

dados commented 5 years ago

My Windows is set to Icelandic regional settings and we use comma as a decimal separator. Tried with decimal symbol as a dot and a comma and the test fails with a comma decimal separator To Change The Format Goto: Control Panel -> Region -> Additional Settings -> Decimal Symbol

Tests Found : 187 Tests Ignored : 0 Tests Passed : 181 Tests Leaked : 0 Tests Failed : 6 Tests Errored : 0

Failing Tests

Tests.Neslib.Json.IO.TestJsonData.test_array_04 Message: Expected .=[] .[0]=1 .[1]="abc" .[2]=12.3 .[3]=-4 is not equal to actual .=[] .[0]=1 .[1]="abc" .[2]=12,3 .[3]=-4

Tests.Neslib.Json.IO.TestJsonData.test_basic_03 Message: Expected .=1.2345678 is not equal to actual .=1,2345678

Tests.Neslib.Json.IO.TestJsonData.test_real_04 Message: Expected .=1.2345678 is not equal to actual .=1,2345678

Tests.Neslib.Json.IO.TestJsonData.test_real_05 Message: Expected .=1234567.8 is not equal to actual .=1234567,8

Tests.Neslib.Json.IO.TestJsonData.test_real_06 Message: Expected .=-1.2345678 is not equal to actual .=-1,2345678

Tests.Neslib.Json.IO.TestJsonData.test_real_07 Message: Expected .=-1234567.8 is not equal to actual .=-1234567,8

neslib commented 5 years ago

Thanks for reporting! Fortunately, the issue was not in the JSON library itself (where I use TFormatSettings to perform region-independent conversions). Instead, it was in the unit test code, where I forgot to use a TFormatSettings. Should be fixed now.