mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_float.rb (TestFloat#test_round): show the number in question.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
522c16e84c
commit
ff2c5c161c
1 changed files with 5 additions and 4 deletions
|
@ -452,15 +452,16 @@ class TestFloat < Test::Unit::TestCase
|
|||
|
||||
def test_round
|
||||
VS.each {|f|
|
||||
msg = "round(#{f})"
|
||||
i = f.round
|
||||
if f < 0
|
||||
assert_operator(i, :<, 0)
|
||||
assert_operator(i, :<, 0, msg)
|
||||
else
|
||||
assert_operator(i, :>, 0)
|
||||
assert_operator(i, :>, 0, msg)
|
||||
end
|
||||
d = f - i
|
||||
assert_operator(-0.5, :<=, d)
|
||||
assert_operator(d, :<=, 0.5)
|
||||
assert_operator(-0.5, :<=, d, msg)
|
||||
assert_operator(d, :<=, 0.5, msg)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue