Skip to content

Commit

Permalink
Adding multi thread unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
valarpirai committed Dec 8, 2019
1 parent 6c92846 commit 8daef74
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test_ruby_xid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,14 @@ def test_copy_string_from_golang
assert_equal(x.value, [0x4d, 0x88, 0xe1, 0x5b, 0x60, 0xf4,
0x86, 0xe4, 0x28, 0x41, 0x2d, 0xc9])
end

def test_thread_safety
threads = []

100.times do
threads << Thread.new { 100.times { Xid.new } }
end

threads.each(&:join)
end
end

0 comments on commit 8daef74

Please sign in to comment.