Created
July 2, 2020 17:25
-
-
Save dubzzz/b3b223778aabd66d3c64390085bce46e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| miniFc.assert = (property, { seed = Date.now() } = {}) => { | |
| let rng = prand.xoroshiro128plus(seed); | |
| for (let runId = 0 ; runId !== 100 ; ++runId) { | |
| const valueUnderTest = property.generate(new Random(rng)); | |
| if (!property.run(valueUnderTest)) { | |
| throw new Error(`Property failed after ${runId + 1} runs with value ${JSON.stringify(valueUnderTest)} (seed: ${seed})`); | |
| } | |
| rng = rng.jump(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment