1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) Index Data
3 * See the file LICENSE for details.
13 #include <yaz/wrbuf.h>
16 static void tstwrbuf(void)
32 for (step = 1; step < 65; step++)
38 for (j = 1; j<step; j++)
48 YAZ_CHECK(len == step * (step-1) / 2);
50 for (j = 1; j<step; j++)
53 YAZ_CHECK(cp[k] == i+1);
60 wrbuf_puts(wr, "1234");
61 wrbuf_insert(wr, 0, "abc", 3);
62 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "abc1234"));
65 wrbuf_puts(wr, "1234");
66 wrbuf_insert(wr, 1, "abc", 3);
67 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1abc234"));
70 wrbuf_puts(wr, "1234");
71 wrbuf_insert(wr, 4, "abc", 3);
72 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234abc"));
75 wrbuf_puts(wr, "1234");
76 wrbuf_insert(wr, 5, "abc", 3);
77 YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234"));
81 const char *msg = "Hello world\n";
83 wrbuf_sha1_write(wr, msg, strlen(msg), 1);
84 YAZ_CHECK(!strcmp(wrbuf_cstr(wr),
85 "33ab5639bfd8e7b95eb1d8d0b87781d4ffea4d5d"));
91 int main (int argc, char **argv)
93 YAZ_CHECK_INIT(argc, argv);
101 * c-file-style: "Stroustrup"
102 * indent-tabs-mode: nil
104 * vim: shiftwidth=4 tabstop=8 expandtab