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, }, { "test1", args{2, []int{-1, 0, 3, 5, 9, 12}}, -1, }, } 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) } }) } }