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

Function cjson_compare_should_compare_arrays

tests/compare_tests.c:141–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141static void cjson_compare_should_compare_arrays(void)
142{
143 TEST_ASSERT_TRUE(compare_from_string("[]", "[]", true));
144 TEST_ASSERT_TRUE(compare_from_string("[]", "[]", false));
145
146 TEST_ASSERT_TRUE(compare_from_string("[false,true,null,42,\"string\",[],{}]", "[false, true, null, 42, \"string\", [], {}]", true));
147 TEST_ASSERT_TRUE(compare_from_string("[false,true,null,42,\"string\",[],{}]", "[false, true, null, 42, \"string\", [], {}]", false));
148
149 TEST_ASSERT_TRUE(compare_from_string("[[[1], 2]]", "[[[1], 2]]", true));
150 TEST_ASSERT_TRUE(compare_from_string("[[[1], 2]]", "[[[1], 2]]", false));
151
152 TEST_ASSERT_FALSE(compare_from_string("[true,null,42,\"string\",[],{}]", "[false, true, null, 42, \"string\", [], {}]", true));
153 TEST_ASSERT_FALSE(compare_from_string("[true,null,42,\"string\",[],{}]", "[false, true, null, 42, \"string\", [], {}]", false));
154
155 /* Arrays that are a prefix of another array */
156 TEST_ASSERT_FALSE(compare_from_string("[1,2,3]", "[1,2]", true));
157 TEST_ASSERT_FALSE(compare_from_string("[1,2,3]", "[1,2]", false));
158}
159
160static void cjson_compare_should_compare_objects(void)
161{

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…