ruby-changes:32481
From: nobu <ko1@a...>
Date: Sat, 11 Jan 2014 19:26:10 +0900 (JST)
Subject: [ruby-changes:32481] nobu:r44560 (trunk): test_bigmath.rb: test_log
nobu 2014-01-11 19:26:05 +0900 (Sat, 11 Jan 2014) New Revision: 44560 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44560 Log: test_bigmath.rb: test_log * test/bigdecimal/test_bigmath.rb (test_log): add basic test for BigMath.log. Modified files: trunk/test/bigdecimal/test_bigmath.rb Index: test/bigdecimal/test_bigmath.rb =================================================================== --- test/bigdecimal/test_bigmath.rb (revision 44559) +++ test/bigdecimal/test_bigmath.rb (revision 44560) @@ -60,4 +60,11 @@ class TestBigMath < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/bigdecimal/test_bigmath.rb#L60 assert_equal(BigDecimal("0.823840753418636291769355073102514088959345624027952954058347023122539489"), atan(BigDecimal("1.08"), 72).round(72), '[ruby-dev:41257]') end + + def test_log + assert_equal(0, BigMath.log(BigDecimal("1.0"), 10)) + assert_in_epsilon(Math.log(10)*1000, BigMath.log(BigDecimal("1e1000"), 10)) + assert_raise(Math::DomainError) {BigMath.log(BigDecimal("0"), 10)} + assert_raise(Math::DomainError) {BigMath.log(BigDecimal("-1"), 10)} + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/