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

Function test_strconcat

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

Source from the content-addressed store, hash-verified

50}
51
52static void test_strconcat(void **state)
53{
54 int i;
55 size_t str_len, str2_len, res_len;
56 char *result;
57
58 for (i = 0; i < ARRAY_SIZE(string_pairs); i++) {
59 str_len = __builtin_strlen(string_pairs[i].dst);
60 str2_len = __builtin_strlen(string_pairs[i].src);
61
62 result = strconcat(string_pairs[i].dst, string_pairs[i].src);
63 res_len = __builtin_strlen(result);
64
65 assert_int_equal(res_len, str_len + str2_len);
66 assert_int_equal(0, memcmp(string_pairs[i].dst, result, str_len));
67 assert_int_equal(0, memcmp(string_pairs[i].src, result + str_len, str2_len));
68
69 free(result);
70 }
71}
72
73static void test_strchr(void **state)
74{

Callers

nothing calls this directly

Calls 3

strconcatFunction · 0.85
memcmpFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected