Travis build: 1678 [cron]
This commit is contained in:
9
test/mostPerformant/mostPerformant.js
Normal file
9
test/mostPerformant/mostPerformant.js
Normal file
@ -0,0 +1,9 @@
|
||||
const mostPerformant = (fns, iterations = 10000) => {
|
||||
const times = fns.map(fn => {
|
||||
const before = performance.now();
|
||||
for (let i = 0; i < iterations; i++) fn();
|
||||
return performance.now() - before;
|
||||
});
|
||||
return times.indexOf(Math.min(...times));
|
||||
};
|
||||
module.exports = mostPerformant;
|
||||
13
test/mostPerformant/mostPerformant.test.js
Normal file
13
test/mostPerformant/mostPerformant.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const mostPerformant = require('./mostPerformant.js');
|
||||
|
||||
test('Testing mostPerformant', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof mostPerformant === 'function', 'mostPerformant is a Function');
|
||||
//t.deepEqual(mostPerformant(args..), 'Expected');
|
||||
//t.equal(mostPerformant(args..), 'Expected');
|
||||
//t.false(mostPerformant(args..), 'Expected');
|
||||
//t.throws(mostPerformant(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
3707
test/testlog
3707
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user