From 13c81d83ef0d2cbb3d191a14b196569283c5d532 Mon Sep 17 00:00:00 2001 From: Ruslan Akhtariev <46343690+pysel@users.noreply.github.com> Date: Sat, 13 May 2023 12:07:46 +0700 Subject: [PATCH] osmomath: disable thelper for some helper functions (#5164) * mark helper functions * disable thelper warnings --- osmomath/decimal.go | 4 ++++ osmomath/int.go | 2 ++ 2 files changed, 6 insertions(+) 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() }