summaryrefslogtreecommitdiffhomepage
path: root/test/assert.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-05-18 18:57:32 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-05-18 18:57:32 -0700
commit6421887917a69fa79b76d238803f55e905e9619c (patch)
tree52e2a52c3c690327f68039bdc96a6b906932a43f /test/assert.rb
parent00c419f0665a57eed8581676952f6ebc402f755c (diff)
parent8bf21cdeae7b9035539d0df37d6a255c189160a3 (diff)
downloadmruby-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.rb13
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
+