Skip to content

Commit

Permalink
chore: adjust specs
Browse files Browse the repository at this point in the history
  • Loading branch information
potashin committed Apr 29, 2024
1 parent bdd8a43 commit e89db7b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions spec/task-1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
require 'rspec-benchmark'
require_relative '../task-1'

RSpec.configure do |config|
config.include RSpec::Benchmark::Matchers
end

RSpec.describe 'work' do
include RSpec::Benchmark::Matchers

it 'should be linear' do
`head -n 10000 data_large.txt > data.txt`
expect { |number, _|
`head -n #{number * 1000} data_large.txt > data.txt`

expect { work }.to perform_linear
work
}.to perform_linear.in_range(1, 100)
end

it 'should perform under 15 seconds' do
`cp data_large.txt data.txt`
it 'should perform under 5 seconds' do
`head -n 1000000 data_large.txt > data.txt`

expect { work }.to perform_under(30).sec
expect { work }.to perform_under(5).sec
end

# it 'should perform under 30 seconds' do
# `cp data_large.txt data.txt`

# expect { work }.to perform_under(30).sec
# end
end

0 comments on commit e89db7b

Please sign in to comment.