Files
codekata-golang/20201215/main_test.go
2020-12-15 09:16:01 +08:00

58 lines
636 B
Go

package main
import "testing"
func Test_isValid(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
want bool
}{
{
"test1",
args{
"()",
},
true,
},
{
"test2",
args{
"()[]{}",
},
true,
},
{
"test3",
args{
"(]",
},
false,
},
{
"test4",
args{
"([)]",
},
false,
},
{
"test5",
args{
"{[]}",
},
true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isValid(tt.args.s); got != tt.want {
t.Errorf("isValid() = %v, want %v", got, tt.want)
}
})
}
}