
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>

#include "ringbuffer.c"
#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;
	struct rb_test_ctx *ctx = &_ctx;
	struct ringbuffer *rb;
	int rc;

	ringbuffer_test_context_init(ctx);

	rb = ringbuffer_init(5);

	ctx->rbc = ringbuffer_consumer_register(rb, ringbuffer_poll_append_all,
						ctx);

	ctx->force_only = true;

	/* fill the ringbuffer */
	rc = ringbuffer_queue(rb, in_buf, 4);
	assert(!rc);

	assert(ctx->count == 0);

	/* add more data */
	rc = ringbuffer_queue(rb, in_buf + 4, 2);
	assert(!rc);

	/* we should have had a forced poll for the initial two bytes */
	assert(ctx->count == 1);
	assert(ctx->len == 2);
	assert(!memcmp(in_buf, ctx->data, 2));

	ringbuffer_fini(rb);
	ringbuffer_test_context_fini(ctx);
}

int main(void)
{
	test_poll_force();
	return EXIT_SUCCESS;
}
