]>
gitweb.michael.orlitzky.com - dead/whatever-dl.git/blob - test.rb
06cd57171cbf17dfb932470fa73664149fe87109
3 # Modified a little to run from the whatever-dl test suite.
4 require (File
.dirname(__FILE__
) +
'/progressbar')
6 class ProgressBarTest
< Test
::Unit::TestCase
9 def do_make_progress_bar (title
, total
)
10 ProgressBar
.new(title
, total
)
15 pbar
= do_make_progress_bar("test(bytes)", total
)
16 pbar
.file_transfer_mode
17 0.step(total
, 2**14) {|x
|
26 pbar
= do_make_progress_bar("test(clear)", total
)
37 pbar
= do_make_progress_bar("test(halt)", total
)
47 pbar
= do_make_progress_bar("test(inc)", total
)
56 # Modified a little to run from the whatever-dl test suite.
57 pbar_file_path
= (File
.dirname(__FILE__
) +
'/progressbar.rb')
59 total
= File
.size(pbar_file_path
)
60 pbar
= do_make_progress_bar("test(inc(x))", total
)
61 File
.new(pbar_file_path
).each
{|line
|
70 pbar
= do_make_progress_bar("test(invalid set)", total
)
73 rescue RuntimeError
=> e
80 pbar
= do_make_progress_bar("test(set)", total
)
81 (1..total
).find_all
{|x
| x
% 10 == 0}.each
{|x
|
90 pbar
= do_make_progress_bar("test(slow)", total
)
100 pbar
= do_make_progress_bar("test(total=0)", total
)
105 class ReversedProgressBarTest
< ProgressBarTest
106 def do_make_progress_bar (title
, total
)
107 ReversedProgressBar
.new(title
, total
)