@@ -322,129 +322,3 @@ describe('Recommendation Engine', function () {
322322 it ( 'applies deltas rather than recalculating all recommendations when a rating changes' )
323323 } )
324324} )
325-
326- /*
327- xdescribe('bubbleSort', function() {
328- var array1 = [0,-1,1,5,-5,2,3,7];
329- var copyOfArray1 = [0,-1,1,5,-5,2,3,7];
330- var sortedArray1 = [-5,-1,0,1,2,3,5,7];
331-
332- it('should sort an array of integers', function() {
333- bubbleSort(array1).forEach(function(element, index){
334- expect(element).to.be(sortedArray1[index]);
335- });
336- });
337- it('should not mutate the original array', function() {
338- bubbleSort(array1);
339- array1.forEach(function(element, index){
340- expect(element).to.be(copyOfArray1[index]);
341- });
342- });
343- });
344-
345- xdescribe('mergeSort', function() {
346- var array1 = [0,-1,1,5,-5,2,3,7];
347- var copyOfArray1 = [0,-1,1,5,-5,2,3,7];
348- var sortedArray1 = [-5,-1,0,1,2,3,5,7];
349-
350- it('should sort an array of integers', function() {
351- mergeSort(array1).forEach(function(element, index){
352- expect(element).to.be(sortedArray1[index]);
353- });
354- });
355- it('should not mutate the original array', function() {
356- mergeSort(array1);
357- array1.forEach(function(element, index){
358- expect(element).to.be(copyOfArray1[index]);
359- });
360- });
361- it('should sort a large array faster than bubbleSort', function(){
362- var array = [];
363- for(var i=0; i<1e3; i++) {
364- array.push(Math.floor(Math.random() * 100));
365- }
366- var bubbleSortResults = timer(bubbleSort, array);
367- var mergeSortResults = timer(mergeSort, array);
368- mergeSortResults.result.forEach(function(element, index){
369- expect(element).to.be(bubbleSortResults.result[index]);
370- });
371- expect(mergeSortResults.timeElapsed).to.be.below(bubbleSortResults.timeElapsed);
372- });
373- });
374- */
375- // describe('quickSort', function() {
376- // var array, sortedArray;
377- // beforeEach(function(){
378- // array = [1234, 4521, 2252, 5103, 10001, 21, 235];
379- // sortedArray = [21, 235, 1234, 2252, 4521, 5103, 10001];
380- // });
381- //
382- // it('should sort an array of integers', function() {
383- // expect(quickSort(array)).to.deep.equal(sortedArray);
384- // });
385- //
386- // it('works for negative numbers', function(){
387- // array.push(-3);
388- // sortedArray.unshift(-3);
389- // expect(quickSort(array)).to.deep.equal(sortedArray);
390- // })
391- //
392- // it('works for decimals', function(){
393- // array.push(7.8);
394- // sortedArray.unshift(7.8);
395- // expect(quickSort(array)).to.deep.equal(sortedArray);
396- // })
397- // });
398- //
399- // describe('radixSort', function() {
400- // var array, sortedArray;
401- // beforeEach(function(){
402- // array = [1234, 4521, 2252, 5103, 10001, 21, 235];
403- // sortedArray = [21, 235, 1234, 2252, 4521, 5103, 10001];
404- // });
405- //
406- // it('should sort an array of integers', function() {
407- // expect(radixSort(array)).to.deep.equal(sortedArray);
408- // });
409- //
410- // xit('works for characters', function(){
411- // var array = ['bob', 'alice', 'carl', 'thx1138'] ;
412- // var sortedArray = ['alice', 'bob', 'carl', 'thx1138'] ;
413- // expect(radixSort(array)).to.deep.equal(sortedArray);
414- // })
415- //
416- // xit('works for decimals', function(){
417- // array.push(7.8);
418- // sortedArray.unshift(7.8);
419- // expect(radixSort(array)).to.deep.equal(sortedArray);
420- // })
421- //
422- // xit('works for negative numbers', function(){
423- // array.push(-3);
424- // sortedArray.unshift(-3);
425- // expect(radixSort(array)).to.deep.equal(sortedArray);
426- // })
427- // });
428-
429- /*
430- xdescribe('Extra Credit', function() {
431- it('sort non-integer arrays');
432- it('write tests to compare sorting speeds for large arrays');
433- it('write tests for sorting stability');
434- it('implement selectionSort');
435- it('implement insertionSort');
436- });
437- */
438-
439- // function timer(sortingAlgorithm, array){
440- // // copy array;
441- // var tempArray = array.slice();
442- // // time the algorithm
443- // var start = new Date().getTime();
444- // var result = sortingAlgorithm(tempArray);
445- // var end = new Date().getTime();
446- // return {
447- // timeElapsed : end - start,
448- // result : result
449- // };
450- // };
0 commit comments