mirror of
https://github.com/json-c/json-c.git
synced 2026-03-29 01:49:06 +08:00
Issue #103: allow Infinity and -Infinity to be parsed.
This commit is contained in:
@@ -51,6 +51,34 @@ static void test_basic_parse()
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("-NaN"); /* non-sensical, returns null */
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("Inf"); /* must use full string, returns null */
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("inf"); /* must use full string, returns null */
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("Infinity");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("infinity");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("-Infinity");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("-infinity");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
new_obj = json_tokener_parse("True");
|
||||
printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
|
||||
json_object_put(new_obj);
|
||||
|
||||
@@ -4,6 +4,13 @@ new_obj.to_string()="foo"
|
||||
new_obj.to_string()="ABC"
|
||||
new_obj.to_string()=null
|
||||
new_obj.to_string()=NaN
|
||||
new_obj.to_string()=null
|
||||
new_obj.to_string()=null
|
||||
new_obj.to_string()=null
|
||||
new_obj.to_string()=Infinity
|
||||
new_obj.to_string()=Infinity
|
||||
new_obj.to_string()=-Infinity
|
||||
new_obj.to_string()=-Infinity
|
||||
new_obj.to_string()=true
|
||||
new_obj.to_string()=12
|
||||
new_obj.to_string()=12.3
|
||||
|
||||
Reference in New Issue
Block a user