summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_ractor.rb
blob: f78663f15e238fa5d20efca93d28d2a542e98b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true
require_relative "helper"

class TestBigDecimalRactor < Test::Unit::TestCase
  include TestBigDecimalBase

  def setup
    super
    skip unless defined? Ractor
  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