mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ruby: better assertions
* test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
287d2adab0
commit
3ac0ec4ecd
45 changed files with 532 additions and 510 deletions
|
@ -3,12 +3,12 @@ require 'test/unit'
|
|||
class TestMath < Test::Unit::TestCase
|
||||
def assert_infinity(a, *rest)
|
||||
rest = ["not infinity: #{a.inspect}"] if rest.empty?
|
||||
assert(!a.finite?, *rest)
|
||||
assert_not_predicate(a, :finite?, *rest)
|
||||
end
|
||||
|
||||
def assert_nan(a, *rest)
|
||||
rest = ["not nan: #{a.inspect}"] if rest.empty?
|
||||
assert(a.nan?, *rest)
|
||||
assert_predicate(a, :nan?, *rest)
|
||||
end
|
||||
|
||||
def check(a, b)
|
||||
|
@ -49,9 +49,9 @@ class TestMath < Test::Unit::TestCase
|
|||
def test_tan
|
||||
check(0.0, Math.tan(0 * Math::PI / 4))
|
||||
check(1.0, Math.tan(1 * Math::PI / 4))
|
||||
assert(Math.tan(2 * Math::PI / 4).abs > 1024)
|
||||
assert_operator(Math.tan(2 * Math::PI / 4).abs, :>, 1024)
|
||||
check(0.0, Math.tan(4 * Math::PI / 4))
|
||||
assert(Math.tan(6 * Math::PI / 4).abs > 1024)
|
||||
assert_operator(Math.tan(6 * Math::PI / 4).abs, :>, 1024)
|
||||
end
|
||||
|
||||
def test_acos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue