X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=vendor%2Fruby-progressbar%2Ftest.rb;fp=vendor%2Fruby-progressbar%2Ftest.rb;h=0000000000000000000000000000000000000000;hb=2e77ebd6945c8c681fe2c4ab04e1ec50eabd2f5c;hp=06cd57171cbf17dfb932470fa73664149fe87109;hpb=097749b9e9d7ab29bb78f681f01865741aea9342;p=dead%2Fwhatever-dl.git diff --git a/vendor/ruby-progressbar/test.rb b/vendor/ruby-progressbar/test.rb deleted file mode 100644 index 06cd571..0000000 --- a/vendor/ruby-progressbar/test.rb +++ /dev/null @@ -1,110 +0,0 @@ -require 'test/unit' - -# Modified a little to run from the whatever-dl test suite. -require (File.dirname(__FILE__) + '/progressbar') - -class ProgressBarTest < Test::Unit::TestCase - SleepUnit = 0.01 - - def do_make_progress_bar (title, total) - ProgressBar.new(title, total) - end - - def test_bytes - total = 1024 * 1024 - pbar = do_make_progress_bar("test(bytes)", total) - pbar.file_transfer_mode - 0.step(total, 2**14) {|x| - pbar.set(x) - sleep(SleepUnit) - } - pbar.finish - end - - def test_clear - total = 100 - pbar = do_make_progress_bar("test(clear)", total) - total.times { - sleep(SleepUnit) - pbar.inc - } - pbar.clear - puts - end - - def test_halt - total = 100 - pbar = do_make_progress_bar("test(halt)", total) - (total / 2).times { - sleep(SleepUnit) - pbar.inc - } - pbar.halt - end - - def test_inc - total = 100 - pbar = do_make_progress_bar("test(inc)", total) - total.times { - sleep(SleepUnit) - pbar.inc - } - pbar.finish - end - - def test_inc_x - # Modified a little to run from the whatever-dl test suite. - pbar_file_path = (File.dirname(__FILE__) + '/progressbar.rb') - - total = File.size(pbar_file_path) - pbar = do_make_progress_bar("test(inc(x))", total) - File.new(pbar_file_path).each {|line| - sleep(SleepUnit) - pbar.inc(line.length) - } - pbar.finish - end - - def test_invalid_set - total = 100 - pbar = do_make_progress_bar("test(invalid set)", total) - begin - pbar.set(200) - rescue RuntimeError => e - puts e.message - end - end - - def test_set - total = 1000 - pbar = do_make_progress_bar("test(set)", total) - (1..total).find_all {|x| x % 10 == 0}.each {|x| - sleep(SleepUnit) - pbar.set(x) - } - pbar.finish - end - - def test_slow - total = 100000 - pbar = do_make_progress_bar("test(slow)", total) - 0.step(500, 1) {|x| - pbar.set(x) - sleep(SleepUnit) - } - pbar.halt - end - - def test_total_zero - total = 0 - pbar = do_make_progress_bar("test(total=0)", total) - pbar.finish - end -end - -class ReversedProgressBarTest < ProgressBarTest - def do_make_progress_bar (title, total) - ReversedProgressBar.new(title, total) - end -end -