mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-08 08:20:06 +08:00
22 lines
351 B
Go
22 lines
351 B
Go
package mathUtil
|
|
|
|
import "testing"
|
|
|
|
func TestAbsInt64(t *testing.T) {
|
|
var input int64 = -12
|
|
var expected int64 = 12
|
|
res := Abs(input)
|
|
if res != expected {
|
|
t.Errorf("abs error")
|
|
}
|
|
}
|
|
|
|
func TestAbsFloat32(t *testing.T) {
|
|
var input float32 = -12.4
|
|
var expected float32 = 12.4
|
|
res := Abs(input)
|
|
if res != expected {
|
|
t.Errorf("abs error")
|
|
}
|
|
}
|