From: Adam Dickmeiss Date: Fri, 18 Apr 2014 17:45:11 +0000 (+0200) Subject: Add test for YAZ-760 X-Git-Tag: v5.0.24~2 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=bb23356ae8ff0bcb9e28eeee58eaa91906997117;p=yaz-moved-to-github.git 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; }