| 1414 cxJsonValueFree(json[i]); |
1414 cxJsonValueFree(json[i]); |
| 1415 } |
1415 } |
| 1416 } |
1416 } |
| 1417 |
1417 |
| 1418 CX_TEST(test_json_compare_arrays) { |
1418 CX_TEST(test_json_compare_arrays) { |
| 1419 CX_TEST_DO { |
1419 char *str[4]; |
| 1420 |
1420 str[0] = "[]"; |
| |
1421 str[1] = "[ true, false ]"; |
| |
1422 str[2] = "[ 0, 1, \"hello\", true, false, null, {}, {\"a\":\"b\"}]"; |
| |
1423 str[3] = "[ \"test\", [ 1, 2, [ \"sub\", \"sub1\", [{\"end\":null}]]]]"; |
| |
1424 |
| |
1425 CxJsonValue *a[4]; |
| |
1426 CxJsonValue *b[4]; |
| |
1427 for(int i=0;i<4;i++) { |
| |
1428 cxJsonFromString(NULL, str[i], &a[i]); |
| |
1429 cxJsonFromString(NULL, str[i], &b[i]); |
| |
1430 } |
| |
1431 |
| |
1432 CX_TEST_DO { |
| |
1433 for(int i=0;i<4;i++) { |
| |
1434 for(int j=0;j<4;j++) { |
| |
1435 int ret = cxJsonCompare(a[i], b[j]); |
| |
1436 CX_TEST_ASSERT(i == j ? ret == 0 : ret != 0); |
| |
1437 } |
| |
1438 } |
| |
1439 } |
| |
1440 |
| |
1441 for(int i=0;i<4;i++) { |
| |
1442 cxJsonValueFree(a[i]); |
| |
1443 cxJsonValueFree(b[i]); |
| 1421 } |
1444 } |
| 1422 } |
1445 } |
| 1423 |
1446 |
| 1424 |
1447 |
| 1425 static CxJsonValue *test_json_write_create_test_object(const CxAllocator *allocator) { |
1448 static CxJsonValue *test_json_write_create_test_object(const CxAllocator *allocator) { |