| 78 | } |
| 79 | |
| 80 | static void t_addstr(struct strbuf *buf, const void *data) |
| 81 | { |
| 82 | const char *text = data; |
| 83 | size_t len = strlen(text); |
| 84 | size_t orig_alloc = buf->alloc; |
| 85 | size_t orig_len = buf->len; |
| 86 | |
| 87 | assert_sane_strbuf(buf); |
| 88 | strbuf_addstr(buf, text); |
| 89 | assert_sane_strbuf(buf); |
| 90 | cl_assert_equal_i(buf->len, orig_len + len); |
| 91 | cl_assert(buf->alloc >= orig_alloc); |
| 92 | cl_assert(buf->buf[buf->len] == '\0'); |
| 93 | cl_assert_equal_s(buf->buf + orig_len, text); |
| 94 | } |
| 95 | |
| 96 | void test_strbuf__add_single_char(void) |
| 97 | { |
nothing calls this directly
no test coverage detected