2020-12-18 12:45:47 -05:00
|
|
|
# frozen_string_literal: true
|
2021-01-06 00:41:13 -05:00
|
|
|
require_relative "helper"
|
2020-12-18 12:45:47 -05:00
|
|
|
|
|
|
|
class TestBigDecimalRactor < Test::Unit::TestCase
|
|
|
|
include TestBigDecimalBase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2021-10-22 00:04:42 -04:00
|
|
|
omit unless defined? Ractor
|
2020-12-18 12:45:47 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_ractor_shareable
|
|
|
|
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
|
|
|
|
begin;
|
|
|
|
$VERBOSE = nil
|
|
|
|
require "bigdecimal"
|
|
|
|
r = Ractor.new BigDecimal(Math::PI, Float::DIG+1) do |pi|
|
|
|
|
BigDecimal('2.0')*pi
|
|
|
|
end
|
|
|
|
assert_equal(2*Math::PI, r.take)
|
|
|
|
end;
|
|
|
|
end
|
|
|
|
end
|