diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-21 03:35:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-21 03:35:27 +0000 |
commit | f9a4d5717c2cc4eddb44439f7d85d6840e928127 (patch) | |
tree | 8d9bbf8fca56c994681130c36a6c5a25458329a8 /test | |
parent | 1c6226b67d22057ec09948adc7d48426ed355ec2 (diff) | |
download | ruby-f9a4d5717c2cc4eddb44439f7d85d6840e928127.tar.gz |
* ext/bigdecimal/bigdecimal.c (BigDecimal_s_allocate): follow
Allocation Framework. [Bug #5775]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index e855d5617d..51dcb8e29b 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -19,10 +19,6 @@ class TestBigDecimal < Test::Unit::TestCase [ BigDecimal::ROUND_FLOOR, :floor], ] - def assert_allocate - assert_raise(TypeError) {BigDecimal.allocate} - end - def assert_nan(x) assert(x.nan?, "Expected #{x.inspect} to be NaN") end @@ -47,6 +43,10 @@ class TestBigDecimal < Test::Unit::TestCase "Expected #{x.inspect} to be negative zero") end + def test_not_equal + assert_not_equal BigDecimal("1"), BigDecimal.allocate + end + def test_global_new assert_equal(1, BigDecimal("1")) assert_equal(1, BigDecimal("1", 1)) @@ -1288,4 +1288,19 @@ class TestBigDecimal < Test::Unit::TestCase end end end + + def test_dup + [1, -1, 2**100, -2**100].each do |i| + x = BigDecimal(i) + assert_equal(x, x.dup) + end + end + + def test_dup_subclass + c = Class.new(BigDecimal) + x = c.new(1) + y = x.dup + assert_equal(1, y) + assert_kind_of(c, y) + end end |