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

Function compare_from_string

tests/compare_tests.c:27–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include "common.h"
26
27static cJSON_bool compare_from_string(const char * const a, const char * const b, const cJSON_bool case_sensitive)
28{
29 cJSON *a_json = NULL;
30 cJSON *b_json = NULL;
31 cJSON_bool result = false;
32
33 a_json = cJSON_Parse(a);
34 TEST_ASSERT_NOT_NULL_MESSAGE(a_json, "Failed to parse a.");
35 b_json = cJSON_Parse(b);
36 TEST_ASSERT_NOT_NULL_MESSAGE(b_json, "Failed to parse b.");
37
38 result = cJSON_Compare(a_json, b_json, case_sensitive);
39
40 cJSON_Delete(a_json);
41 cJSON_Delete(b_json);
42
43 return result;
44}
45
46static void cjson_compare_should_compare_null_pointer_as_not_equal(void)
47{

Calls 3

cJSON_ParseFunction · 0.85
cJSON_CompareFunction · 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…