Project

General

Profile

Bug #17882 ยป bootstraptest-test_ractor-line224.rb

bootstraptest/test_ractor.rb:224 - xtkoba (Tee KOBAYASHI), 05/22/2021 03:45 PM

 

def test n
rs = (1..n).map do |i|
Ractor.new(i) do |i|
"r#{i}"
end
end
as = []
all_rs = rs.dup

n.times{
r, obj = Ractor.select(*rs)
as << [r, obj]
rs.delete(r)
}

if as.map{|r, o| r.object_id}.sort == all_rs.map{|r| r.object_id}.sort &&
as.map{|r, o| o}.sort == (1..n).map{|i| "r#{i}"}.sort
'ok'
else
'ng'
end
end

30.times.map{|i|
test i
}
    (1-1/1)