fixedpoint: add Floor test

This commit is contained in:
c9s 2022-11-16 17:08:40 +08:00
parent 991dc4121c
commit 051755ec54
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -3,8 +3,9 @@
package fixedpoint
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestDelta(t *testing.T) {
@ -13,6 +14,12 @@ func TestDelta(t *testing.T) {
assert.InDelta(t, f1.Mul(f2).Float64(), 41.3, 1e-14)
}
func TestFloor(t *testing.T) {
f1 := MustNewFromString("10.333333")
f2 := f1.Floor()
assert.Equal(t, "10", f2.String())
}
func TestInternal(t *testing.T) {
r := &reader{"1.1e-15", 0}
c, e := r.getCoef()