From 051755ec54d1de4bebb54ba9f77a9c87d7bd420c Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 16 Nov 2022 17:08:40 +0800 Subject: [PATCH] fixedpoint: add Floor test --- pkg/fixedpoint/dec_dnum_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/fixedpoint/dec_dnum_test.go b/pkg/fixedpoint/dec_dnum_test.go index d92d49639..051a8f0e6 100644 --- a/pkg/fixedpoint/dec_dnum_test.go +++ b/pkg/fixedpoint/dec_dnum_test.go @@ -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()