This commit is contained in:
VicRen
2020-12-02 08:51:48 +08:00
parent c93930c737
commit 410825768e
2 changed files with 79 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
package main
import "testing"
func TestRomaToDigit(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
want int
}{
{
"test1",
args{"III"},
3,
},
{
"test2",
args{"IV"},
4,
},
{
"test3",
args{"VI"},
6,
},
{
"test4",
args{"LVIII"},
58,
},
{
"test5",
args{"MCMXCIV"},
1994,
},
}
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)
}
})
}
}