From: Jérôme Benoit Date: Thu, 20 Jun 2024 11:48:55 +0000 (+0200) Subject: test: improve priority queue coverage X-Git-Tag: v4.0.15~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7e5b3ca1879a576eebb1ecfd1af2e50085d14490;p=poolifier.git test: improve priority queue coverage Signed-off-by: Jérôme Benoit --- diff --git a/tests/priority-queue.test.mjs b/tests/priority-queue.test.mjs index 80f580d1..d65d6f16 100644 --- a/tests/priority-queue.test.mjs +++ b/tests/priority-queue.test.mjs @@ -247,6 +247,7 @@ describe('Priority queue test suite', () => { expect(priorityQueue.maxSize).toBe(6) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBeInstanceOf(FixedPriorityQueue) + expect(priorityQueue.tail).not.toStrictEqual(priorityQueue.head) let rtItem = priorityQueue.dequeue(3) expect(priorityQueue.buckets).toBe(2) expect(priorityQueue.size).toBe(5) @@ -254,6 +255,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(3) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBeInstanceOf(FixedPriorityQueue) + expect(priorityQueue.tail).not.toStrictEqual(priorityQueue.head) rtItem = priorityQueue.dequeue() expect(priorityQueue.buckets).toBe(2) expect(priorityQueue.size).toBe(4) @@ -261,6 +263,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(1) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBeInstanceOf(FixedPriorityQueue) + expect(priorityQueue.tail).not.toStrictEqual(priorityQueue.head) rtItem = priorityQueue.dequeue(2) expect(priorityQueue.buckets).toBe(1) expect(priorityQueue.size).toBe(3) @@ -268,6 +271,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(3) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBeInstanceOf(FixedPriorityQueue) + expect(priorityQueue.tail).not.toStrictEqual(priorityQueue.head) rtItem = priorityQueue.dequeue(2) expect(priorityQueue.buckets).toBe(1) expect(priorityQueue.size).toBe(2) @@ -275,6 +279,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(3) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBeInstanceOf(FixedPriorityQueue) + expect(priorityQueue.tail).not.toStrictEqual(priorityQueue.head) rtItem = priorityQueue.dequeue(2) expect(priorityQueue.buckets).toBe(0) expect(priorityQueue.size).toBe(1) @@ -282,6 +287,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(1) expect(priorityQueue.tail.empty()).toBe(false) expect(priorityQueue.tail.next).toBe(undefined) + expect(priorityQueue.tail).toStrictEqual(priorityQueue.head) rtItem = priorityQueue.dequeue() expect(priorityQueue.buckets).toBe(0) expect(priorityQueue.size).toBe(0) @@ -289,6 +295,7 @@ describe('Priority queue test suite', () => { expect(rtItem).toBe(2) expect(priorityQueue.tail.empty()).toBe(true) expect(priorityQueue.tail.next).toBe(undefined) + expect(priorityQueue.tail).toStrictEqual(priorityQueue.head) }) it('Verify enablePriority setter behavior', () => {