mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-30 14:58:44 +01:00
20201203
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ func main() {
|
||||
|
||||
}
|
||||
|
||||
func RomaToDigit(s string) int {
|
||||
func romaToDigit(s string) int {
|
||||
l := len(s)
|
||||
ret := 0
|
||||
for i := 0; i < l; i++ {
|
||||
|
||||
+12
-2
@@ -36,11 +36,21 @@ func TestRomaToDigit(t *testing.T) {
|
||||
args{"MCMXCIV"},
|
||||
1994,
|
||||
},
|
||||
{
|
||||
"test6",
|
||||
args{"CMXCIX"},
|
||||
999,
|
||||
},
|
||||
{
|
||||
"test7",
|
||||
args{"XLIX"},
|
||||
49,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := RomaToDigit(tt.args.s); got != tt.want {
|
||||
t.Errorf("RomaToDigit() = %v, want %v", got, tt.want)
|
||||
if got := romaToDigit(tt.args.s); got != tt.want {
|
||||
t.Errorf("romaToDigit() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user