Skip to content

added queue mock#324

Merged
megargayu merged 5 commits intomainfrom
mocks/add-queue-mock
Apr 2, 2026
Merged

added queue mock#324
megargayu merged 5 commits intomainfrom
mocks/add-queue-mock

Conversation

@megargayu
Copy link
Copy Markdown
Contributor

We need a queue mock for tests, specifically related to FTP. This is a simple queue to stand in for pico-sdk's version. Note that pico-sdk's version is thread-safe, but we do not have that here.

@megargayu megargayu requested a review from Copilot March 19, 2026 06:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a functional host/test mock of pico/util/queue.h (intended to support FTP-related tests) and updates shared typedefs to provide a compatible queue_t definition outside pico-sdk builds.

Changes:

  • Implement a simple ring-buffer queue mock (init/add/remove/peek/full/empty/level) with heap-backed storage.
  • Add queue_free() to release mock queue memory.
  • Expand the host/test queue_t placeholder in typedefs.h from a dummy byte to a real struct layout.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/test_mocks/pico/util/queue.h Implements a heap-backed ring-buffer queue for host tests.
src/common/typedefs.h Updates queue_t (and related typedef gating) for non-pico-sdk builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/test_mocks/pico/util/queue.h
Comment thread src/test_mocks/pico/util/queue.h
Comment thread src/test_mocks/pico/util/queue.h
Comment thread src/test_mocks/pico/util/queue.h
Comment thread src/common/typedefs.h Outdated
Comment thread src/test_mocks/pico/util/queue.h Outdated
Copy link
Copy Markdown
Contributor

@devYaoYH devYaoYH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's just clarify pico-sdk's naming in the struct. (element_size, count, level)

Comment thread src/slate/slate.c
Comment thread src/common/typedefs.h
Comment thread src/common/typedefs.h
@megargayu megargayu merged commit 2a5ab65 into main Apr 2, 2026
15 checks passed
@megargayu megargayu deleted the mocks/add-queue-mock branch April 2, 2026 22:54
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.

3 participants