Created
July 12, 2017 22:26
-
-
Save rmacqueen/5bdccf33da70869524bd9488055094f4 to your computer and use it in GitHub Desktop.
Solução para primeira avaliação
This file contains 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 'test/unit' | |
def nama | |
num = 100 | |
arr = [] | |
(1..num).each { |i| | |
if i % 35 == 0 | |
arr.push("Nama Team") | |
elsif i % 7 == 0 | |
arr.push("Team") | |
elsif i % 5 == 0 | |
arr.push("Nama") | |
else | |
arr.push(i) | |
end | |
} | |
return arr | |
end | |
list = nama | |
puts list.join(', ') | |
class NamaTest < Test::Unit::TestCase | |
def setup | |
list = nama | |
end | |
def test_length | |
assert_equal(100, nama.length) | |
end | |
def test_regular_num | |
assert_equal(4, nama[3]) | |
end | |
def test_five_multiple | |
assert_equal("Nama", nama[9]) | |
end | |
def test_seven_multiple | |
assert_equal("Team", nama[20]) | |
end | |
def test_thirty_five_multiple | |
assert_equal("Nama Team", nama[69]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment