Created
February 21, 2017 13:46
-
-
Save dummied/da3a4d82d5dc52451e37003f7b11e266 to your computer and use it in GitHub Desktop.
Teensy FizzBuzz test-driven example
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
# 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 |
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 "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