reign
Version:
A persistent, typed-objects implementation.
26 lines (21 loc) • 710 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 }, function (_, index) {
return index;
}).forEach(function (value) {
var 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));
}
});
});