From 1367f28a4973bf24be22ff274b5eb1aa67418627 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 11 Jan 2014 10:26:05 +0000 Subject: test_bigmath.rb: test_log * test/bigdecimal/test_bigmath.rb (test_log): add basic test for BigMath.log. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/bigdecimal/test_bigmath.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/bigdecimal/test_bigmath.rb b/test/bigdecimal/test_bigmath.rb index 2ccdb510f9..c553353d61 100644 --- a/test/bigdecimal/test_bigmath.rb +++ b/test/bigdecimal/test_bigmath.rb @@ -60,4 +60,11 @@ class TestBigMath < Test::Unit::TestCase 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 -- cgit v1.2.3