mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-04 14:42:47 +08:00
21
mathUtil/max_test.go
Normal file
21
mathUtil/max_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mathUtil
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMaxEmpty(t *testing.T) {
|
||||
s := []int{}
|
||||
var expected int = 0
|
||||
res := Max(s)
|
||||
if res != expected {
|
||||
t.Errorf("max error %d", res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMax(t *testing.T) {
|
||||
s := []int{3, 7, 1, 9, 3, 0, 2, 2}
|
||||
var expected int = 9
|
||||
res := Max(s)
|
||||
if res != expected {
|
||||
t.Errorf("max error %d", res)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user