I was checking the unit tests in the Juce Demo and noticed that the JSON unit tests occasionally fail when parsing the random vars (line 636 of juce_JSON.cpp). It can take a number of runs to see it come up, but I've confirmed it with the latest tip.
To make it easier to replicate I did a bit of debugging and came up with following repro (just keep the rest of JSONTests as is):
void runTest () override
{
beginTest ("JSON");
var v;
Random r (0xc7764c);
bool oneLine;
for (int i = 1000; --i >= 563;)
{
if (i > 0)
v = createRandomVar (r, 0);
oneLine = r.nextBool ();
}
String asString (JSON::toString (v, oneLine));
var parsed = JSON::parse ("[" + asString + "]")[0];
String parsedString (JSON::toString (parsed, oneLine));
expect (asString.isNotEmpty () && parsedString == asString);
}
Yeah, I've seen this too, but I think it's just an edge-case where very large double values are being converted to strings and back to doubles, and lose a tiny amount of precision in the process. Don't think it would impact any real-world code.
I noticed JSON test fail , even though the test runner showed all tests passed at the very end result, there was one that didn't I happened to catch it as it flew by the screen
Starting test: JSON / JSON...
!!! Test 97 failed
FAILED!! 1 test failed, out of a total of 109
The test runner showed evertyhing was fine but one test in the mix failed, is there some way to ignore certain test failures or could there be a problem with test runner?
Ah, we get occasional failures in that one because of string<->int conversion rounding errors, it's not a real problem but we should probably make the test a little more forgiving..
I’ve actually never seen a problem with the Time tests - perhaps there’s something different about the locale you’re using - what time zone are you in?