assertthat
Version:
assertthat provides fluent TDD.
41 lines (40 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.unit = exports.setup = exports.scales = exports.name = exports.benchmark = void 0;
const compare_1 = require("../../lib/comparisons/typeAware/compare");
const zufall_1 = require("zufall");
const name = 'compare long strings';
exports.name = name;
let testStringLeft = '';
let testStringRight = '';
const getNewTestString = function ({ scale }) {
let testString = '';
for (let i = 0; i < scale; i++) {
testString += (0, zufall_1.randomWord)();
if (Math.random() > 0.9) {
testString += '\n';
}
}
return testString;
};
const setup = function ({ scale }) {
testStringLeft = getNewTestString({ scale });
testStringRight = getNewTestString({ scale });
};
exports.setup = setup;
const benchmark = async function () {
(0, compare_1.compare)(testStringLeft, testStringRight);
};
exports.benchmark = benchmark;
const scales = [
10,
20,
30,
40,
50,
60,
100
];
exports.scales = scales;
const unit = 'characters';
exports.unit = unit;