Skip to content
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

feat: add borrow factor #2114

Merged
merged 26 commits into from
Jun 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rephrase test - sign changes based on cpu architecture so strict equa…
…l avoided
  • Loading branch information
toteki committed Jun 26, 2023
commit af9c1fb1ea5a9e6a84ff4a72f31f0a579ea16454
12 changes: 8 additions & 4 deletions x/leverage/keeper/inspector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ func TestNeat(t *testing.T) {
"-12.555": -12.55, // truncates default to cent
"-0.00123456789": -0.001234, // truncates <0.01 to millionth
"-0.000000987654321": -0.000000987654321, // <0.000001 gets maximum precision
// edge case: >2^64 displays incorrectly
// this should be fine, since this is a display-only function (not used in transactions)
// which is used on dollar (not token) amounts
"123456789123456789123456789.123456789": -9.223372036854776e+21,
}

for s, f := range cases {
assert.Equal(f, neat(sdk.MustNewDecFromStr(s)))
}

// edge case: >2^64 displays incorrectly
// this should be fine, since this is a display-only function (not used in transactions)
// which is used on dollar (not token) amounts
assert.NotEqual(
123456789123456789123456789.123456789,
neat(sdk.MustNewDecFromStr("123456789123456789123456789.123456789")),
)
}