parse_object: Use parse_buffer

This commit is contained in:
Max Bruckner committed 2017-04-08 17:56:25 +02:00
1 parent 033a542532
commit fef1c45b92
3 files changed
+54 -29

No files matched your search

+12 -2
View File
@@ -54,14 +54,24 @@ static void assert_is_child(cJSON *child_item, const char *name, int type)
static void assert_not_object(const char *json)
{
TEST_ASSERT_NULL(parse_object(item, (const unsigned char*)json, &error_pointer, &global_hooks));
parse_buffer parsebuffer;
parsebuffer.content = (const unsigned char*)json;
parsebuffer.length = strlen(json) + sizeof("");
parsebuffer.offset = 0;
TEST_ASSERT_NULL(parse_object(item, &parsebuffer, &error_pointer, &global_hooks));
assert_is_invalid(item);
reset(item);
}
static void assert_parse_object(const char *json)
{
TEST_ASSERT_NOT_NULL(parse_object(item, (const unsigned char*)json, &error_pointer, &global_hooks));
parse_buffer parsebuffer;
parsebuffer.content = (const unsigned char*)json;
parsebuffer.length = strlen(json) + sizeof("");
parsebuffer.offset = 0;
TEST_ASSERT_NOT_NULL(parse_object(item, &parsebuffer, &error_pointer, &global_hooks));
assert_is_object(item);
}