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

Function cjson_compare_should_compare_objects

tests/compare_tests.c:160–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160static void cjson_compare_should_compare_objects(void)
161{
162 TEST_ASSERT_TRUE(compare_from_string("{}", "{}", true));
163 TEST_ASSERT_TRUE(compare_from_string("{}", "{}", false));
164
165 TEST_ASSERT_TRUE(compare_from_string(
166 "{\"false\": false, \"true\": true, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
167 "{\"true\": true, \"false\": false, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
168 true));
169 TEST_ASSERT_FALSE(compare_from_string(
170 "{\"False\": false, \"true\": true, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
171 "{\"true\": true, \"false\": false, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
172 true));
173 TEST_ASSERT_TRUE(compare_from_string(
174 "{\"False\": false, \"true\": true, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
175 "{\"true\": true, \"false\": false, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
176 false));
177 TEST_ASSERT_FALSE(compare_from_string(
178 "{\"Flse\": false, \"true\": true, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
179 "{\"true\": true, \"false\": false, \"null\": null, \"number\": 42, \"string\": \"string\", \"array\": [], \"object\": {}}",
180 false));
181 /* test objects that are a subset of each other */
182 TEST_ASSERT_FALSE(compare_from_string(
183 "{\"one\": 1, \"two\": 2}",
184 "{\"one\": 1, \"two\": 2, \"three\": 3}",
185 true))
186 TEST_ASSERT_FALSE(compare_from_string(
187 "{\"one\": 1, \"two\": 2}",
188 "{\"one\": 1, \"two\": 2, \"three\": 3}",
189 false))
190}
191
192int CJSON_CDECL main(void)
193{

Callers

nothing calls this directly

Calls 1

compare_from_stringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…