Created
July 23, 2012 12:39
-
-
Save rodrigoflores/3163429 to your computer and use it in GitHub Desktop.
Assert Linear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require 'minitest/benchmark' | |
load 'lib/klass.rb' | |
class TestKlass < MiniTest::Unit::TestCase | |
describe "linear" do | |
it "is linear" do | |
assert_performance_linear 0.9999 do |n| # n is a range value | |
Klass.linear(n) | |
end | |
end | |
end | |
describe "quadratic" do | |
it "is quadratic" do | |
assert_performance_constant 0.99 do |n| # n is a range value | |
10.times do | |
Klass.linear(n) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment