-
Notifications
You must be signed in to change notification settings - Fork 1
/
bubblesort.spec.js
46 lines (40 loc) · 1.31 KB
/
bubblesort.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* eslint-env node, jasmine */
// global expect, Bubble Sort, matchFunctionMaker, $, Selector
describe('Bubble Sort', function(){
it('handles an empty array', function(){
expect( bubbleSort([]) ).toEqual( [] );
});
it('Sort the given array', function(){
expect( bubbleSort([1,3,2,4]) ).toEqual( [1,2,3,4] );
});
it('Sort the given array', function(){
expect( bubbleSort([5,1,3,2,4]) ).toEqual( [1,2,3,4,5] );
});
it('Sort the given array', function(){
expect( bubbleSort([5,6,2,6,4,9,1,3,2,4])).toEqual( [1,2,2,3,4,4,5,6,6,9] );
});
});
describe('Split', function(){
it('handles an empty array', function(){
expect( split([1,3,2,4]) ).toEqual( [[1,3], [2,4]] )
});
it('Sort the given array', function(){
expect( split([5,1,3,2,4]) ).toEqual( [[5,1], [3,2,4]] );
});
});
describe('Merge', function(){
it('handles an empty array', function(){
expect( merge([4,5,6], [3,2,1]) ).toEqual( [3,2,1,4,5,6,] );
});
it('Sort the given array', function(){
expect( merge([1,5],[2,3,4] ) ).toEqual( [1,2,3,4,5] );
});
});
describe('MergeSort', function(){
it('handles an empty array', function(){
expect( mergeSort([4,5,6,3,2,1]) ).toEqual( [1,2,3,4,5,6] );
});
it('Sort the given array', function(){
expect( mergeSort([1,5,2,3,4] ) ).toEqual( [1,2,3,4,5] );
});
});