From 6caee856d0e31d8479a8dfbea76bbf3e22a621af Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 29 May 2024 00:18:39 +0200 Subject: [PATCH] test: add fixed priority queue get() test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/fixed-priority-queue.test.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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) -- 2.34.1