Created
July 20, 2015 18:46
-
-
Save allolex/f91c502f3ab14675a2c3 to your computer and use it in GitHub Desktop.
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_relative "bicycle" | |
| def runtest(expression) | |
| puts expression ? "Passed" : "Failed" | |
| # puts if expression | |
| # "Passed" | |
| # else | |
| # "Failed" | |
| # end | |
| end | |
| def test_default | |
| puts "A new Bicycle has a default wheel type of 'racing'" | |
| puts "and a default gear of 'high'" | |
| b = Bicycle.new | |
| runtest(b.speed == 300) | |
| end | |
| def test_childrens | |
| w = Wheel.new(:childrens) | |
| puts "A child's bicycle in low gear has a speed of 48." | |
| g = Gear.new(:low) | |
| b = Bicycle.new(w, g) | |
| runtest(b.speed == 48) | |
| puts "A child's bicycle in mid gear has a speed of 144." | |
| g = Gear.new(:mid) | |
| b = Bicycle.new(w, g) | |
| runtest(b.speed == 144) | |
| puts "A child's bicycle in high gear has a speed of 240." | |
| g = Gear.new(:high) | |
| b = Bicycle.new(w, g) | |
| runtest(b.speed == 240) | |
| end | |
| test_default | |
| test_childrens |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment