forked from steger/pr3-ws202526
36 lines
609 B
Go
36 lines
609 B
Go
package myMath_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gitty.informatik.hs-mannheim.de/steger/pr3-code/go/03-modules/myMath"
|
|
)
|
|
|
|
func TestAdd(t *testing.T) {
|
|
sum := myMath.Add(2, 3)
|
|
if sum != 5 {
|
|
t.Errorf("Add(2,3) = %v, want %v", sum, 5)
|
|
}
|
|
}
|
|
|
|
func TestMin(t *testing.T) {
|
|
type args struct {
|
|
in0 int
|
|
in1 int
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want int
|
|
}{
|
|
{"first greater", args{3, 2}, 2},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := myMath.Min(tt.args.in0, tt.args.in1); got != tt.want {
|
|
t.Errorf("Min() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|