--- a/tests/test_json.c Fri Dec 27 12:23:14 2024 +0100 +++ b/tests/test_json.c Fri Dec 27 13:01:31 2024 +0100 @@ -376,6 +376,14 @@ CX_TEST_ASSERT(cxJsonAsInteger(v) == 12300); CX_TEST_ASSERT(cxJsonAsDouble(v) == 12300.0); cxJsonValueFree(v); + + cxJsonFill(&json, "18446744073709551615.0123456789 "); + result = cxJsonNext(&json, &v); + CX_TEST_ASSERT(result == CX_JSON_NO_ERROR); + CX_TEST_ASSERT(cxJsonIsNumber(v)); + // be as precise as possible + CX_TEST_ASSERT(cxJsonAsDouble(v) == 1.8446744073709552e+19); + cxJsonValueFree(v); } cxJsonDestroy(&json); } @@ -394,15 +402,6 @@ CX_TEST_ASSERT(v->type == CX_JSON_NOTHING); cxJsonReset(&json); -#if 0 // TODO: discuss if it is intended that this produces -47 as valid value - cxJsonFill(&json, "-47,11e2 "); - result = cxJsonNext(&json, &v); - CX_TEST_ASSERTM(result == CX_JSON_FORMAT_ERROR_UNEXPECTED_TOKEN, - "decimal separator cannot be a comma"); - CX_TEST_ASSERT(v->type == CX_JSON_NOTHING); - cxJsonReset(&json); -#endif - cxJsonFill(&json, "0.815e-3.0 "); result = cxJsonNext(&json, &v); CX_TEST_ASSERTM(result == CX_JSON_FORMAT_ERROR_NUMBER, @@ -451,13 +450,6 @@ "30 digit int does not fit into 64-bit int"); CX_TEST_ASSERT(v->type == CX_JSON_NOTHING); cxJsonReset(&json); - - cxJsonFill(&json, "18446744073709551615.0123456789 "); - result = cxJsonNext(&json, &v); - CX_TEST_ASSERTM(result == CX_JSON_FORMAT_ERROR_NUMBER, - "numbers with more than 30 characters are unsupported in general"); - CX_TEST_ASSERT(v->type == CX_JSON_NOTHING); - cxJsonReset(&json); } cxJsonDestroy(&json); }