|
| 1 | +import { heapSort } from '../HeapSort' |
| 2 | + |
| 3 | +test('The HeapSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { |
| 4 | + const array = [5, 4, 3, 2, 1] |
| 5 | + const res = heapSort(array) |
| 6 | + expect(res).toEqual([1, 2, 3, 4, 5]) |
| 7 | +}) |
| 8 | + |
| 9 | +test('The HeapSort of the array [-5, -4, -3, -2, -1] is [-5, -4, -3, -2, -1]', () => { |
| 10 | + const array = [-5, -4, -3, -2, -1] |
| 11 | + const res = heapSort(array) |
| 12 | + expect(res).toEqual([-5, -4, -3, -2, -1]) |
| 13 | +}) |
| 14 | + |
| 15 | +test('The HeapSort of the array [50, 43, 31, 52, 91] is [31, 43, 50, 52, 91]', () => { |
| 16 | + const array = [50, 43, 31, 52, 91] |
| 17 | + const res = heapSort(array) |
| 18 | + expect(res).toEqual([31, 43, 50, 52, 91]) |
| 19 | +}) |
| 20 | + |
| 21 | +test('The HeapSort of the array [] is []', () => { |
| 22 | + const array = [] |
| 23 | + const res = heapSort(array) |
| 24 | + expect(res).toEqual([]) |
| 25 | +}) |
0 commit comments