MCPcopy Create free account
hub / github.com/ElementsProject/lightning / remove_first

Function remove_first

common/test/run-json_remove.c:272–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272static void remove_first(void)
273{
274 struct json *j = json_parse(tmpctx, "['one', 'two', 'three']");
275 assert(j);
276 json_tok_remove(&j->toks, j->toks, j->toks + 1, 1);
277 assert(j->toks);
278
279 test_toks(j, "two", "three", NULL);
280 assert(tal_count(j->toks) == 3);
281
282 j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}");
283 assert(j);
284
285 json_tok_remove(&j->toks, j->toks, j->toks + 1, 1);
286 assert(j);
287 test_toks(j, "2", "two", "3", "three", NULL);
288 assert(tal_count(j->toks) == 5);
289
290 j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}");
291 json_tok_remove(&j->toks, j->toks, j->toks + 1, 1);
292 assert(j);
293 test_toks(j, "2", "two", "3", "three", NULL);
294 assert(tal_count(j->toks) == 5);
295
296}
297
298static void remove_last(void)
299{

Callers 1

mainFunction · 0.85

Calls 3

json_tok_removeFunction · 0.85
test_toksFunction · 0.85
json_parseFunction · 0.70

Tested by

no test coverage detected