MCPcopy Create free account
hub / github.com/coreboot/coreboot / test_hexstrtobin

Function test_hexstrtobin

tests/lib/hexstrtobin-test.c:22–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20};
21
22static void test_hexstrtobin(void **state)
23{
24 uint8_t *buf;
25 size_t res, len;
26
27 for (int i = 0; i < ARRAY_SIZE(hexstr); i++) {
28 len = strlen(hexstr[i].str) / 2 + 1;
29 buf = malloc(len);
30 res = hexstrtobin(hexstr[i].str, buf, len);
31
32 assert_int_equal(hexstr[i].res, res);
33
34 for (int j = 0; j < res; j++)
35 assert_int_equal(hexstr[i].val[j], buf[j]);
36
37 free(buf);
38 }
39}
40
41int main(void)
42{

Callers

nothing calls this directly

Calls 4

strlenFunction · 0.85
hexstrtobinFunction · 0.85
mallocFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected