package romantoint_test import ( "testing" "git.jxs.me/leetgo/romantoint" "github.com/stretchr/testify/require" ) func TestRomanToInt(t *testing.T) { cases := map[string]int{ "": 0, "I": 1, "II": 2, "IV": 4, "V": 5, "IX": 9, "X": 10, "XII": 12, "XL": 40, "L": 50, "XC": 90, "C": 100, "LVIII": 58, "DCXIII": 613, "MCMXCIV": 1994, } for input, expected := range cases { t.Run(input, func(t *testing.T) { require.Equal(t, expected, romantoint.RomanToInt(input)) }) } }