mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-04 16:12:47 +08:00
40 lines
629 B
Go
40 lines
629 B
Go
package leetcode
|
|
|
|
import "testing"
|
|
|
|
func Test_robotSim(t *testing.T) {
|
|
type args struct {
|
|
commands []int
|
|
obstacles [][]int
|
|
}
|
|
cases := []struct {
|
|
name string
|
|
args args
|
|
want int
|
|
}{
|
|
{
|
|
"case 1",
|
|
args{
|
|
commands: []int{4, -1, 3},
|
|
obstacles: [][]int{{}},
|
|
},
|
|
25,
|
|
},
|
|
{
|
|
"case 2",
|
|
args{
|
|
commands: []int{4, -1, 4, -2, 4},
|
|
obstacles: [][]int{{2, 4}},
|
|
},
|
|
65,
|
|
},
|
|
}
|
|
for _, tt := range cases {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := robotSim(tt.args.commands, tt.args.obstacles); got != tt.want {
|
|
t.Errorf("robotSim() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|