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

Function test_strdup

tests/lib/string-test.c:40–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38};
39
40static void test_strdup(void **state)
41{
42 char str[] = "Hello coreboot\n";
43 char *duplicate = strdup(str);
44
45 /* There is a more suitable Cmocka's function 'assert_string_equal()', but it
46 is using strcmp() internally. */
47 assert_int_equal(0, memcmp(str, duplicate, __builtin_strlen(str)));
48
49 free(duplicate);
50}
51
52static void test_strconcat(void **state)
53{

Callers

nothing calls this directly

Calls 3

strdupFunction · 0.50
memcmpFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected