-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test case with benchmarks * Skip benchmark * Support extracting metadata from benchmark file * Skip benchmark tests
- Loading branch information
1 parent
3477944
commit 661c74a
Showing
5 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":2,"status":"pass","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"pass"},{"name":"A name given","test_code":"assert_equal \"One for Alice, one for me.\", TwoFer.two_fer(\"Alice\")","status":"pass"},{"name":"Another name given","test_code":"assert_equal \"One for Bob, one for me.\", TwoFer.two_fer(\"Bob\")","status":"pass"}]} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class TwoFer | ||
def self.two_fer(name = "you") | ||
"One for #{name}, one for me." | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'minitest/autorun' | ||
require 'minitest/benchmark' | ||
require_relative 'two_fer' | ||
|
||
class TwoFerBenchmarkTest < Minitest::Benchmark | ||
def bench_two_fer | ||
assert_performance_linear 0.9999 do |n| # n is a range value | ||
TwoFer.two_fer | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'minitest/autorun' | ||
require_relative 'two_fer' | ||
|
||
# Common test data version: 1.2.0 4fc1acb | ||
class TwoFerTest < Minitest::Test | ||
def test_no_name_given | ||
# skip | ||
assert_equal "One for you, one for me.", TwoFer.two_fer | ||
end | ||
|
||
def test_a_name_given | ||
skip | ||
assert_equal "One for Alice, one for me.", TwoFer.two_fer("Alice") | ||
end | ||
|
||
def test_another_name_given | ||
skip | ||
assert_equal "One for Bob, one for me.", TwoFer.two_fer("Bob") | ||
end | ||
end |