| #include "ringbuffer-test-utils.c" |
| void test_poll_force(void) |
| uint8_t in_buf[] = { 'a', 'b', 'c', 'd', 'e', 'f', }; |
| struct rb_test_ctx _ctx, *ctx = &_ctx; |
| ringbuffer_test_context_init(ctx); |
| ctx->rbc = ringbuffer_consumer_register(rb, |
| ringbuffer_poll_append_all, ctx); |
| /* fill the ringbuffer */ |
| rc = ringbuffer_queue(rb, in_buf, 4); |
| rc = ringbuffer_queue(rb, in_buf + 4, 2); |
| /* we should have had a forced poll for the initial two bytes */ |
| assert(!memcmp(in_buf, ctx->data, 2)); |
| ringbuffer_test_context_fini(ctx); |