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

Function remove_multiple

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

Source from the content-addressed store, hash-verified

279}
280
281static void remove_multiple(void)
282{
283 struct json *j = json_parse(tmpctx, "['a', 'b', 'c', 'd', 'e']");
284 json_tok_remove(&j->toks, j->toks, j->toks + 1, 2);
285 test_toks(j, "c", "d", "e", NULL);
286
287 j = json_parse(tmpctx, "['a', 'b', 'c', 'd', 'e']");
288 json_tok_remove(&j->toks, j->toks, j->toks + 2, 2);
289 test_toks(j, "a", "d", "e", NULL);
290
291 j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three', '4':'four'}");
292 json_tok_remove(&j->toks, j->toks, j->toks + 3, 2);
293 assert(j);
294 test_toks(j, "1", "one", "4", "four", NULL);
295 assert(tal_count(j->toks) == 5);
296}
297
298static void remove_all(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