refactor promise, geneerators, global object
This commit is contained in:
parent
be9c5a7b5f
commit
2ee2751216
69 changed files with 900 additions and 643 deletions
|
@ -0,0 +1,21 @@
|
|||
describe("pseudoRandom", function() {
|
||||
|
||||
it("follows the formula", function() {
|
||||
let generator = pseudoRandom(1);
|
||||
|
||||
assert.equal(generator.next().value, 16807);
|
||||
assert.equal(generator.next().value, 282475249);
|
||||
assert.equal(generator.next().value, 1622650073);
|
||||
});
|
||||
|
||||
|
||||
it("returns same value for the same seed", function() {
|
||||
let generator1 = pseudoRandom(123);
|
||||
let generator2 = pseudoRandom(123);
|
||||
|
||||
assert.deepEqual(generator1.next(), generator2.next());
|
||||
assert.deepEqual(generator1.next(), generator2.next());
|
||||
assert.deepEqual(generator1.next(), generator2.next());
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue