roman: add 4
This commit is contained in:
		| @ -9,5 +9,8 @@ func ConvertToRoman(arabic int) string { | |||||||
| 			converted.WriteString("I") | 			converted.WriteString("I") | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if arabic == 4 { | ||||||
|  | 		return "IV" | ||||||
|  | 	} | ||||||
| 	return converted.String() | 	return converted.String() | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,6 +11,7 @@ func TestRomanNemerals(t *testing.T) { | |||||||
| 		{"1 gets converted to I", 1, "I"}, | 		{"1 gets converted to I", 1, "I"}, | ||||||
| 		{"2 gets converted to II", 2, "II"}, | 		{"2 gets converted to II", 2, "II"}, | ||||||
| 		{"3 gets converted to III", 3, "III"}, | 		{"3 gets converted to III", 3, "III"}, | ||||||
|  | 		{"4 gets converted to IV", 4, "IV"}, | ||||||
| 	} | 	} | ||||||
| 	for _, test := range cases { | 	for _, test := range cases { | ||||||
| 		t.Run(test.Description, func(t *testing.T) { | 		t.Run(test.Description, func(t *testing.T) { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user