MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / cjson_add_string_should_add_string

Function cjson_add_string_should_add_string

tests/cjson_add.c:281–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281static void cjson_add_string_should_add_string(void)
282{
283 cJSON *root = cJSON_CreateObject();
284 cJSON *string = NULL;
285
286 cJSON_AddStringToObject(root, "string", "Hello World!");
287
288 TEST_ASSERT_NOT_NULL(string = cJSON_GetObjectItemCaseSensitive(root, "string"));
289 TEST_ASSERT_EQUAL_INT(string->type, cJSON_String);
290 TEST_ASSERT_EQUAL_STRING(string->valuestring, "Hello World!");
291
292 cJSON_Delete(root);
293}
294
295static void cjson_add_string_should_fail_with_null_pointers(void)
296{

Callers

nothing calls this directly

Calls 4

cJSON_CreateObjectFunction · 0.85
cJSON_AddStringToObjectFunction · 0.85
cJSON_DeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…