Skip to content

Instantly share code, notes, and snippets.

@technoweenie
Created October 19, 2009 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save technoweenie/213780 to your computer and use it in GitHub Desktop.
Save technoweenie/213780 to your computer and use it in GitHub Desktop.
# 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