diff options
| author | MasterPhi <[email protected]> | 2021-06-30 20:26:44 +0200 |
|---|---|---|
| committer | MasterPhi <[email protected]> | 2021-06-30 20:30:03 +0200 |
| commit | 74b51d43e1e8e14def49c140f8f063eb56c9e4d2 (patch) | |
| tree | a6e544264d7cf411ae244f1dde07da3f5dad48a9 | |
| parent | 7321972380b7bf74557293ba975e912f2941ae02 (diff) | |
Add test CI.
| -rw-r--r-- | test/test/test_fifo.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test/test_fifo.c b/test/test/test_fifo.c index f9bfc5f03..0a5f4d3b9 100644 --- a/test/test/test_fifo.c +++ b/test/test/test_fifo.c @@ -292,3 +292,27 @@ void test_full(void) // write info } + +void test_rd_idx_wrap() +{ + tu_fifo_t ff10; + uint8_t buf[10]; + uint8_t dst[10]; + + tu_fifo_config(&ff10, buf, 10, 1, 1); + + uint16_t n; + + ff10.wr_idx = 6; + ff10.rd_idx = 15; + + n = tu_fifo_read_n(&ff10, dst, 4); + TEST_ASSERT_EQUAL(n, 4); + TEST_ASSERT_EQUAL(ff10.rd_idx, 0); + n = tu_fifo_read_n(&ff10, dst, 4); + TEST_ASSERT_EQUAL(n, 4); + TEST_ASSERT_EQUAL(ff10.rd_idx, 4); + n = tu_fifo_read_n(&ff10, dst, 4); + TEST_ASSERT_EQUAL(n, 2); + TEST_ASSERT_EQUAL(ff10.rd_idx, 6); +}
\ No newline at end of file |
