summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_bigdecimal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb23
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