-
Notifications
You must be signed in to change notification settings - Fork 125
feat(deque): add shuffle_in_place and shuffle method #2398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(deque): add shuffle_in_place and shuffle method #2398
Conversation
Pull Request Test Coverage Report for Build 344Details
💛 - Coveralls |
Potential bug in deterministic test random functionCategory Test coverage is insufficient for shuffle functionalityCategory Unnecessary copy operation in shuffle methodCategory |
Ask me about this PR and the above questions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces two new shuffle operations on the deque using the Fisher–Yates algorithm and adds a test for both methods.
- Added interface declarations for
shuffle
andshuffle_in_place
indeque.mbti
. - Implemented
shuffle_in_place
andshuffle
indeque.mbt
. - Added a combined test covering both shuffle methods in
deque_test.mbt
.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
deque/deque.mbti | Declared new shuffle and shuffle_in_place APIs |
deque/deque.mbt | Implemented the shuffle methods |
deque/deque_test.mbt | Added a test for in-place and non-in-place shuffle |
Comments suppressed due to low confidence (2)
deque/deque_test.mbt:1158
- [nitpick] The test is named "shuffle_in_place" but also covers the non-in-place shuffle method. Consider renaming it to reflect both methods or splitting it into two focused tests.
test "shuffle_in_place" {
deque/deque_test.mbt:1175
- Add separate test cases for edge conditions (e.g., empty and single-element deques) to ensure both
shuffle_in_place
andshuffle
behave correctly across all deque sizes.
// Test non-in-place version
modified: deque/deque.mbti
with '#' will be ignored, and an empty message aborts the commit. On branch shuffle-implement Your branch is up to date with 'origin/shuffle-implement'. Changes to be committed: modified: deque/deque_test.mbt modified: deque/moon.pkg.json
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
86abe2c
to
7b415cb
Compare
PR Description
Summary
This pr adds the shuffle method, but does not write a test