From bb23356ae8ff0bcb9e28eeee58eaa91906997117 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 18 Apr 2014 19:45:11 +0200 Subject: [PATCH] Add test for YAZ-760 --- test/test_wrbuf.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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; } -- 1.7.10.4