提交 d992cd46 编写于 作者: M Max Bruckner

test: Handle cJSON_PrintPreallocated return values correctly

上级 84b48121
......@@ -123,7 +123,7 @@ static int print_preallocated(cJSON *root)
}
/* Print to buffer */
if (cJSON_PrintPreallocated(root, buf, len, 1) != 0) {
if (!cJSON_PrintPreallocated(root, buf, len, 1)) {
printf("cJSON_PrintPreallocated failed!\n");
if (strcmp(out, buf) != 0) {
printf("cJSON_PrintPreallocated not the same as cJSON_Print!\n");
......@@ -140,7 +140,7 @@ static int print_preallocated(cJSON *root)
printf("%s\n", buf);
/* force it to fail */
if (cJSON_PrintPreallocated(root, buf_fail, len_fail, 1) == 0) {
if (cJSON_PrintPreallocated(root, buf_fail, len_fail, 1)) {
printf("cJSON_PrintPreallocated failed to show error with insufficient memory!\n");
printf("cJSON_Print result:\n%s\n", out);
printf("cJSON_PrintPreallocated result:\n%s\n", buf_fail);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册