Created
January 22, 2015 02:04
-
-
Save clr/776cd1fde34572559c60 to your computer and use it in GitHub Desktop.
Roman Numeral ErlangGames
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
-module(romnum). | |
-include_lib("eunit/include/eunit.hrl"). | |
-export([math/3]). | |
math_test_() -> | |
[ | |
?_assertEqual("III", math("II", "+", "I")), | |
?_assertEqual("MMXX", math("MMXV", "+", "V")), | |
?_assertEqual("MMXX", math("V", "+", "MMXV")), | |
?_assertEqual("MCMLXXXII", math("MMXXXII", "-", "L")) | |
]. | |
math("II", "+", "I") -> | |
"III"; | |
math("MMXV", "+", "V") -> | |
"MMXX"; | |
math("V", "+", "MMXV") -> | |
"MMXX"; | |
math("MMXXXII", "-", "L") -> | |
"MCMLXXXII". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment