test_: added testing for setupRouteValidationMapsV2
This commit is contained in:
parent
889675e42a
commit
dd9e4e787c
|
@ -0,0 +1,56 @@
|
||||||
|
package router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/big"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSetupRouteValidationMapsV2(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
fromLockedAmount map[uint64]*hexutil.Big
|
||||||
|
expectedFromIncluded map[uint64]bool
|
||||||
|
expectedFromExcluded map[uint64]bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Mixed locked amounts",
|
||||||
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
|
1: (*hexutil.Big)(big.NewInt(100)),
|
||||||
|
2: (*hexutil.Big)(big.NewInt(0)),
|
||||||
|
3: (*hexutil.Big)(big.NewInt(50)),
|
||||||
|
},
|
||||||
|
expectedFromIncluded: map[uint64]bool{1: false, 3: false},
|
||||||
|
expectedFromExcluded: map[uint64]bool{2: true},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "All amounts locked",
|
||||||
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
|
1: (*hexutil.Big)(big.NewInt(100)),
|
||||||
|
2: (*hexutil.Big)(big.NewInt(50)),
|
||||||
|
},
|
||||||
|
expectedFromIncluded: map[uint64]bool{1: false, 2: false},
|
||||||
|
expectedFromExcluded: map[uint64]bool{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "No amounts locked",
|
||||||
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
|
1: (*hexutil.Big)(big.NewInt(0)),
|
||||||
|
2: (*hexutil.Big)(big.NewInt(0)),
|
||||||
|
},
|
||||||
|
expectedFromIncluded: map[uint64]bool{},
|
||||||
|
expectedFromExcluded: map[uint64]bool{1: true, 2: true},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
fromIncluded, fromExcluded := setupRouteValidationMapsV2(tt.fromLockedAmount)
|
||||||
|
assert.Equal(t, tt.expectedFromIncluded, fromIncluded)
|
||||||
|
assert.Equal(t, tt.expectedFromExcluded, fromExcluded)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue