mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-24 21:24:46 +01:00
34 lines
507 B
Go
34 lines
507 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|