You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
583 B

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))
})
}
}