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
146 146
    assert_equal(1.0/0, Math.log(1.0/0))
147 147
    assert_nothing_raised { assert_infinity(-Math.log(+0.0)) }
148 148
    assert_nothing_raised { assert_infinity(-Math.log(-0.0)) }
149
    assert_raise(Math::DomainError) { Math.log(-1.0) }
150 149
    assert_raise(TypeError) { Math.log(1,nil) }
150
    assert_raise(Math::DomainError) { Math.log(-1.0) }
151 151
    assert_raise(Math::DomainError, '[ruby-core:62309] [ruby-Bug #9797]') { Math.log(1.0, -1.0) }
152
    assert_nothing_raised { assert_nan(Math.log(0.0, 0.0)) }
152
    assert_raise(Math::DomainError) { Math.log(0.0, 0.0) }
153
    assert_raise(Math::DomainError) { Math.log(1.0, 0.0) }
154
    assert_raise(Math::DomainError) { Math.log(2.0, 0.0) }
155
    assert_raise(Math::DomainError) { Math.log(0.0, 1.0) }
156
    assert_raise(Math::DomainError) { Math.log(1.0, 1.0) }
157
    assert_raise(Math::DomainError) { Math.log(2.0, 1.0) }
153 158
  end
154 159
  def test_log2