-
Notifications
You must be signed in to change notification settings - Fork 6
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
Merge changes from 3b #13
Open
phoe
wants to merge
6
commits into
phoe:main
Choose a base branch
from
3b:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e423454
add test with duplicate priorities for unstable queue
3b e821100
add version with DELETE and ADJUST-PRIORITY operations
3b b00bb23
fix typo
3b 6ab6d21
fix dequeue in updateable queue
3b 008566f
return handle from dequeue in updateable queue
3b 94c93eb
always return data from handle even if it is no longer in queue
3b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,16 @@ | |
;;;; Utilities | ||
|
||
(defun verify-heap-property (vector) | ||
(declare (type q::prio-vector-type vector)) | ||
(loop with length = (length vector) | ||
for parent from 0 below (truncate length 2) | ||
for left = (+ (* parent 2) 1) | ||
for right = (+ (* parent 2) 2) | ||
do (assert (< (aref vector parent) (aref vector left)) () | ||
do (assert (<= (aref vector parent) (aref vector left)) () | ||
"VERIFY-HEAP-PROPERTY: Invalid left child: ~D -> ~D" | ||
(aref vector parent) (aref vector left)) | ||
when (oddp length) | ||
do (assert (< (aref vector parent) (aref vector right)) () | ||
do (assert (<= (aref vector parent) (aref vector right)) () | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
"VERIFY-HEAP-PROPERTY: Invalid right child: ~D -> ~D" | ||
(aref vector parent) (aref vector right)))) | ||
|
||
|
@@ -39,6 +40,10 @@ | |
(perform-test queue (nreverse (a:iota length))) | ||
(dotimes (i 100) | ||
(perform-test queue (a:shuffle (a:iota length)))))) | ||
(let ((queue (q:make-queue 64))) | ||
(perform-test queue (alexandria:shuffle (append (a:iota 64) | ||
(a:iota 32) | ||
(a:iota 16))))) | ||
(perform-error-test) | ||
(perform-copy-test)) | ||
|
||
|
@@ -122,7 +127,7 @@ | |
|
||
(defun test-dequeue-and-peek (queue list) | ||
(let ((counter (q:size queue))) | ||
(dotimes (i (length list)) | ||
(dolist (i (sort list '<)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mutates the input list which might cause confusion. Change |
||
(test-peek queue (stringify i) t) | ||
(assert (= counter (q:size queue))) | ||
(test-dequeue queue (stringify i) t) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In which case can these two be equal? Objects with equal priorities, or something?
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.
yeah, judging by the commit comment and the added test, that seems to be the intent.