Skip to content

Instantly share code, notes, and snippets.

@dummied
Created February 21, 2017 13:46
Show Gist options
  • Save dummied/da3a4d82d5dc52451e37003f7b11e266 to your computer and use it in GitHub Desktop.
Save dummied/da3a4d82d5dc52451e37003f7b11e266 to your computer and use it in GitHub Desktop.
Teensy FizzBuzz test-driven example
# Print the numbers 1 to 100
# For multiples of 3, print "Fizz" instead of the number
# For multiples of 5, print "Buzz" instead of the number
# For multiples of 3 and 5, print "FizzBuzz" instead of the number
require "minitest/autorun"
require_relative "fizz_buzz"
class FizzbuzzTest < MiniTest::Test
def test_fizzbuzz_output
results = FizzBuzz.run
assert_equal Array, results.class
assert_equal 100, results.length
assert_equal "Buzz", results[54]
assert_equal "FizzBuzz", results[14]
assert_equal "Fizz", results[2]
assert_equal 7, results[6]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment