feature/874: add 874 solution

This commit is contained in:
novahe
2021-05-04 21:36:26 +08:00
parent 99fe55c7df
commit 1835b6dd45
3 changed files with 201 additions and 0 deletions

View File

@ -0,0 +1,39 @@
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)
}
})
}
}