From c43901be69ea2cfb6f4de519595226cdc953cf26 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 28 Nov 2013 17:42:06 +0100 Subject: [PATCH] strbuf test: Further extended the incremental append test. --- t/utils/strbuf_test.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/utils/strbuf_test.c b/t/utils/strbuf_test.c index 3a9a5e8..d76c0f2 100644 --- a/t/utils/strbuf_test.c +++ b/t/utils/strbuf_test.c @@ -225,8 +225,15 @@ START_TEST(test_incremental) n = sdb_strbuf_append(buf, "."); fail_unless(n == 1, "sdb_strbuf_append() = %zi; expected: 1", n); + /* write more bytes; this should trigger at least one more resize but + * that's an implementation detail */ + for (i = 0; i < 1024; ++i) { + n = sdb_strbuf_append(buf, "."); + fail_unless(n == 1, "sdb_strbuf_append() = %zi; expected: 1", n); + } + n = (ssize_t)sdb_strbuf_len(buf); - fail_unless(n == 1024, "sdb_strbuf_len() = %zi; expectd: 1024", n); + fail_unless(n == 2048, "sdb_strbuf_len() = %zi; expectd: 2048", n); } END_TEST -- 2.30.2