From: Jérôme Benoit Date: Tue, 28 May 2024 22:18:39 +0000 (+0200) Subject: test: add fixed priority queue get() test X-Git-Tag: v4.0.13~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6caee856d0e31d8479a8dfbea76bbf3e22a621af;p=poolifier.git test: add fixed priority queue get() test Signed-off-by: Jérôme Benoit --- diff --git a/tests/fixed-priority-queue.test.mjs b/tests/fixed-priority-queue.test.mjs index be25a8f4..e4f3abd3 100644 --- a/tests/fixed-priority-queue.test.mjs +++ b/tests/fixed-priority-queue.test.mjs @@ -83,6 +83,17 @@ describe('Fixed priority queue test suite', () => { ) }) + it('Verify get() behavior', () => { + const fixedPriorityQueue = new FixedPriorityQueue() + fixedPriorityQueue.enqueue(1) + fixedPriorityQueue.enqueue(2, -1) + fixedPriorityQueue.enqueue(3) + expect(fixedPriorityQueue.get(0)).toBe(2) + expect(fixedPriorityQueue.get(1)).toBe(1) + expect(fixedPriorityQueue.get(2)).toBe(3) + expect(fixedPriorityQueue.get(3)).toBe(undefined) + }) + it('Verify dequeue() behavior', () => { const queueSize = 5 const fixedPriorityQueue = new FixedPriorityQueue(queueSize)