-/* $OpenBSD: ibuf_test.c,v 1.3 2023/06/13 10:39:46 tb Exp $ */
+/* $OpenBSD: ibuf_test.c,v 1.4 2023/06/19 17:22:46 claudio Exp $ */
/*
* Copyright (c) Tobias Stoeckmann <tobias@openbsd.org>
*
return ret;
}
-int
-test_msgbuf_drain(void)
-{
- struct msgbuf msgbuf;
- struct ibuf *buf;
-
- msgbuf_init(&msgbuf);
-
- if ((buf = ibuf_open(4)) == NULL)
- return 1;
- if (ibuf_add(buf, "test", 4) != 0) {
- ibuf_free(buf);
- return 1;
- }
- ibuf_close(&msgbuf, buf);
-
- if (msgbuf.queued != 1) {
- ibuf_free(buf);
- return 1;
- }
-
- msgbuf_drain(&msgbuf, 1);
-
- if (msgbuf.queued != 1) {
- ibuf_free(buf);
- return 1;
- }
-
- msgbuf_drain(&msgbuf, SIZE_MAX);
-
- if (msgbuf.queued != 0) {
- ibuf_free(buf);
- return 1;
- }
-
- return 0;
-}
-
int
main(void)
{
} else
printf("SUCCESS: test_ibuf_seek\n");
- if (test_msgbuf_drain() != 0) {
- printf("FAILED: test_msgbuf_drain\n");
- ret = 1;
- } else
- printf("SUCCESS: test_msgbuf_drain\n");
-
if (ret != 0) {
printf("FAILED: %s\n", __progname);
return 1;