Skip to content

Commit

Permalink
implemented renew of seed and logging of seed
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Mar 6, 2019
1 parent 85e9553 commit 433a151
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ export class TestCase {
this._seed = null
this._prng = null
}
renewSeed () {
this._seed = envSeed === null ? random.uint32() : envSeed
resetSeed () {
this._seed = null
this._prng = null
}
get seed () {
this.renewSeed()
if (this._seed === null) {
this._seed = envSeed === null ? random.uint32() : envSeed
}
return this._seed
}
get prng () {
this._prng = prng.create(this.seed)
if (this._prng === null) {
this._prng = prng.create(this.seed)
}
return this._prng
}
}
Expand Down Expand Up @@ -81,8 +86,8 @@ export const run = async (moduleName, name, f, i, numberOfTests) => {
const currTime = perf.now()
times.push(currTime - lastTime)
lastTime = currTime
if (repeat) {
tc.renewSeed()
if (repeat && err === null && (lastTime - start) < repititionTime) {
tc.resetSeed()
} else {
break
}
Expand Down

0 comments on commit 433a151

Please sign in to comment.