Lines Matching +full:- +full:- +full:root
2 Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
50 cJSON *root = cJSON_CreateObject(); in cjson_add_null_should_add_null() local
53 cJSON_AddNullToObject(root, "null"); in cjson_add_null_should_add_null()
55 TEST_ASSERT_NOT_NULL(null = cJSON_GetObjectItemCaseSensitive(root, "null")); in cjson_add_null_should_add_null()
56 TEST_ASSERT_EQUAL_INT(null->type, cJSON_NULL); in cjson_add_null_should_add_null()
58 cJSON_Delete(root); in cjson_add_null_should_add_null()
63 cJSON *root = cJSON_CreateObject(); in cjson_add_null_should_fail_with_null_pointers() local
66 TEST_ASSERT_NULL(cJSON_AddNullToObject(root, NULL)); in cjson_add_null_should_fail_with_null_pointers()
68 cJSON_Delete(root); in cjson_add_null_should_fail_with_null_pointers()
73 cJSON *root = cJSON_CreateObject(); in cjson_add_null_should_fail_on_allocation_failure() local
77 TEST_ASSERT_NULL(cJSON_AddNullToObject(root, "null")); in cjson_add_null_should_fail_on_allocation_failure()
81 cJSON_Delete(root); in cjson_add_null_should_fail_on_allocation_failure()
86 cJSON *root = cJSON_CreateObject(); in cjson_add_true_should_add_true() local
89 cJSON_AddTrueToObject(root, "true"); in cjson_add_true_should_add_true()
91 TEST_ASSERT_NOT_NULL(true_item = cJSON_GetObjectItemCaseSensitive(root, "true")); in cjson_add_true_should_add_true()
92 TEST_ASSERT_EQUAL_INT(true_item->type, cJSON_True); in cjson_add_true_should_add_true()
94 cJSON_Delete(root); in cjson_add_true_should_add_true()
99 cJSON *root = cJSON_CreateObject(); in cjson_add_true_should_fail_with_null_pointers() local
102 TEST_ASSERT_NULL(cJSON_AddTrueToObject(root, NULL)); in cjson_add_true_should_fail_with_null_pointers()
104 cJSON_Delete(root); in cjson_add_true_should_fail_with_null_pointers()
109 cJSON *root = cJSON_CreateObject(); in cjson_add_true_should_fail_on_allocation_failure() local
113 TEST_ASSERT_NULL(cJSON_AddTrueToObject(root, "true")); in cjson_add_true_should_fail_on_allocation_failure()
117 cJSON_Delete(root); in cjson_add_true_should_fail_on_allocation_failure()
166 cJSON *root = cJSON_CreateObject(); in cjson_add_false_should_add_false() local
169 cJSON_AddFalseToObject(root, "false"); in cjson_add_false_should_add_false()
171 TEST_ASSERT_NOT_NULL(false_item = cJSON_GetObjectItemCaseSensitive(root, "false")); in cjson_add_false_should_add_false()
172 TEST_ASSERT_EQUAL_INT(false_item->type, cJSON_False); in cjson_add_false_should_add_false()
174 cJSON_Delete(root); in cjson_add_false_should_add_false()
179 cJSON *root = cJSON_CreateObject(); in cjson_add_false_should_fail_with_null_pointers() local
182 TEST_ASSERT_NULL(cJSON_AddFalseToObject(root, NULL)); in cjson_add_false_should_fail_with_null_pointers()
184 cJSON_Delete(root); in cjson_add_false_should_fail_with_null_pointers()
189 cJSON *root = cJSON_CreateObject(); in cjson_add_false_should_fail_on_allocation_failure() local
193 TEST_ASSERT_NULL(cJSON_AddFalseToObject(root, "false")); in cjson_add_false_should_fail_on_allocation_failure()
197 cJSON_Delete(root); in cjson_add_false_should_fail_on_allocation_failure()
202 cJSON *root = cJSON_CreateObject(); in cjson_add_bool_should_add_bool() local
207 cJSON_AddBoolToObject(root, "true", true); in cjson_add_bool_should_add_bool()
208 TEST_ASSERT_NOT_NULL(true_item = cJSON_GetObjectItemCaseSensitive(root, "true")); in cjson_add_bool_should_add_bool()
209 TEST_ASSERT_EQUAL_INT(true_item->type, cJSON_True); in cjson_add_bool_should_add_bool()
212 cJSON_AddBoolToObject(root, "false", false); in cjson_add_bool_should_add_bool()
213 TEST_ASSERT_NOT_NULL(false_item = cJSON_GetObjectItemCaseSensitive(root, "false")); in cjson_add_bool_should_add_bool()
214 TEST_ASSERT_EQUAL_INT(false_item->type, cJSON_False); in cjson_add_bool_should_add_bool()
216 cJSON_Delete(root); in cjson_add_bool_should_add_bool()
221 cJSON *root = cJSON_CreateObject(); in cjson_add_bool_should_fail_with_null_pointers() local
224 TEST_ASSERT_NULL(cJSON_AddBoolToObject(root, NULL, false)); in cjson_add_bool_should_fail_with_null_pointers()
226 cJSON_Delete(root); in cjson_add_bool_should_fail_with_null_pointers()
231 cJSON *root = cJSON_CreateObject(); in cjson_add_bool_should_fail_on_allocation_failure() local
235 TEST_ASSERT_NULL(cJSON_AddBoolToObject(root, "false", false)); in cjson_add_bool_should_fail_on_allocation_failure()
239 cJSON_Delete(root); in cjson_add_bool_should_fail_on_allocation_failure()
244 cJSON *root = cJSON_CreateObject(); in cjson_add_number_should_add_number() local
247 cJSON_AddNumberToObject(root, "number", 42); in cjson_add_number_should_add_number()
249 TEST_ASSERT_NOT_NULL(number = cJSON_GetObjectItemCaseSensitive(root, "number")); in cjson_add_number_should_add_number()
251 TEST_ASSERT_EQUAL_INT(number->type, cJSON_Number); in cjson_add_number_should_add_number()
252 TEST_ASSERT_EQUAL_DOUBLE(number->valuedouble, 42); in cjson_add_number_should_add_number()
253 TEST_ASSERT_EQUAL_INT(number->valueint, 42); in cjson_add_number_should_add_number()
255 cJSON_Delete(root); in cjson_add_number_should_add_number()
260 cJSON *root = cJSON_CreateObject(); in cjson_add_number_should_fail_with_null_pointers() local
263 TEST_ASSERT_NULL(cJSON_AddNumberToObject(root, NULL, 42)); in cjson_add_number_should_fail_with_null_pointers()
265 cJSON_Delete(root); in cjson_add_number_should_fail_with_null_pointers()
270 cJSON *root = cJSON_CreateObject(); in cjson_add_number_should_fail_on_allocation_failure() local
274 TEST_ASSERT_NULL(cJSON_AddNumberToObject(root, "number", 42)); in cjson_add_number_should_fail_on_allocation_failure()
278 cJSON_Delete(root); in cjson_add_number_should_fail_on_allocation_failure()
284 cJSON *root = cJSON_CreateObject(); in cjson_add_int64_number_should_add_int64_number() local
287 cJSON_AddInt64NumberToObject(root, "number", 42LL); in cjson_add_int64_number_should_add_int64_number()
289 TEST_ASSERT_NOT_NULL(number = cJSON_GetObjectItemCaseSensitive(root, "number")); in cjson_add_int64_number_should_add_int64_number()
291 TEST_ASSERT_EQUAL_INT(number->type, cJSON_Number | cJSON_IsInt64); in cjson_add_int64_number_should_add_int64_number()
292 TEST_ASSERT_EQUAL_DOUBLE(number->valuedouble, 42); in cjson_add_int64_number_should_add_int64_number()
293 TEST_ASSERT_EQUAL_INT64(number->valueint, 42LL); in cjson_add_int64_number_should_add_int64_number()
295 cJSON_Delete(root); in cjson_add_int64_number_should_add_int64_number()
300 cJSON *root = cJSON_CreateObject(); in cjson_add_int64_number_should_fail_with_null_pointers() local
303 TEST_ASSERT_NULL(cJSON_AddInt64NumberToObject(root, NULL, 42LL)); in cjson_add_int64_number_should_fail_with_null_pointers()
305 cJSON_Delete(root); in cjson_add_int64_number_should_fail_with_null_pointers()
310 cJSON *root = cJSON_CreateObject(); in cjson_add_int64_number_should_fail_on_allocation_failure() local
314 TEST_ASSERT_NULL(cJSON_AddInt64NumberToObject(root, "number", 42LL)); in cjson_add_int64_number_should_fail_on_allocation_failure()
318 cJSON_Delete(root); in cjson_add_int64_number_should_fail_on_allocation_failure()
324 cJSON *root = cJSON_CreateObject(); in cjson_add_string_should_add_string() local
327 cJSON_AddStringToObject(root, "string", "Hello World!"); in cjson_add_string_should_add_string()
329 TEST_ASSERT_NOT_NULL(string = cJSON_GetObjectItemCaseSensitive(root, "string")); in cjson_add_string_should_add_string()
330 TEST_ASSERT_EQUAL_INT(string->type, cJSON_String); in cjson_add_string_should_add_string()
331 TEST_ASSERT_EQUAL_STRING(string->valuestring, "Hello World!"); in cjson_add_string_should_add_string()
333 cJSON_Delete(root); in cjson_add_string_should_add_string()
338 cJSON *root = cJSON_CreateObject(); in cjson_add_string_should_fail_with_null_pointers() local
341 TEST_ASSERT_NULL(cJSON_AddStringToObject(root, NULL, "string")); in cjson_add_string_should_fail_with_null_pointers()
343 cJSON_Delete(root); in cjson_add_string_should_fail_with_null_pointers()
348 cJSON *root = cJSON_CreateObject(); in cjson_add_string_should_fail_on_allocation_failure() local
352 TEST_ASSERT_NULL(cJSON_AddStringToObject(root, "string", "string")); in cjson_add_string_should_fail_on_allocation_failure()
356 cJSON_Delete(root); in cjson_add_string_should_fail_on_allocation_failure()
361 cJSON *root = cJSON_CreateObject(); in cjson_add_raw_should_add_raw() local
364 cJSON_AddRawToObject(root, "raw", "{}"); in cjson_add_raw_should_add_raw()
366 TEST_ASSERT_NOT_NULL(raw = cJSON_GetObjectItemCaseSensitive(root, "raw")); in cjson_add_raw_should_add_raw()
367 TEST_ASSERT_EQUAL_INT(raw->type, cJSON_Raw); in cjson_add_raw_should_add_raw()
368 TEST_ASSERT_EQUAL_STRING(raw->valuestring, "{}"); in cjson_add_raw_should_add_raw()
370 cJSON_Delete(root); in cjson_add_raw_should_add_raw()
375 cJSON *root = cJSON_CreateObject(); in cjson_add_raw_should_fail_with_null_pointers() local
378 TEST_ASSERT_NULL(cJSON_AddRawToObject(root, NULL, "{}")); in cjson_add_raw_should_fail_with_null_pointers()
380 cJSON_Delete(root); in cjson_add_raw_should_fail_with_null_pointers()
385 cJSON *root = cJSON_CreateObject(); in cjson_add_raw_should_fail_on_allocation_failure() local
389 TEST_ASSERT_NULL(cJSON_AddRawToObject(root, "raw", "{}")); in cjson_add_raw_should_fail_on_allocation_failure()
393 cJSON_Delete(root); in cjson_add_raw_should_fail_on_allocation_failure()
398 cJSON *root = cJSON_CreateObject(); in cJSON_add_object_should_add_object() local
401 cJSON_AddObjectToObject(root, "object"); in cJSON_add_object_should_add_object()
402 TEST_ASSERT_NOT_NULL(object = cJSON_GetObjectItemCaseSensitive(root, "object")); in cJSON_add_object_should_add_object()
403 TEST_ASSERT_EQUAL_INT(object->type, cJSON_Object); in cJSON_add_object_should_add_object()
405 cJSON_Delete(root); in cJSON_add_object_should_add_object()
410 cJSON *root = cJSON_CreateObject(); in cjson_add_object_should_fail_with_null_pointers() local
413 TEST_ASSERT_NULL(cJSON_AddObjectToObject(root, NULL)); in cjson_add_object_should_fail_with_null_pointers()
415 cJSON_Delete(root); in cjson_add_object_should_fail_with_null_pointers()
420 cJSON *root = cJSON_CreateObject(); in cjson_add_object_should_fail_on_allocation_failure() local
424 TEST_ASSERT_NULL(cJSON_AddObjectToObject(root, "object")); in cjson_add_object_should_fail_on_allocation_failure()
428 cJSON_Delete(root); in cjson_add_object_should_fail_on_allocation_failure()
433 cJSON *root = cJSON_CreateObject(); in cJSON_add_array_should_add_array() local
436 cJSON_AddArrayToObject(root, "array"); in cJSON_add_array_should_add_array()
437 TEST_ASSERT_NOT_NULL(array = cJSON_GetObjectItemCaseSensitive(root, "array")); in cJSON_add_array_should_add_array()
438 TEST_ASSERT_EQUAL_INT(array->type, cJSON_Array); in cJSON_add_array_should_add_array()
440 cJSON_Delete(root); in cJSON_add_array_should_add_array()
445 cJSON *root = cJSON_CreateObject(); in cjson_add_array_should_fail_with_null_pointers() local
448 TEST_ASSERT_NULL(cJSON_AddArrayToObject(root, NULL)); in cjson_add_array_should_fail_with_null_pointers()
450 cJSON_Delete(root); in cjson_add_array_should_fail_with_null_pointers()
455 cJSON *root = cJSON_CreateObject(); in cjson_add_array_should_fail_on_allocation_failure() local
459 TEST_ASSERT_NULL(cJSON_AddArrayToObject(root, "array")); in cjson_add_array_should_fail_on_allocation_failure()
463 cJSON_Delete(root); in cjson_add_array_should_fail_on_allocation_failure()