Skip to content

Commit 2169e17

Browse files
authored
merge: Add test case to shellSort algorithm (#975)
1 parent 42b9f64 commit 2169e17

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Sorts/test/ShellSort.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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

Comments
 (0)