mirror of
https://github.com/json-c/json-c.git
synced 2026-04-07 06:19:07 +08:00
Fix memory leaks in test_double_serializer, and make sure all tests return 0 at the end of main().
This commit is contained in:
@@ -14,6 +14,8 @@ int main(int argc, char **argv)
|
|||||||
MC_SET_DEBUG(1);
|
MC_SET_DEBUG(1);
|
||||||
|
|
||||||
test_case_parse();
|
test_case_parse();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make sure only lowercase forms are parsed in strict mode */
|
/* make sure only lowercase forms are parsed in strict mode */
|
||||||
|
|||||||
@@ -86,12 +86,16 @@ int main()
|
|||||||
/* Test NaN handling */
|
/* Test NaN handling */
|
||||||
obj = json_object_new_double(zero_dot_zero / zero_dot_zero);
|
obj = json_object_new_double(zero_dot_zero / zero_dot_zero);
|
||||||
printf("obj(0.0/0.0)=%s\n", json_object_to_json_string(obj));
|
printf("obj(0.0/0.0)=%s\n", json_object_to_json_string(obj));
|
||||||
|
json_object_put(obj);
|
||||||
|
|
||||||
/* Test Infinity and -Infinity handling */
|
/* Test Infinity and -Infinity handling */
|
||||||
obj = json_object_new_double(1.0/zero_dot_zero);
|
obj = json_object_new_double(1.0/zero_dot_zero);
|
||||||
printf("obj(1.0/0.0)=%s\n", json_object_to_json_string(obj));
|
printf("obj(1.0/0.0)=%s\n", json_object_to_json_string(obj));
|
||||||
|
json_object_put(obj);
|
||||||
|
|
||||||
obj = json_object_new_double(-1.0/zero_dot_zero);
|
obj = json_object_new_double(-1.0/zero_dot_zero);
|
||||||
printf("obj(-1.0/0.0)=%s\n", json_object_to_json_string(obj));
|
printf("obj(-1.0/0.0)=%s\n", json_object_to_json_string(obj));
|
||||||
|
json_object_put(obj);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,5 +58,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string_ext(new_obj,JSON_C_TO_STRING_NOZERO));
|
printf("new_obj.to_string()=%s\n", json_object_to_json_string_ext(new_obj,JSON_C_TO_STRING_NOZERO));
|
||||||
json_object_put(new_obj);
|
json_object_put(new_obj);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ int main(void)
|
|||||||
puts(separator);
|
puts(separator);
|
||||||
test_incremental_parse();
|
test_incremental_parse();
|
||||||
puts(separator);
|
puts(separator);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static json_c_visit_userfunc clear_serializer;
|
static json_c_visit_userfunc clear_serializer;
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ int main(void)
|
|||||||
printf("================================\n\n");
|
printf("================================\n\n");
|
||||||
|
|
||||||
json_object_put(jso);
|
json_object_put(jso);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user