This commit is contained in:
Oleksii Trekhleb 2019-04-12 09:02:03 +03:00
parent 2206158b57
commit 1520533d11

View File

@ -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);