Sha256: 9c40d3067dd7d2e4cf94b3528d11c7c5073a2e52548dcf4d17226b323e821077

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

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

class TestProgress < Test::Unit::TestCase
  def _test_bar
    t1 = Thread.new do
      Log::ProgressBar.with_bar(20) do |bar|
        20.times do
          bar.tick
          sleep 0.3
        end
      end
    end

    t2 = Thread.new do
      Log::ProgressBar.with_bar(20) do |bar|
        20.times do
          bar.tick
          sleep 0.2
        end
      end
    end
    t1.join
    t2.join
  end

  def test_bar_no_size
    t1 = Thread.new do
      Log::ProgressBar.with_bar(nil) do |bar|
        20.times do
          bar.tick
          sleep 0.3
        end
      end
    end

    t2 = Thread.new do
      Log::ProgressBar.with_bar(nil) do |bar|
        20.times do
          bar.tick
          sleep 0.2
        end
      end
    end
    t1.join
    t2.join
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbbt-util-5.13.0 test/rbbt/util/log/test_progress.rb