mirror of
https://github.com/kgabis/parson.git
synced 2024-11-24 06:05:29 +00:00
parent
dd9eed2af2
commit
e410fc7c33
2
parson.c
2
parson.c
@ -42,7 +42,7 @@
|
||||
#define STARTING_CAPACITY 15
|
||||
#define ARRAY_MAX_CAPACITY 122880 /* 15*(2^13) */
|
||||
#define OBJECT_MAX_CAPACITY 960 /* 15*(2^6) */
|
||||
#define MAX_NESTING 19
|
||||
#define MAX_NESTING 2048
|
||||
#define DOUBLE_SERIALIZATION_FORMAT "%f"
|
||||
|
||||
#define SIZEOF_TOKEN(a) (sizeof(a) - 1)
|
||||
|
11
tests.c
11
tests.c
@ -86,9 +86,7 @@ void test_suite_1(void) {
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string_pretty(val)), val));
|
||||
if (val) { json_value_free(val); }
|
||||
|
||||
TEST((val = json_parse_file("tests/test_1_2.txt")) != NULL);
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string(val)), val));
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string_pretty(val)), val));
|
||||
TEST((val = json_parse_file("tests/test_1_2.txt")) == NULL); /* Over 2048 levels of nesting */
|
||||
if (val) { json_value_free(val); }
|
||||
|
||||
TEST((val = json_parse_file("tests/test_1_3.txt")) != NULL);
|
||||
@ -101,9 +99,7 @@ void test_suite_1(void) {
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string_pretty(val)), val));
|
||||
if (val) { json_value_free(val); }
|
||||
|
||||
TEST((val = json_parse_file_with_comments("tests/test_1_2.txt")) != NULL);
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string(val)), val));
|
||||
TEST(json_value_equals(json_parse_string(json_serialize_to_string_pretty(val)), val));
|
||||
TEST((val = json_parse_file_with_comments("tests/test_1_2.txt")) == NULL); /* Over 2048 levels of nesting */
|
||||
if (val) { json_value_free(val); }
|
||||
|
||||
TEST((val = json_parse_file_with_comments("tests/test_1_3.txt")) != NULL);
|
||||
@ -238,8 +234,6 @@ void test_suite_2_with_comments(void) {
|
||||
}
|
||||
|
||||
void test_suite_3(void) {
|
||||
char nested_20x[] = "[[[[[[[[[[[[[[[[[[[[\"hi\"]]]]]]]]]]]]]]]]]]]]";
|
||||
|
||||
puts("Testing valid strings:");
|
||||
TEST(json_parse_string("{\"lorem\":\"ipsum\"}") != NULL);
|
||||
TEST(json_parse_string("[\"lorem\"]") != NULL);
|
||||
@ -281,7 +275,6 @@ void test_suite_3(void) {
|
||||
TEST(json_parse_string("[\"\n\"]") == NULL); /* control character */
|
||||
TEST(json_parse_string("[\"\f\"]") == NULL); /* control character */
|
||||
TEST(json_parse_string("[\"\r\"]") == NULL); /* control character */
|
||||
TEST(json_parse_string(nested_20x) == NULL); /* too deep */
|
||||
TEST(json_parse_string("[0x2]") == NULL); /* hex */
|
||||
TEST(json_parse_string("[0X2]") == NULL); /* HEX */
|
||||
TEST(json_parse_string("[07]") == NULL); /* octals */
|
||||
|
@ -1 +1 @@
|
||||
[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
|
||||
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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