2024-09-22 18:53:13 +00:00
|
|
|
package roman
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestRomanNemerals(t *testing.T) {
|
|
|
|
cases := []struct {
|
|
|
|
Description string
|
|
|
|
Arabic int
|
|
|
|
Want string
|
|
|
|
}{
|
|
|
|
{"1 gets converted to I", 1, "I"},
|
|
|
|
{"2 gets converted to II", 2, "II"},
|
|
|
|
{"3 gets converted to III", 3, "III"},
|
2024-09-22 18:57:12 +00:00
|
|
|
{"4 gets converted to IV", 4, "IV"},
|
2024-09-22 18:53:13 +00:00
|
|
|
}
|
|
|
|
for _, test := range cases {
|
|
|
|
t.Run(test.Description, func(t *testing.T) {
|
|
|
|
got := ConvertToRoman(test.Arabic)
|
|
|
|
want := test.Want
|
|
|
|
|
|
|
|
if got != want {
|
|
|
|
t.Errorf("got %q, want %q", got, want)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|