Project

General

Profile

Feature #10255 » test_math.rb_ Add tests for Math.log.PATCH

gogotanaka (Kazuki Tanaka), 09/18/2014 05:50 AM

View differences:

test/ruby/test_math.rb
assert_equal(1.0/0, Math.log(1.0/0))
assert_nothing_raised { assert_infinity(-Math.log(+0.0)) }
assert_nothing_raised { assert_infinity(-Math.log(-0.0)) }
assert_raise(Math::DomainError) { Math.log(-1.0) }
assert_raise(TypeError) { Math.log(1,nil) }
assert_raise(Math::DomainError) { Math.log(-1.0) }
assert_raise(Math::DomainError, '[ruby-core:62309] [ruby-Bug #9797]') { Math.log(1.0, -1.0) }
assert_nothing_raised { assert_nan(Math.log(0.0, 0.0)) }
assert_raise(Math::DomainError) { Math.log(0.0, 0.0) }
assert_raise(Math::DomainError) { Math.log(1.0, 0.0) }
assert_raise(Math::DomainError) { Math.log(2.0, 0.0) }
assert_raise(Math::DomainError) { Math.log(0.0, 1.0) }
assert_raise(Math::DomainError) { Math.log(1.0, 1.0) }
assert_raise(Math::DomainError) { Math.log(2.0, 1.0) }
end
def test_log2
(1-1/4)