This commit is contained in:
VicRen
2021-01-09 13:41:17 +08:00
parent 7cc04c9043
commit 44762b864e
2 changed files with 44 additions and 0 deletions

28
20210109/main_test.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import "testing"
func Test_search(t *testing.T) {
type args struct {
n int
nums []int
}
tests := []struct {
name string
args args
want int
}{
{
"test1",
args{9, []int{-1, 0, 3, 5, 9, 12}},
4,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := search(tt.args.n, tt.args.nums); got != tt.want {
t.Errorf("search() = %v, want %v", got, tt.want)
}
})
}
}