@comparison-sorting/specification
Version:
Comparison sorting specification for JavaScript
3 lines (2 loc) • 1.65 kB
JavaScript
import{copy as r}from"@array-like/copy";import{isSorted as t}from"@comparison-sorting/is-sorted";import{shuffle as o}from"@randomized/random";import{sorted as i}from"@iterable-iterator/sorted";import{range as a}from"@iterable-iterator/range";import{exhaust as e}from"@iterable-iterator/consume";import{list as n}from"@iterable-iterator/list";import{map as c}from"@iterable-iterator/map";import{_chain as m}from"@iterable-iterator/chain";import{product as f}from"@set-theory/cartesian-product";import{star as l}from"@functional-abstraction/functools";import{increasing as u,decreasing as p}from"@total-order/primitive";function s(t,o,i,a){var e=Array.prototype.slice.call(o,i,a);e.sort(t),r(e,0,a-i,o,i)}var y=function(r,t){return u(r,t)},d=function(r){return i(y,r)},h=function(r,i,e,n,c,m){var f=d(a(c)),l=n.from(f);o(l,0,c),e(m,l,0,c),r.is(c,l.length,"check length"),r.is(void 0,l[-1],"check left boundary"),r.is(void 0,l[c],"check right boundary"),r.true(t(m,l,0,c),"check sorted"),r.deepEqual(f,d(l),"check data")};h.title=function(r,t,o,i,a,e){return null!=r?r:t+" (new "+i.name+"("+a+"), "+e.name+")"};var b={compare:[y,function(r,t){return p(r,t)}],length:[0,1,2,10,63,64,65],array:[Array,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array]},E=function(r){return c(function(r){return[r]},void 0===r[Symbol.iterator]?[r]:r)};function g(r,t,o){o=Object.assign({},b,o),e(c(function(t){l(function(t,o,i,a,e){e.BYTES_PER_ELEMENT&&a>Math.pow(2,8*e.BYTES_PER_ELEMENT)||r(h,t,o,e,a,i)},n(m(t)))},f([t,E(o.compare),E(o.length),E(o.array)],1)))}export{s as mock,g as test};
//# sourceMappingURL=index.module.js.map