Skip to content

Instantly share code, notes, and snippets.

@haru01
Created May 31, 2017 00:03
Show Gist options
  • Save haru01/f2beffa24e29e73ff5e2b584a85d2ace to your computer and use it in GitHub Desktop.
Save haru01/f2beffa24e29e73ff5e2b584a85d2ace to your computer and use it in GitHub Desktop.
step6 テストリファクタ
func TestToRoman(t *testing.T) {
testCases := []struct {
in uint16
want string
}{
{1, "I"},
{2, "II"},
{5, "V"},
}
for _, test := range testCases {
name := fmt.Sprintf("%v=>%vと変換できること", test.in, test.want)
t.Run(name, func(t *testing.T) {
if got := ToRoman(test.in); got != test.want {
t.Errorf("ToRoman(%v): got %v want %v", test.in, got, test.want)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment