Files
marketlabtest/worker/worker_test.go
2024-05-30 19:42:26 +03:00

44 lines
677 B
Go

package worker
import (
"reflect"
"strconv"
"testing"
)
func TestWorker_findMax(t *testing.T) {
t.Parallel()
tests := []struct {
in [10]int
out [3]int
}{
{
in: [10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
out: [3]int{8, 9, 10},
},
{
in: [10]int{10, 9, 8, 7, 6, 5, 4, 3, 2, 1},
out: [3]int{8, 9, 10},
},
{
in: [10]int{9, 7, 6, 10, 5, 4, 3, 8, 1},
out: [3]int{8, 9, 10},
},
}
for idx, tt := range tests {
tt := tt
t.Run(strconv.Itoa(idx), func(t *testing.T) {
t.Parallel()
w := &Worker{}
if got := w.findMax(tt.in); !reflect.DeepEqual(got, tt.out) {
t.Errorf("findMax() = %v, want %v", got, tt.out)
}
})
}
}