1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2012 Index Data
3 * See the file LICENSE for details.
12 #include <yaz/wrbuf.h>
15 static void tstwrbuf(void)
31 for (step = 1; step < 65; step++)
37 for (j = 1; j<step; j++)
47 YAZ_CHECK(len == step * (step-1) / 2);
49 for (j = 1; j<step; j++)
52 YAZ_CHECK(cp[k] == i+1);
59 wrbuf_puts(wr, "1234");
60 wrbuf_insert(wr, 0, "abc", 3);
61 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "abc1234"));
64 wrbuf_puts(wr, "1234");
65 wrbuf_insert(wr, 1, "abc", 3);
66 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1abc234"));
69 wrbuf_puts(wr, "1234");
70 wrbuf_insert(wr, 4, "abc", 3);
71 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234abc"));
74 wrbuf_puts(wr, "1234");
75 wrbuf_insert(wr, 5, "abc", 3);
76 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234"));
81 int main (int argc, char **argv)
83 YAZ_CHECK_INIT(argc, argv);
91 * c-file-style: "Stroustrup"
92 * indent-tabs-mode: nil
94 * vim: shiftwidth=4 tabstop=8 expandtab