aboutsummaryrefslogtreecommitdiff
path: root/math/minmax_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'math/minmax_test.go')
-rw-r--r--math/minmax_test.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/math/minmax_test.go b/math/minmax_test.go
new file mode 100644
index 0000000..00211e2
--- /dev/null
+++ b/math/minmax_test.go
@@ -0,0 +1,58 @@
+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)
+ }
+ })
+ }
+}