|
| 1 | +import { shellSort } from '../ShellSort' |
| 2 | + |
| 3 | +test('The ShellSort of the array [5, 4, 3, 2, 1] is [1, 2, 3, 4, 5]', () => { |
| 4 | + const arr = [5, 4, 3, 2, 1] |
| 5 | + const res = shellSort(arr) |
| 6 | + expect(res).toEqual([1, 2, 3, 4, 5]) |
| 7 | +}) |
| 8 | + |
| 9 | +test('The ShellSort of the array [] is []', () => { |
| 10 | + const arr = [] |
| 11 | + const res = shellSort(arr) |
| 12 | + expect(res).toEqual([]) |
| 13 | +}) |
| 14 | + |
| 15 | +test('The ShellSort of the array [15, 24, 31, 42, 11] is [11, 15, 24, 31, 42]', () => { |
| 16 | + const arr = [15, 24, 31, 42, 11] |
| 17 | + const res = shellSort(arr) |
| 18 | + expect(res).toEqual([11, 15, 24, 31, 42]) |
| 19 | +}) |
| 20 | + |
| 21 | +test('The ShellSort of the array [121, 190, 169] is [121, 169, 190]', () => { |
| 22 | + const arr = [121, 190, 169] |
| 23 | + const res = shellSort(arr) |
| 24 | + expect(res).toEqual([121, 169, 190]) |
| 25 | +}) |
0 commit comments