diff options
Diffstat (limited to 'test/ruby/test_math.rb')
-rw-r--r-- | test/ruby/test_math.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index 2eaea6cf37..4d819d71a1 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -22,10 +22,15 @@ class TestMath < Test::Unit::TestCase check(-0.0, Math.atan2(-0.0, +0.0)) check(+Math::PI, Math.atan2(+0.0, -0.0)) check(-Math::PI, Math.atan2(-0.0, -0.0)) - assert_raise(Math::DomainError) { Math.atan2(Float::INFINITY, Float::INFINITY) } - assert_raise(Math::DomainError) { Math.atan2(Float::INFINITY, -Float::INFINITY) } - assert_raise(Math::DomainError) { Math.atan2(-Float::INFINITY, Float::INFINITY) } - assert_raise(Math::DomainError) { Math.atan2(-Float::INFINITY, -Float::INFINITY) } + + inf = Float::INFINITY + expected = 3.0 * Math::PI / 4.0 + assert_nothing_raised { check(+expected, Math.atan2(+inf, -inf)) } + assert_nothing_raised { check(-expected, Math.atan2(-inf, -inf)) } + expected = Math::PI / 4.0 + assert_nothing_raised { check(+expected, Math.atan2(+inf, +inf)) } + assert_nothing_raised { check(-expected, Math.atan2(-inf, +inf)) } + check(0, Math.atan2(0, 1)) check(Math::PI / 4, Math.atan2(1, 1)) check(Math::PI / 2, Math.atan2(1, 0)) |