Sha256: 36d95a79231618a009a2395a318f43324fe1dd5cc62477c80692b278d9fa2e27

Contents?: true

Size: 478 Bytes

Versions: 68

Compression:

Stored size: 478 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/util/semaphore'

class TestRbbtSemaphore < Test::Unit::TestCase
  def test_thread
    times = 50
    TmpFile.with_file do |dir|
      Path.setup(dir)
      FileUtils.mkdir_p dir
      RbbtSemaphore.thread_each_on_semaphore((1..times).to_a, 25){|elem|
        sleep rand
        Open.write(dir[elem], "test")
      }
      assert_equal times, dir.glob.length
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
rbbt-util-5.13.14 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.13 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.12 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.11 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.10 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.9 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.8 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.7 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.6 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.5 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.4 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.3 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.2 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.1 test/rbbt/util/test_semaphore.rb
rbbt-util-5.13.0 test/rbbt/util/test_semaphore.rb
rbbt-util-5.12.3 test/rbbt/util/test_semaphore.rb
rbbt-util-5.12.2 test/rbbt/util/test_semaphore.rb
rbbt-util-5.12.1 test/rbbt/util/test_semaphore.rb
rbbt-util-5.12.0 test/rbbt/util/test_semaphore.rb
rbbt-util-5.11.9 test/rbbt/util/test_semaphore.rb