extra/math/minmax_test.go

59 lines
879 B
Go

package math
import (
"reflect"
"testing"
)
func TestMin(t *testing.T) {
type args struct {
a []int
}
tests := []struct {
name string
args args
want int
}{
{
name: "test1",
args: args{
a: []int{8, 3, 6},
},
want: 3,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := MinScalar(tt.args.a...); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Min() = %v, want %v", got, tt.want)
}
})
}
}
func TestMax(t *testing.T) {
type args struct {
a []int
}
tests := []struct {
name string
args args
want int
}{
{
name: "test1",
args: args{
a: []int{8, 13, 6},
},
want: 13,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := MaxScalar(tt.args.a...); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Max() = %v, want %v", got, tt.want)
}
})
}
}