From: Adam Dickmeiss Date: Fri, 18 Apr 2014 17:45:11 +0000 (+0200) Subject: Add test for YAZ-760 X-Git-Tag: v5.1.1~4 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=5e0171c5568e93a00cad52e4187b9b28e8bacbf1;hp=365cdf77999caa4f9edb02cc954b1075d57f299e Add test for YAZ-760 --- diff --git a/test/test_wrbuf.c b/test/test_wrbuf.c index fef37c8..a0046ef 100644 --- a/test/test_wrbuf.c +++ b/test/test_wrbuf.c @@ -136,10 +136,34 @@ static void tstwrbuf(void) wrbuf_destroy(wr); } +static void tst_cstr(void) +{ + int i; + WRBUF w = wrbuf_alloc(); + for (i = 0; i < 8000; i++) + { + const char *cp = wrbuf_cstr(w); + YAZ_CHECK(strlen(cp) == i); + wrbuf_putc(w, 'a'); + } + wrbuf_destroy(w); + + w = wrbuf_alloc(); + for (i = 0; i < 8000; i++) + { + const char *cp = wrbuf_cstr(w); + YAZ_CHECK(strlen(cp) == i); + wrbuf_puts(w, "a"); + } + wrbuf_destroy(w); + +} + int main (int argc, char **argv) { YAZ_CHECK_INIT(argc, argv); tstwrbuf(); + tst_cstr(); YAZ_CHECK_TERM; }