Skip to content

[MISC] Add unit tests for TensorRingBuffer.#2843

Open
yeezhouyi wants to merge 1 commit into
Genesis-Embodied-AI:mainfrom
yeezhouyi:test/tensor-ring-buffer
Open

[MISC] Add unit tests for TensorRingBuffer.#2843
yeezhouyi wants to merge 1 commit into
Genesis-Embodied-AI:mainfrom
yeezhouyi:test/tensor-ring-buffer

Conversation

@yeezhouyi
Copy link
Copy Markdown

@yeezhouyi yeezhouyi commented May 27, 2026

Summary

  • Add 20 unit tests for TensorRingBuffer in genesis/utils/ring_buffer.py, covering initialization, data flow, rotation, relative indexing, copy semantics, slicing, cloning, wraparound, and multidimensional access.
  • All tests are marked @pytest.mark.required.

Test plan

  • pytest tests/test_utils.py -k ring_buffer -v passes.

Add 20 unit tests covering initialization (defaults, external buffer/idx,
shape/dtype validation), data flow (set, get, at, rotate, clone),
slicing (getitem with int/slice/tuple), edge cases (wraparound,
copy semantics, invalid key), and multi-dimensional tensors.

All tests follow the production rotate-then-set pattern used by the
sensor pipeline, ensuring they match real usage semantics.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@duburcqa
Copy link
Copy Markdown
Collaborator

We do not have unit test in Genesis, only integration test. Why do you think it is relevant to add unit test for the TensorRingBuffer specifically?

@yeezhouyi
Copy link
Copy Markdown
Author

yeezhouyi commented May 27, 2026 via email

@duburcqa
Copy link
Copy Markdown
Collaborator

a kind of bug that wouldn't surface as a wrong sensor reading but could cause hard-to-debug memory corruption in long-running simulations.

I don't think a bug that wouldn't surface as a wrong sensor reading is worth fixing. Since it is basically our only requirement today for this class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants