387 gchar *path_str, *error_message;
388 cJSON *expanded, *child;
400 assert_that (error_message, is_equal_to_string (NULL));
401 assert_that (expanded, is_not_null);
402 assert_that (cJSON_IsArray (expanded), is_true);
403 assert_that (expanded->child, is_null);
404 cJSON_Delete (expanded);
411 assert_that (error_message, is_null);
412 assert_that (expanded, is_not_null);
413 assert_that (cJSON_IsArray (expanded), is_true);
414 child = expanded->child;
415 assert_that (child, is_not_null);
416 assert_that (cJSON_IsNumber (child), is_true);
417 assert_that (child->valueint, is_equal_to (1));
419 assert_that (child, is_null);
420 cJSON_Delete (expanded);
427 assert_that (error_message, is_null);
428 assert_that (expanded, is_not_null);
429 assert_that (cJSON_IsArray (expanded), is_true);
430 child = expanded->child;
431 assert_that (child, is_not_null);
432 assert_that (cJSON_IsNumber (child), is_true);
433 assert_that (child->valueint, is_equal_to (2));
435 assert_that (child, is_not_null);
436 assert_that (cJSON_IsArray (child), is_true);
437 assert_that (child->child->valueint, is_equal_to (3));
438 cJSON_Delete (expanded);
445 assert_that (error_message, is_null);
446 assert_that (expanded, is_not_null);
447 assert_that (cJSON_IsArray (expanded), is_true);
448 child = expanded->child;
449 assert_that (child, is_not_null);
450 assert_that (cJSON_IsString (child), is_true);
451 assert_that (child->valuestring, is_equal_to_string (
"A"));
453 assert_that (child, is_not_null);
454 assert_that (cJSON_IsString (child), is_true);
455 assert_that (child->valuestring, is_equal_to_string (
"\"B]"));
456 cJSON_Delete (expanded);
470 gchar *path_str, *error_message;
471 cJSON *expanded, *child;
473 "{\"A\":{}, \"B\": {\"C\": \"\\\"D}\", \"E\":123, \"F\":{}}}");
483 assert_that (error_message, is_null);
484 assert_that (cJSON_IsObject (expanded), is_true);
485 assert_that (expanded->child, is_null);
486 cJSON_Delete (expanded);
492 assert_that (error_message, is_null);
493 assert_that (cJSON_IsObject (expanded), is_true);
494 child = expanded->child;
495 assert_that (child, is_not_null);
496 assert_that (cJSON_IsString (child), is_true);
497 assert_that (child->string, is_equal_to_string (
"C"));
498 assert_that (child->valuestring, is_equal_to_string (
"\"D}"));
500 assert_that (child, is_not_null);
501 assert_that (cJSON_IsNumber (child), is_true);
502 assert_that (child->string, is_equal_to_string (
"E"));
503 assert_that (child->valueint, is_equal_to (123));
505 assert_that (child, is_not_null);
506 assert_that (cJSON_IsObject (child), is_true);
507 assert_that (child->string, is_equal_to_string (
"F"));
508 assert_that (child->child, is_null);
509 cJSON_Delete (expanded);
1125 suite = create_test_suite ();
1127 add_test_with_context (suite, jsonpull, can_init_parser_with_defaults);
1129 add_test_with_context (suite, jsonpull, can_parse_false);
1130 add_test_with_context (suite, jsonpull, can_parse_true);
1131 add_test_with_context (suite, jsonpull, can_parse_null);
1133 add_test_with_context (suite, jsonpull, can_parse_empty_strings);
1134 add_test_with_context (suite, jsonpull, can_parse_strings_with_content);
1136 add_test_with_context (suite, jsonpull, can_parse_integer_numbers);
1137 add_test_with_context (suite, jsonpull, can_parse_floating_point_numbers);
1139 add_test_with_context (suite, jsonpull, can_parse_empty_arrays);
1140 add_test_with_context (suite, jsonpull, can_parse_single_elem_arrays);
1141 add_test_with_context (suite, jsonpull, can_parse_multiple_elem_arrays);
1143 add_test_with_context (suite, jsonpull, can_parse_empty_objects);
1144 add_test_with_context (suite, jsonpull, can_parse_single_elem_objects);
1145 add_test_with_context (suite, jsonpull, can_parse_multiple_elem_objects);
1146 add_test_with_context (suite, jsonpull, can_parse_nested_containers);
1147 add_test_with_context (suite, jsonpull, can_expand_arrays);
1148 add_test_with_context (suite, jsonpull, can_expand_objects);
1150 add_test_with_context (suite, jsonpull, fails_for_read_error);
1152 add_test_with_context (suite, jsonpull, fails_for_misspelled_true);
1153 add_test_with_context (suite, jsonpull, fails_for_incomplete_true);
1154 add_test_with_context (suite, jsonpull, fails_for_misspelled_false);
1155 add_test_with_context (suite, jsonpull, fails_for_misspelled_null);
1157 add_test_with_context (suite, jsonpull, fails_for_string_eof);
1158 add_test_with_context (suite, jsonpull, fails_for_string_read_error);
1159 add_test_with_context (suite, jsonpull, fails_for_overlong_string);
1160 add_test_with_context (suite, jsonpull, fails_for_invalid_string);
1162 add_test_with_context (suite, jsonpull, fails_for_number_read_error);
1163 add_test_with_context (suite, jsonpull, fails_for_overlong_number);
1164 add_test_with_context (suite, jsonpull, fails_for_invalid_number);
1166 add_test_with_context (suite, jsonpull, fails_for_array_eof);
1167 add_test_with_context (suite, jsonpull, fails_for_array_eof_after_value);
1168 add_test_with_context (suite, jsonpull, fails_for_array_eof_after_comma);
1169 add_test_with_context (suite, jsonpull, fails_for_array_read_error);
1170 add_test_with_context (suite, jsonpull, fails_for_invalid_array_bracket);
1171 add_test_with_context (suite, jsonpull,
1172 fails_for_invalid_array_bracket_after_value);
1173 add_test_with_context (suite, jsonpull, fails_for_invalid_array_other_char);
1174 add_test_with_context (suite, jsonpull,
1175 fails_for_invalid_array_other_char_after_value);
1177 add_test_with_context (suite, jsonpull, fails_for_object_key_eof);
1178 add_test_with_context (suite, jsonpull, fails_for_object_key_read_error);
1179 add_test_with_context (suite, jsonpull, fails_for_object_key_invalid_string);
1180 add_test_with_context (suite, jsonpull, fails_for_invalid_object_key_bracket);
1181 add_test_with_context (suite, jsonpull,
1182 fails_for_invalid_object_key_other_char);
1184 add_test_with_context (suite, jsonpull, fails_for_object_colon_eof);
1185 add_test_with_context (suite, jsonpull, fails_for_object_colon_read_error);
1186 add_test_with_context (suite, jsonpull, fails_for_object_colon_other_char);
1188 add_test_with_context (suite, jsonpull, fails_for_object_value_eof);
1189 add_test_with_context (suite, jsonpull, fails_for_object_value_read_error);
1190 add_test_with_context (suite, jsonpull, fails_for_object_value_curly_brace);
1191 add_test_with_context (suite, jsonpull,
1192 fails_for_object_value_square_bracket);
1193 add_test_with_context (suite, jsonpull, fails_for_object_eof_after_value);
1194 add_test_with_context (suite, jsonpull, fails_for_object_eof_after_comma);
1195 add_test_with_context (suite, jsonpull,
1196 fails_for_object_square_bracket_after_value);
1198 add_test_with_context (suite, jsonpull, fails_for_read_error_after_doc_end);
1199 add_test_with_context (suite, jsonpull, fails_for_content_after_doc_end);
1201 add_test_with_context (suite, jsonpull, fails_for_expand_before_container);
1202 add_test_with_context (suite, jsonpull, fails_for_expand_after_value);
1203 add_test_with_context (suite, jsonpull, fails_for_expand_invalid_content);
1204 add_test_with_context (suite, jsonpull, fails_for_expand_overlong);
1205 add_test_with_context (suite, jsonpull,
1206 fails_for_expand_unexpected_curly_brace);
1207 add_test_with_context (suite, jsonpull,
1208 fails_for_expand_unexpected_square_bracket);
1209 add_test_with_context (suite, jsonpull, fails_for_expand_read_error);
1210 add_test_with_context (suite, jsonpull, fails_for_expand_eof);
1213 ret = run_single_test (suite, argv[1], create_text_reporter ());
1215 ret = run_test_suite (suite, create_text_reporter ());
1217 destroy_test_suite (suite);