From: Adam Dickmeiss Date: Fri, 5 Aug 2011 12:55:32 +0000 (+0200) Subject: Testin wrbuf_insert X-Git-Tag: v4.2.8~13^2~1 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=dcf6101fd8cf823c366b0703243381e8a0e11d75;p=yaz-moved-to-github.git Testin wrbuf_insert --- diff --git a/test/test_wrbuf.c b/test/test_wrbuf.c index 007258a..f213561 100644 --- a/test/test_wrbuf.c +++ b/test/test_wrbuf.c @@ -54,6 +54,27 @@ static void tstwrbuf(void) } wrbuf_rewind(wr); } + + wrbuf_rewind(wr); + wrbuf_puts(wr, "1234"); + wrbuf_insert(wr, 0, "abc", 3); + YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "abc1234")); + + wrbuf_rewind(wr); + wrbuf_puts(wr, "1234"); + wrbuf_insert(wr, 1, "abc", 3); + YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1abc234")); + + wrbuf_rewind(wr); + wrbuf_puts(wr, "1234"); + wrbuf_insert(wr, 4, "abc", 3); + YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234abc")); + + wrbuf_rewind(wr); + wrbuf_puts(wr, "1234"); + wrbuf_insert(wr, 5, "abc", 3); + YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234")); + wrbuf_destroy(wr); }