Created
October 19, 2009 22:22
-
-
Save technoweenie/213780 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
# how do you test algorithms? | |
class Pythagoream < Struct.new(:a, :b) | |
def result | |
a**2 + b**2 | |
end | |
end | |
def test_pythagoream | |
assert_equal 25, Pythagoream.new(3, 4).result | |
end | |
# OR | |
def test_pythagoream | |
assert_equal 3**2+4**2, Pythagoream.new(3, 4).result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment