mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-25 22:46:20 +08:00
Fix issue #315.
This commit is contained in:
parent
2206158b57
commit
1520533d11
@ -51,7 +51,7 @@ describe('PriorityQueue', () => {
|
||||
expect(priorityQueue.poll()).toBe(5);
|
||||
});
|
||||
|
||||
it('should be possible to change priority of internal nodes', () => {
|
||||
it('should be possible to change priority of head node', () => {
|
||||
const priorityQueue = new PriorityQueue();
|
||||
|
||||
priorityQueue.add(10, 1);
|
||||
@ -59,6 +59,8 @@ describe('PriorityQueue', () => {
|
||||
priorityQueue.add(100, 0);
|
||||
priorityQueue.add(200, 0);
|
||||
|
||||
expect(priorityQueue.peek()).toBe(100);
|
||||
|
||||
priorityQueue.changePriority(100, 10);
|
||||
priorityQueue.changePriority(10, 20);
|
||||
|
||||
@ -68,7 +70,7 @@ describe('PriorityQueue', () => {
|
||||
expect(priorityQueue.poll()).toBe(10);
|
||||
});
|
||||
|
||||
it('should be possible to change priority of head node', () => {
|
||||
it('should be possible to change priority of internal nodes', () => {
|
||||
const priorityQueue = new PriorityQueue();
|
||||
|
||||
priorityQueue.add(10, 1);
|
||||
@ -76,6 +78,8 @@ describe('PriorityQueue', () => {
|
||||
priorityQueue.add(100, 0);
|
||||
priorityQueue.add(200, 0);
|
||||
|
||||
expect(priorityQueue.peek()).toBe(100);
|
||||
|
||||
priorityQueue.changePriority(200, 10);
|
||||
priorityQueue.changePriority(10, 20);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user