From 3a0808c599ef63c7305a9481432c6cba2020aaa4 Mon Sep 17 00:00:00 2001 From: vinchent Date: Sun, 22 Sep 2024 20:57:12 +0200 Subject: [PATCH] roman: add 4 --- roman/roman.go | 3 +++ roman/roman_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/roman/roman.go b/roman/roman.go index df276f0..7f0acd4 100644 --- a/roman/roman.go +++ b/roman/roman.go @@ -9,5 +9,8 @@ func ConvertToRoman(arabic int) string { converted.WriteString("I") } } + if arabic == 4 { + return "IV" + } return converted.String() } diff --git a/roman/roman_test.go b/roman/roman_test.go index 0b445d6..a2d0b9d 100644 --- a/roman/roman_test.go +++ b/roman/roman_test.go @@ -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) {