diff --git a/osmomath/decimal.go b/osmomath/decimal.go index 03b6fea77bf..1b8e21ce001 100644 --- a/osmomath/decimal.go +++ b/osmomath/decimal.go @@ -887,12 +887,16 @@ func MaxDec(d1, d2 BigDec) BigDec { // DecEq returns true if two given decimals are equal. // Intended to be used with require/assert: require.True(t, DecEq(...)) +// +//nolint:thelper func DecEq(t *testing.T, exp, got BigDec) (*testing.T, bool, string, string, string) { return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() } // DecApproxEq returns true if the differences between two given decimals are smaller than the tolerance range. // Intended to be used with require/assert: require.True(t, DecEq(...)) +// +//nolint:thelper func DecApproxEq(t *testing.T, d1 BigDec, d2 BigDec, tol BigDec) (*testing.T, bool, string, string, string) { diff := d1.Sub(d2).Abs() return t, diff.LTE(tol), "expected |d1 - d2| <:\t%v\ngot |d1 - d2| = \t\t%v", tol.String(), diff.String() diff --git a/osmomath/int.go b/osmomath/int.go index c3ae4ef288e..6b2fe80025d 100644 --- a/osmomath/int.go +++ b/osmomath/int.go @@ -435,6 +435,8 @@ func (i BigInt) MarshalAmino() ([]byte, error) { return i.Marshal() } func (i *BigInt) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) } // intended to be used with require/assert: require.True(IntEq(...)) +// +//nolint:thelper func IntEq(t *testing.T, exp, got BigInt) (*testing.T, bool, string, string, string) { return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() }