Created
April 14, 2015 01:13
-
-
Save zspencer/92969da8dcdf126919f1 to your computer and use it in GitHub Desktop.
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
describe "Converting Arabic Numerals to Roman Numerals" do | |
NUMERAL_TRANSLATIONS = { | |
1 => "I", | |
2 => "II", | |
5 => "V", | |
10 => "X" | |
} | |
NUMERAL_TRANSLATIONS.each_pair do |arabic, roman| | |
it "converts #{arabic} to #{roman}" do | |
expect(arabic_to_roman(arabic)).to eql(roman) | |
end | |
end | |
end | |
ARABIC_TO_ROMAN_MAPPING = { | |
1 => "I", | |
2 => "II", | |
5 => "V", | |
10 => "X" | |
} | |
def arabic_to_roman(number) | |
ARABIC_TO_ROMAN_MAPPING[number] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment