Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
Osmosis_Sync
Commits
e16c8ee6
Commit
e16c8ee6
authored
2 years ago
by
Roman
Browse files
Options
Download
Email Patches
Plain Diff
godoc
parent
4588ff0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
x/gamm/keeper/grpc_query_test.go
+3
-3
x/gamm/keeper/grpc_query_test.go
x/gamm/keeper/keeper_test.go
+6
-1
x/gamm/keeper/keeper_test.go
with
9 additions
and
4 deletions
+9
-4
x/gamm/keeper/grpc_query_test.go
+
3
-
3
View file @
e16c8ee6
...
...
@@ -56,7 +56,7 @@ func (suite *KeeperTestSuite) TestCalcExitPoolCoinsFromShares() {
}
// Test case shared by all pools to be tested.
allTestCases
:=
merg
eTestCases
(
validPools
,
sharedTestCases
)
allTestCases
:=
creat
eTestCases
ForGivenPools
(
validPools
,
sharedTestCases
)
// Add individual test cases
allTestCases
=
append
(
allTestCases
,
&
shareInTestCase
{
...
...
@@ -138,7 +138,7 @@ func (suite *KeeperTestSuite) TestCalcJoinPoolNoSwapShares() {
},
}
allTestCases
:=
merg
eTestCases
(
validPools
,
sharedTestCases
)
allTestCases
:=
creat
eTestCases
ForGivenPools
(
validPools
,
sharedTestCases
)
// Indiividual test cases where pool model does not matter.
nonExistentPoolId
:=
validPools
[
len
(
validPools
)
-
1
]
.
poolId
+
1
...
...
@@ -381,7 +381,7 @@ func (suite *KeeperTestSuite) TestCalcJoinPoolShares() {
},
}
allTestCases
:=
merg
eTestCases
(
validPools
,
sharedTestCases
)
allTestCases
:=
creat
eTestCases
ForGivenPools
(
validPools
,
sharedTestCases
)
// add inidividual test cases
nonExistentPoolId
:=
validPools
[
len
(
validPools
)
-
1
]
.
poolId
+
1
...
...
This diff is collapsed.
Click to expand it.
x/gamm/keeper/keeper_test.go
+
6
-
1
View file @
e16c8ee6
...
...
@@ -120,6 +120,8 @@ func (suite *KeeperTestSuite) fundAllAccountsWith(balances sdk.Coins) {
}
}
// initializeValidTestPools returns a list of all supported pool models.
// Each pool model has a pool with id created and a name assigned.
func
(
suite
*
KeeperTestSuite
)
initializeValidTestPools
()
[]
poolsCase
{
return
[]
poolsCase
{
{
...
...
@@ -133,7 +135,10 @@ func (suite *KeeperTestSuite) initializeValidTestPools() []poolsCase {
}
}
func
mergeTestCases
[
T
testCaseI
](
validPools
[]
poolsCase
,
sharedTestCases
[]
T
)
[]
T
{
// createTestCasesForGivenPools creates a test case in sharedTestCases for each pool in validPools
// and returns the final merged list of all test cases.
// This helps to reduce code duplciation when testing the same logic for multiple pool models.
func
createTestCasesForGivenPools
[
T
testCaseI
](
validPools
[]
poolsCase
,
sharedTestCases
[]
T
)
[]
T
{
allTestCases
:=
make
([]
T
,
0
)
for
_
,
pool
:=
range
validPools
{
curPool
:=
pool
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets