Hello,
In message "[ruby-talk:03479] Re: RubyUnit assert_raiseexception"
on 00/06/17, Aleksi Niemel<aleksi.niemela / cinnober.com> writes:
> assert_equal_float(Math.sqrt(2), 1.414, Epsilon.new(0.001))
> assert_equal_float(Math.sqrt(2), 1.414, DigitPrecision(3))
I have one question and one suggestion.
Question:
On DigitPrecision check, Does not
assert_equal_float(1.4135, 1.414, DigitPrecision(3))
raise AssertionFailedError?
I am not sure this is good or bad, but I think that
assert_equal_float(1.4135, 1.414, DigitPrecision(3))
raise AssertionFailedError, and
assert_equal_float(1.4145, 1.414, DigitPrecision(3))
does *not* raise AssertionFailedError.
1.4135 and 1.414 are same as 1.41.
1.4145 and 1.414 are same as 1.414.
And Here is the suggestion:
How about assert_equal_float accepts both Float and
Integer as 3-rd argument?
assert_equal_float(Math.sqrt(2), 1.414, 0.001)
assert_equal_float(Math.sqrt(2), 1.414, 3)
Float means Epsilon, Integer means DigitPrecision.
Thank you.
Masaki Suketa <CQN02273 / nifty.ne.jp>