reign
Version:
A persistent, typed-objects implementation.
24 lines (19 loc) • 676 B
JavaScript
;
var _2 = require("./");
var _3 = _interopRequireDefault(_2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
describe('Integer Hashes', function () {
it(`should hash integer values`, function () {
Array.from({ length: 4096 }, (_, index) => index).forEach(value => {
const result = (0, _3.default)(value);
result.should.equal(Math.floor(result));
result.should.be.above(-1);
result.should.be.below(Math.pow(2, 32) - 1);
});
});
benchmark("Default", 1000000, {
integer: function integer() {
return (0, _3.default)(Math.random() * Math.pow(2, 32));
}
});
});