1 #include <ccan/rbuf/rbuf.h>
2 /* Include the C files directly. */
3 #include <ccan/rbuf/rbuf.c>
4 #include <ccan/tap/tap.h>
14 int fd = open("test/run-term-eof.c", O_RDONLY), len;
16 /* This is how many tests you plan to run */
19 /* Grab ourselves for comparison. */
20 len = read(fd, buf, sizeof(buf));
22 lseek(fd, SEEK_SET, 0);
24 /* We have exact-size buffer, which causes problems adding term. */
25 rbuf_init(&in, fd, malloc(len), len);
26 p = rbuf_read_str(&in, 64, NULL); /* At symbol does not appear. */
29 /* This should succeed... */
30 p = rbuf_read_str(&in, 64, realloc);
32 ok1(strcmp(p, buf) == 0);
36 lseek(fd, SEEK_SET, 0);
37 rbuf_init(&in, fd, malloc(len), len);
38 p = rbuf_read_str(&in, 64, realloc);
40 ok1(strcmp(p, buf) == 0);