Skip to content

Instantly share code, notes, and snippets.

@esparkman
Forked from remear/fizzbuzz.rb
Created April 11, 2012 12:54
Show Gist options
  • Save esparkman/2359133 to your computer and use it in GitHub Desktop.
Save esparkman/2359133 to your computer and use it in GitHub Desktop.
require "test/unit"
class TestFizzBuzz < Test::Unit::TestCase
def fizzbuzz(x)
"#{'Fizz' if x % 3 == 0}#{'Buzz' if x % 5 == 0}"
end
def test_equal
assert_equal fizzbuzz(3), "Fizz"
assert_equal fizzbuzz(50), "Buzz"
assert_equal fizzbuzz(15), "FizzBuzz"
assert_equal fizzbuzz(5175), "FizzBuzz"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment