Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed May 31, 2024
1 parent 3a780cf commit b66871a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions math/dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion math/dec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b66871a

Please sign in to comment.