--- a/tests/test_json.c Sat Dec 06 16:30:11 2025 +0100 +++ b/tests/test_json.c Sat Dec 06 17:51:08 2025 +0100 @@ -1335,45 +1335,45 @@ cxBufferInit(&buf, NULL, 32, NULL, 0); CX_TEST_DO { // test default settings (6 digits) - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "3.141592")); // test too many digits cxBufferReset(&buf); writer.frac_max_digits = 200; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "3.141592653589793")); // test 0 digits cxBufferReset(&buf); writer.frac_max_digits = 0; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "3")); // test 2 digits cxBufferReset(&buf); writer.frac_max_digits = 2; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "3.14")); // test 3 digits cxBufferReset(&buf); writer.frac_max_digits = 3; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "3.141")); // test 6 digits, but two are left of the decimal point num->number = 47.110815; cxBufferReset(&buf); writer.frac_max_digits = 6; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "47.110815")); // test 4 digits with exponent num->number = 5.11223344e23; cxBufferReset(&buf); writer.frac_max_digits = 4; - cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, num, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "5.1122e+23")); } cxBufferDestroy(&buf); @@ -1400,7 +1400,7 @@ CxBuffer buf; cxBufferInit(&buf, NULL, 128, NULL, 0); CX_TEST_DO { - cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "\"hello\\twörld\\r\\nthis is\\\\a \\\"string\\\"\\b in \\u0007 string\\f\"")); } @@ -1416,7 +1416,7 @@ CxBuffer buf; cxBufferInit(&buf, NULL, 128, NULL, 0); CX_TEST_DO { - cxJsonWrite(&buf, obj, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, obj, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "{\"hello\\twörld\\r\\nthis is\\\\a \\\"string\\\"\\b in \\u0007 string\\f\":true}")); } @@ -1431,13 +1431,13 @@ cxBufferInit(&buf, NULL, 16, NULL, 0); CX_TEST_DO { // default: do not escape - cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "\"test/solidus\"")); // enable escaping writer.escape_slash = true; cxBufferReset(&buf); - cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, str, cxBufferWriteFunc, &writer)); CX_TEST_ASSERT(0 == cx_strcmp(cx_strn(buf.space, buf.size), "\"test\\/solidus\"")); } cxBufferDestroy(&buf); @@ -1450,7 +1450,7 @@ CX_TEST_DO { CxJsonValue nothing; nothing.type = CX_JSON_NOTHING; - cxJsonWrite(&buf, ¬hing, cxBufferWriteFunc, NULL); + CX_TEST_ASSERT(0 == cxJsonWrite(&buf, ¬hing, cxBufferWriteFunc, NULL)); CX_TEST_ASSERT(buf.size == 0); } cxBufferDestroy(&buf);