File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 2
2
require 'rspec-benchmark'
3
3
require_relative '../task-1'
4
4
5
- RSpec . configure do |config |
6
- config . include RSpec ::Benchmark ::Matchers
7
- end
8
-
9
5
RSpec . describe 'work' do
6
+ include RSpec ::Benchmark ::Matchers
7
+
10
8
it 'should be linear' do
11
- `head -n 10000 data_large.txt > data.txt`
9
+ expect { |number , _ |
10
+ `head -n #{ number * 1000 } data_large.txt > data.txt`
12
11
13
- expect { work } . to perform_linear
12
+ work
13
+ } . to perform_linear . in_range ( 1 , 100 )
14
14
end
15
15
16
- it 'should perform under 15 seconds' do
17
- `cp data_large.txt data.txt`
16
+ it 'should perform under 5 seconds' do
17
+ `head -n 1000000 data_large.txt > data.txt`
18
18
19
- expect { work } . to perform_under ( 30 ) . sec
19
+ expect { work } . to perform_under ( 5 ) . sec
20
20
end
21
+
22
+ # it 'should perform under 30 seconds' do
23
+ # `cp data_large.txt data.txt`
24
+
25
+ # expect { work }.to perform_under(30).sec
26
+ # end
21
27
end
You can’t perform that action at this time.
0 commit comments