From 60d230d0fdf9a6e22ae13f30cb11f4c948c1d62b Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Fri, 14 Jun 2013 21:49:56 +0800 Subject: Add assert_float to test environment --- test/assert.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/assert.rb b/test/assert.rb index f7c2c97b9..38141d1e8 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -178,6 +178,14 @@ def assert_kind_of(cls, obj, msg = nil) assert_true(obj.kind_of?(cls), msg, diff) end +## +# Fails unless +exp+ is equal to +act+ in terms of a Float +def assert_float(exp, act, msg = nil) + msg = "Float #{exp} expected to be equal to float #{act}" unless msg + diff = assertion_diff(exp, act) + assert_true check_float(exp, act), msg, diff +end + ## # Report the test result and print all assertions # which were reported broken. -- cgit v1.2.3