diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-18 18:57:32 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-18 18:57:32 -0700 |
| commit | 6421887917a69fa79b76d238803f55e905e9619c (patch) | |
| tree | 52e2a52c3c690327f68039bdc96a6b906932a43f /test/assert.rb | |
| parent | 00c419f0665a57eed8581676952f6ebc402f755c (diff) | |
| parent | 8bf21cdeae7b9035539d0df37d6a255c189160a3 (diff) | |
| download | mruby-6421887917a69fa79b76d238803f55e905e9619c.tar.gz mruby-6421887917a69fa79b76d238803f55e905e9619c.zip | |
Merge pull request #160 from bovi/master
Finish all Integer ISO Tests
Diffstat (limited to 'test/assert.rb')
| -rw-r--r-- | test/assert.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/assert.rb b/test/assert.rb index 54b50138e..a4918ce23 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -65,3 +65,16 @@ def report() print("\n") end +## +# Performs fuzzy check for equality on methods returning floats +# on the basis of the Math::TOLERANCE constant. +def check_float(a, b) + a = a.to_f + b = b.to_f + if a.finite? and b.finite? + (a-b).abs < Math::TOLERANCE + else + true + end +end + |
