-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove osmomath's dependency on osmoassert & gammtypes * Add note in gamm constant * Bring pack conditional panic * One more cond panic (cherry picked from commit db97b16) Co-authored-by: Dev Ojha <[email protected]>
- Loading branch information
1 parent
b8a6309
commit 6f84a81
Showing
7 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
package osmomath | ||
|
||
import ( | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var ( | ||
EulersNumber = eulersNumber | ||
TwoBigDec = twoBigDec | ||
) | ||
|
||
// 2^128 - 1, needs to be the same as gammtypes.MaxSpotPrice | ||
// but we can't directly import that due to import cycles. | ||
// Hence we use the same var name, in hopes that if any change there happens, | ||
// this is caught via a CTRL+F | ||
var MaxSpotPrice = sdk.NewDec(2).Power(128).Sub(sdk.OneDec()) | ||
|
||
// ConditionalPanic checks if expectPanic is true, asserts that sut (system under test) | ||
// panics. If expectPanic is false, asserts that sut does not panic. | ||
// returns true if sut panics and false it it does not | ||
func ConditionalPanic(t *testing.T, expectPanic bool, sut func()) { | ||
if expectPanic { | ||
require.Panics(t, sut) | ||
return | ||
} | ||
require.NotPanics(t, sut) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters