summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ead57d6)
raw | patch | inline | side by side (parent: ead57d6)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:57:40 +0000 (14:57 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:57:40 +0000 (14:57 +0100) |
t/utils/strbuf_test.c | patch | blob | history |
diff --git a/t/utils/strbuf_test.c b/t/utils/strbuf_test.c
index 749d5821622a0189e4fa8130d38b671a6f9958b4..0acb1de0521849d6533a347fd8a8858a106ce72b 100644 (file)
--- a/t/utils/strbuf_test.c
+++ b/t/utils/strbuf_test.c
}
END_TEST
+START_TEST(test_sdb_strbuf_clear)
+{
+ const char *data;
+ size_t len;
+
+ sdb_strbuf_append(buf, "abc");
+ len = sdb_strbuf_len(buf);
+ fail_unless(len != 0,
+ "sdb_strbuf_len() = %zu; expected: != 0", len);
+
+ sdb_strbuf_clear(buf);
+ len = sdb_strbuf_len(buf);
+ fail_unless(len == 0,
+ "sdb_strbuf_len() = %zu (after clear); expected: 0", len);
+
+ data = sdb_strbuf_string(buf);
+ fail_unless(*data == '\0',
+ "sdb_strbuf_string() = '%s' (after clear); expected: ''", data);
+}
+END_TEST
+
static struct {
const char *input;
const char *expected;
tcase_add_test(tc, test_sdb_strbuf_memappend);
tcase_add_test(tc, test_sdb_strbuf_chomp);
tcase_add_test(tc, test_sdb_strbuf_skip);
+ tcase_add_test(tc, test_sdb_strbuf_clear);
tcase_add_test(tc, test_sdb_strbuf_string);
tcase_add_test(tc, test_sdb_strbuf_len);
suite_add_tcase(s, tc);