From 50b74672ec5259c79d25c3907cff8b6e5a89d540 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 11 Dec 2024 14:44:28 +0100 Subject: [PATCH] tests/unittests: chunked_ringbuffer: add test for half-written chunk --- .../tests-chunked_ringbuffer/tests-chunked_ringbuffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unittests/tests-chunked_ringbuffer/tests-chunked_ringbuffer.c b/tests/unittests/tests-chunked_ringbuffer/tests-chunked_ringbuffer.c index d2020ebf322a..5d69ea98a2fb 100644 --- a/tests/unittests/tests-chunked_ringbuffer/tests-chunked_ringbuffer.c +++ b/tests/unittests/tests-chunked_ringbuffer/tests-chunked_ringbuffer.c @@ -25,6 +25,12 @@ static void test_crb_add_and_consume(void) crb_init(&cb, buffer, sizeof(buffer)); + /* add a chunk but don't finish it */ + crb_start_chunk(&cb); + crb_add_byte(&cb, 1); + crb_add_byte(&cb, 2); + crb_add_byte(&cb, 3); + TEST_ASSERT(crb_add_chunk(&cb, "one", 4)); TEST_ASSERT(crb_add_chunk(&cb, "two", 4)); TEST_ASSERT(crb_add_chunk(&cb, "three", 6));