class MAGES::Recorder::Tests::TestRingBuffer

Overview

Tests various aspects of the ring buffer. More…

class TestRingBuffer
{
public:
    // methods

    void WhenReadWriteEqualThenOnlyWriteIsAllowed();
    void WhenWriteToEndThenReadToEndIsCorrect();
    void WhenWrappingThenNoItemIsLostOrRepeated();
    void WhenPeekingThenReadCursorDoesNotMove();
};

Detailed Documentation

Tests various aspects of the ring buffer.

Methods

void WhenReadWriteEqualThenOnlyWriteIsAllowed()

Case: When the buffer is empty, reading should return null, and writing should be allowed.

void WhenWriteToEndThenReadToEndIsCorrect()

Case: When the whole buffer is written to, reading should return the correct values.

void WhenWrappingThenNoItemIsLostOrRepeated()

Case: Streaming through the buffer must not drop or duplicate items at a wrap.

void WhenPeekingThenReadCursorDoesNotMove()

Case: Peeking leaves the read cursor alone, advancing moves it.