Homework

Task 1

Fill in the 7 stub ZTEST bodies in test_ring_buf.c — module under test: ring_buf, a circular FIFO buffer:

  • ring_buf_init: 1 test — reinit clears state

  • ring_buf_push_pop: 3 tests — single push/pop, FIFO order, full buffer push

  • ring_buf_boundaries: 3 tests — peek non-consuming, pop(NULL), is_full after fill

Verify all 8 tests pass:

west twister -T tests/ring_buf -p native_sim

Commit implemented tests and push tag: l8-task1.


Task 2

Run the coverage report focused on the ring_buf module:

west twister -T tests/ring_buf -p native_sim \
    --coverage --coverage-tool gcovr \
    --coverage-basedir app/modules/ring_buf


  • Open twister-out/coverage/index.html and verify the expected coverage numbers (lines ≥81%, functions 100%, branches ≥64%)

  • Include the twister-out/coverage/ directory in the commit

Push tag: l8-task2