Skip to content

Commit 6034d8d

Browse files
committed
Add specs for counting sort
1 parent 66c4af4 commit 6034d8d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var cs =
2+
require('../../../src/sorting/linearsort/countingsort').countingSort;
3+
4+
describe('countingsort', function () {
5+
'use strict';
6+
7+
it('should sort the empty array', function () {
8+
expect(cs([])).toEqual([]);
9+
});
10+
11+
it('should return array with the same count of elements', function () {
12+
expect(cs([2, 3, 4]).length).toBe(3);
13+
});
14+
15+
it('should sort the given array in ascending order', function () {
16+
expect(cs([42, 3, 10])).toEqual([3, 10, 42]);
17+
});
18+
});

0 commit comments

Comments
 (0)