mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-05 15:06:50 +08:00
22 lines
377 B
Go
22 lines
377 B
Go
package mathUtil
|
|
|
|
import "testing"
|
|
|
|
func TestRoundFloat32(t *testing.T) {
|
|
var input float32 = -12.4
|
|
var expected int = -12
|
|
res := Round(input)
|
|
if res != expected {
|
|
t.Errorf("Round error %d", res)
|
|
}
|
|
}
|
|
|
|
func TestRoundFloat64(t *testing.T) {
|
|
var input float64 = 12.5
|
|
var expected int = 13
|
|
res := Round(input)
|
|
if res != expected {
|
|
t.Errorf("Round error %d", res)
|
|
}
|
|
}
|