...
|
...
|
@@ -3,6 +3,7 @@ package utils |
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
"math"
|
|
|
"testing"
|
|
|
"time"
|
|
|
)
|
...
|
...
|
@@ -102,3 +103,14 @@ func parseWithLocation(name string, timeStr string) (time.Time, error) { |
|
|
return lt, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func TestRound(t *testing.T) {
|
|
|
t.Logf("%v", Round(99.999, 1))
|
|
|
t.Logf("%v", Round(99.999, 2))
|
|
|
|
|
|
t.Logf("%.1f", math.Floor(99.99))
|
|
|
t.Logf("%v", math.Ceil(99.99))
|
|
|
|
|
|
t.Logf("%.1f", Truncate(99.99, 1))
|
|
|
t.Logf("%v", Truncate(99, 0))
|
|
|
} |
...
|
...
|
|