Skip to content

Ring buffer as specified seems incorrect #268

Open
@jcs-lambda

Description

@jcs-lambda

The specifications for a ring buffer in the example and in the tests do not make sense to me.

When a ring buffer's contents are retrieved, they should start with the oldest item and continue to the newest item.

As the spec stands, when the ring buffer is retrieved, it starts with whatever happens to be in the slot of the first item inserted, continues to the newest item, then continues with the oldest item up to the first slot.

Spec as stated:

  • RingBuffer(10)
  • .append(1...15)
  • .get() = [11, 12, 13, 14, 15, 6, 7, 8, 9, 10]

My understanding of a ring buffer:

  • RingBuffer(10)
  • .append(1...15)
  • .get() = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions