'use strict';

var test = require('tap').test;
var quickselect = require('../src/quickselect');

test('quickselect', function (t) {
    var arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];
    quickselect(arr, 8);
    t.deepEqual(arr, [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]);
    t.end();
});

test('quickselect long arrays', function (t) {
    var arr = [];
    for (var i = 1000; i >= 0; i--) arr.push(i);
    quickselect(arr, 300);
    t.equal(arr[300], 300);
    t.end();
});

@@ -494,28 +494,237 @@
 00%5D, 300);%0A    t.end();%0A%7D);%0A
+%0Atest('quickselect long arrays L35 coverage', function (t) %7B%0A    var arr = %5B%5D;%0A    for (var i = 1000; i %3E= 0; i--) arr.push(i);%0A    quickselect(arr, 500, 10, 620);%0A    t.equal(arr%5B300%5D, 700);%0A    t.end();%0A%7D);%0A

Improve coverage of quickselect algorithm (#168)