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

Function test_string_char_escaping

dpdk/app/test/test_telemetry_json.c:127–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static int
128test_string_char_escaping(void)
129{
130 static const char str[] = "A string across\ntwo lines and \"with quotes\"!";
131 const char *expected = "\"A string across\\ntwo lines and \\\"with quotes\\\"!\"";
132 char buf[sizeof(str) + 10] = "";
133 int used = 0;
134
135 used = rte_tel_json_str(buf, sizeof(buf), used, str);
136 printf("%s: buf = '%s', expected = '%s'\n", __func__, buf, expected);
137 if (used != (int)strlen(expected))
138 return -1;
139
140 return strncmp(expected, buf, sizeof(buf));
141}
142
143static int
144test_array_char_escaping(void)

Callers

nothing calls this directly

Calls 3

rte_tel_json_strFunction · 0.85
strncmpFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected