--- a/tests/test_json.c Sun Dec 14 14:15:26 2025 +0100 +++ b/tests/test_json.c Sun Dec 14 14:29:27 2025 +0100 @@ -1676,8 +1676,7 @@ } CX_TEST_DO { - // TODO: only the first test works yet, change i<1 to i<10 for all tests - for(int i=0;i<1;i++) { + for(unsigned i=0;i<cx_nmemb(a);i++) { CX_TEST_ASSERT(cxJsonIsObject(a[i])); CxJsonValue *b = cxJsonClone(a[i], NULL); @@ -1686,10 +1685,11 @@ CX_TEST_ASSERT(b->type == a[i]->type); CX_TEST_ASSERT(cxJsonCompare(a[i], b) == 0); - // TODO: cxJsonToString(b, NULL) segfaults - //cxmutstr a_str = cxJsonToString(a[i], NULL); - //cxmutstr b_str = cxJsonToString(b, NULL); - //CX_TEST_ASSERT(cx_strcmp(a_str, b_str) == 0); + cxmutstr a_str = cxJsonToString(a[i], NULL); + cxmutstr b_str = cxJsonToString(b, NULL); + CX_TEST_ASSERT(cx_strcmp(a_str, b_str) == 0); + cx_strfree(&a_str); + cx_strfree(&b_str); cxJsonValueFree(b); } @@ -1710,8 +1710,7 @@ cxJsonFromString(NULL, "[ { \"array\": [ 1,2,3 ]} ]", &a[5]); CX_TEST_DO { - // TODO: only the first 4 tests work. Change i<4 to i<6 - for(int i=0;i<4;i++) { + for(unsigned i=0;i<cx_nmemb(a);i++) { CX_TEST_ASSERT(cxJsonIsArray(a[i])); CxJsonValue *b = cxJsonClone(a[i], NULL); @@ -1719,11 +1718,12 @@ CX_TEST_ASSERT(cxJsonIsArray(b)); CX_TEST_ASSERT(cxJsonCompare(a[i], b) == 0); - // TODO: enable when cxJsonToString(b, NULL) works - //cxmutstr a_str = cxJsonToString(a[i], NULL); - //cxmutstr b_str = cxJsonToString(b, NULL); - //CX_TEST_ASSERT(cx_strcmp(a_str, b_str) == 0); - + cxmutstr a_str = cxJsonToString(a[i], NULL); + cxmutstr b_str = cxJsonToString(b, NULL); + CX_TEST_ASSERT(cx_strcmp(a_str, b_str) == 0); + cx_strfree(&a_str); + cx_strfree(&b_str); + cxJsonValueFree(b); } }