Testin wrbuf_insert
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 5 Aug 2011 12:55:32 +0000 (14:55 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 5 Aug 2011 12:55:32 +0000 (14:55 +0200)
test/test_wrbuf.c

index 007258a..f213561 100644 (file)
@@ -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);
 }