diff options
| author | Ivan Goncharov <[email protected]> | 2017-03-01 00:04:52 +0200 |
|---|---|---|
| committer | Ivan Goncharov <[email protected]> | 2017-03-01 00:55:30 +0200 |
| commit | 38d2f3449e1e5a78c7215e6c8f6346c0fd0a652b (patch) | |
| tree | 62ed9fb01303ab7ed0ef587d042ee76f0bd92709 /test/random.unit.js | |
| parent | f379057be0112d6732b056d93d1380be18e1087a (diff) | |
| download | faker-38d2f3449e1e5a78c7215e6c8f6346c0fd0a652b.tar.xz faker-38d2f3449e1e5a78c7215e6c8f6346c0fd0a652b.zip | |
Fix generation of float numbers
Fixes #401
Diffstat (limited to 'test/random.unit.js')
| -rw-r--r-- | test/random.unit.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/random.unit.js b/test/random.unit.js index 6214039b..133fd887 100644 --- a/test/random.unit.js +++ b/test/random.unit.js @@ -56,6 +56,14 @@ describe("random.js", function () { }); + it("provides numbers with a with exact precision", function() { + var options = { min: 0.5, max: 0.99, precision: 0.01 }; + for(var i = 0; i < 100; i++) { + var number = faker.random.number(options); + assert.equal(number, Number(number.toFixed(2))); + } + }); + it("should not modify the input object", function() { var min = 1; var max = 2; |
