[PATCH 2/3] tests/unit: Expand test_fifo8_peek_buf_wrap() coverage

Philippe Mathieu-Daudé posted 3 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH 2/3] tests/unit: Expand test_fifo8_peek_buf_wrap() coverage
Posted by Philippe Mathieu-Daudé 2 months, 2 weeks ago
Test fifo8_peek_buf() can fill a buffer with wrapped data.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/unit/test-fifo.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/unit/test-fifo.c b/tests/unit/test-fifo.c
index 60436a7600..4706bf8708 100644
--- a/tests/unit/test-fifo.c
+++ b/tests/unit/test-fifo.c
@@ -174,6 +174,13 @@ static void test_fifo8_peek_buf_wrap(void)
     g_assert(data_out[0] == 0x5 && data_out[1] == 0x6 &&
              data_out[2] == 0x7 && data_out[3] == 0x8);
 
+    count = fifo8_peek_buf(&fifo, data_out, 8);
+    g_assert(count == 8);
+    g_assert(data_out[0] == 0x5 && data_out[1] == 0x6 &&
+             data_out[2] == 0x7 && data_out[3] == 0x8);
+    g_assert(data_out[4] == 0x9 && data_out[5] == 0xa &&
+             data_out[6] == 0xb && data_out[7] == 0xc);
+
     g_assert(fifo8_num_used(&fifo) == 8);
     fifo8_destroy(&fifo);
 }
-- 
2.45.2