From b66871ad440e9d91ceb6ce52f593d23556054d72 Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Fri, 31 May 2024 16:21:04 +0200 Subject: [PATCH] Fix test --- math/dec.go | 10 ++-------- math/dec_test.go | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/math/dec.go b/math/dec.go index a742aa68ad83..acda34cb6482 100644 --- a/math/dec.go +++ b/math/dec.go @@ -99,18 +99,13 @@ func NewDecFromString(s string, c ...SetupConstraint) (Dec, error) { } } -// NewNonNegativeDecFromString constructor -func NewNonNegativeDecFromString(s string, c ...SetupConstraint) (Dec, error) { - return NewDecFromString(s, append(c, AssertNotNegative())...) -} - func NewDecFromInt64(x int64) Dec { var res Dec res.dec.SetInt64(x) return res } -// NewDecFinite returns a decimal with a value of coeff * 10^exp. +// NewDecFinite returns a decimal with a value of coeff * 10^exp precision. func NewDecFinite(coeff int64, exp int32) Dec { var res Dec res.dec.SetFinite(coeff, exp) @@ -277,8 +272,7 @@ func (x Dec) NumDecimalPlaces() uint32 { return uint32(-exp) } -// Reduce returns a copy of x with all trailing zeros removed and the number -// of trailing zeros removed. +// Reduce returns a copy of x with all trailing zeros removed func (x Dec) Reduce() (Dec, int) { y := Dec{} _, n := y.dec.Reduce(&x.dec) diff --git a/math/dec_test.go b/math/dec_test.go index 5b3f5b61ee1f..8a3ab55e82f4 100644 --- a/math/dec_test.go +++ b/math/dec_test.go @@ -159,7 +159,7 @@ func TestQuoExactGood(t *testing.T) { b := NewDecFinite(1, 6) c, err := a.QuoExact(b) require.NoError(t, err) - require.Equal(t, "1.000001", c.String()) + require.Equal(t, "1.000001000000000000000000000000000", c.String()) } func TestQuoExactBad(t *testing.T) {