118 lines
2.8 KiB
Ruby
118 lines
2.8 KiB
Ruby
require 'minitest/autorun'
|
|
require_relative 'raindrops'
|
|
|
|
# Common test data version: 1.0.0 9db5371
|
|
class RaindropsTest < Minitest::Test
|
|
def test_the_sound_for_1_is_1
|
|
#
|
|
assert_equal "1", Raindrops.convert(1)
|
|
end
|
|
|
|
def test_the_sound_for_3_is_pling
|
|
|
|
assert_equal "Pling", Raindrops.convert(3)
|
|
end
|
|
|
|
def test_the_sound_for_5_is_plang
|
|
|
|
assert_equal "Plang", Raindrops.convert(5)
|
|
end
|
|
|
|
def test_the_sound_for_7_is_plong
|
|
|
|
assert_equal "Plong", Raindrops.convert(7)
|
|
end
|
|
|
|
def test_the_sound_for_6_is_pling_as_it_has_a_factor_3
|
|
|
|
assert_equal "Pling", Raindrops.convert(6)
|
|
end
|
|
|
|
def test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base
|
|
|
|
assert_equal "8", Raindrops.convert(8)
|
|
end
|
|
|
|
def test_the_sound_for_9_is_pling_as_it_has_a_factor_3
|
|
|
|
assert_equal "Pling", Raindrops.convert(9)
|
|
end
|
|
|
|
def test_the_sound_for_10_is_plang_as_it_has_a_factor_5
|
|
|
|
assert_equal "Plang", Raindrops.convert(10)
|
|
end
|
|
|
|
def test_the_sound_for_14_is_plong_as_it_has_a_factor_of_7
|
|
|
|
assert_equal "Plong", Raindrops.convert(14)
|
|
end
|
|
|
|
def test_the_sound_for_15_is_plingplang_as_it_has_factors_3_and_5
|
|
|
|
assert_equal "PlingPlang", Raindrops.convert(15)
|
|
end
|
|
|
|
def test_the_sound_for_21_is_plingplong_as_it_has_factors_3_and_7
|
|
|
|
assert_equal "PlingPlong", Raindrops.convert(21)
|
|
end
|
|
|
|
def test_the_sound_for_25_is_plang_as_it_has_a_factor_5
|
|
|
|
assert_equal "Plang", Raindrops.convert(25)
|
|
end
|
|
|
|
def test_the_sound_for_27_is_pling_as_it_has_a_factor_3
|
|
|
|
assert_equal "Pling", Raindrops.convert(27)
|
|
end
|
|
|
|
def test_the_sound_for_35_is_plangplong_as_it_has_factors_5_and_7
|
|
|
|
assert_equal "PlangPlong", Raindrops.convert(35)
|
|
end
|
|
|
|
def test_the_sound_for_49_is_plong_as_it_has_a_factor_7
|
|
|
|
assert_equal "Plong", Raindrops.convert(49)
|
|
end
|
|
|
|
def test_the_sound_for_52_is_52
|
|
|
|
assert_equal "52", Raindrops.convert(52)
|
|
end
|
|
|
|
def test_the_sound_for_105_is_plingplangplong_as_it_has_factors_3_5_and_7
|
|
|
|
assert_equal "PlingPlangPlong", Raindrops.convert(105)
|
|
end
|
|
|
|
def test_the_sound_for_3125_is_plang_as_it_has_a_factor_5
|
|
|
|
assert_equal "Plang", Raindrops.convert(3125)
|
|
end
|
|
|
|
# Problems in exercism evolve over time, as we find better ways to ask
|
|
# questions.
|
|
# The version number refers to the version of the problem you solved,
|
|
# not your solution.
|
|
#
|
|
# Define a constant named VERSION inside of the top level BookKeeping
|
|
# module, which may be placed near the end of your file.
|
|
#
|
|
# In your file, it will look like this:
|
|
#
|
|
# module BookKeeping
|
|
# VERSION = 1 # Where the version number matches the one in the test.
|
|
# end
|
|
#
|
|
# If you are curious, read more about constants on RubyDoc:
|
|
# http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
|
|
|
|
def test_bookkeeping
|
|
|
|
assert_equal 3, BookKeeping::VERSION
|
|
end
|
|
end
|