-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor/test(osmomath): change package of decimal_test.go to osmomath_test #3710
Conversation
osmomath/decimal_test.go
Outdated
func (s *decimalTestSuite) TestPower() { | ||
testCases := []struct { | ||
input BigDec | ||
power uint64 | ||
expected BigDec | ||
}{ | ||
{OneDec(), 10, OneDec()}, // 1.0 ^ (10) => 1.0 | ||
{NewDecWithPrec(5, 1), 2, NewDecWithPrec(25, 2)}, // 0.5 ^ 2 => 0.25 | ||
{NewDecWithPrec(2, 1), 2, NewDecWithPrec(4, 2)}, // 0.2 ^ 2 => 0.04 | ||
{NewDecFromInt(NewInt(3)), 3, NewDecFromInt(NewInt(27))}, // 3 ^ 3 => 27 | ||
{NewDecFromInt(NewInt(-3)), 4, NewDecFromInt(NewInt(81))}, // -3 ^ 4 = 81 | ||
{MustNewDecFromStr("1.414213562373095048801688724209698079"), 2, NewDecFromInt(NewInt(2))}, // 1.414213562373095048801688724209698079 ^ 2 = 2 | ||
} | ||
|
||
for i, tc := range testCases { | ||
res := tc.input.Power(tc.power) | ||
s.Require().True(tc.expected.Sub(res).Abs().LTE(SmallestDec()), "unexpected result for test case %d, input: %v", i, tc.input) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been a bit removed from these osmomath changes, just wanted to check if Power is getting tested elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to submit this removal in: #3712
Got a merge conflict here. Thanks for catching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR lgtm once this is added back!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though I don't quite understand why it was needed
|
…h_test (#3710) (#3721) * refactor/test(osmomath): change package of decimal_test.go to osmomath_test * restore power test (cherry picked from commit 7da459f) Co-authored-by: Roman <[email protected]>
Progress towards: #3540
What is the purpose of the change
As per title, this is needed to prevent import cycles in tests.
The import cycle I encountered is with
osmoutils
to importErrTolerance
.