MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_basic_array

Function test_basic_array

dpdk/app/test/test_telemetry_json.c:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "test.h"
10
11static int
12test_basic_array(void)
13{
14 const char *expected = "[\"meaning of life\",42]";
15 char buf[1024];
16 int used = 0;
17
18 printf("%s: ", __func__);
19 used = rte_tel_json_empty_array(buf, sizeof(buf), used);
20 if (used != 2 || strcmp(buf, "[]"))
21 return -1;
22
23 used = rte_tel_json_add_array_string(buf, sizeof(buf), used,
24 "meaning of life");
25 used = rte_tel_json_add_array_int(buf, sizeof(buf), used, 42);
26
27 printf("buf = '%s', expected = '%s'\n", buf, expected);
28 if (used != (int)strlen(expected))
29 return -1;
30 return strncmp(expected, buf, sizeof(buf));
31}
32
33static int
34test_basic_obj(void)

Callers

nothing calls this directly

Calls 6

rte_tel_json_empty_arrayFunction · 0.85
strcmpFunction · 0.85
strncmpFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected