roman: add 4

This commit is contained in:
vinchent 2024-09-22 20:57:12 +02:00
parent accb2c51dc
commit 3a0808c599
2 changed files with 4 additions and 0 deletions

View File

@ -9,5 +9,8 @@ func ConvertToRoman(arabic int) string {
converted.WriteString("I")
}
}
if arabic == 4 {
return "IV"
}
return converted.String()
}

View File

@ -11,6 +11,7 @@ func TestRomanNemerals(t *testing.T) {
{"1 gets converted to I", 1, "I"},
{"2 gets converted to II", 2, "II"},
{"3 gets converted to III", 3, "III"},
{"4 gets converted to IV", 4, "IV"},
}
for _, test := range cases {
t.Run(test.Description, func(t *testing.T) {