forked from cerc-io/laconicd-deprecated
stargate: migrate types (#670)
* changelog v0.4.0 * stargate: types changes * msg and handler changes * validation * fixes * more fixes * more test fixes * changelog * changelog * lint * rm comment * lint * redundant if condition
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
func TestIsEmptyHash(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
hash string
|
||||
expEmpty bool
|
||||
}{
|
||||
{
|
||||
"empty string", "", true,
|
||||
},
|
||||
{
|
||||
"zero hash", ethcmn.Hash{}.String(), true,
|
||||
},
|
||||
|
||||
{
|
||||
"non-empty hash", ethcmn.BytesToHash([]byte{1, 2, 3, 4}).String(), false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
require.Equal(t, tc.expEmpty, IsEmptyHash(tc.hash), tc.name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsZeroAddress(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
address string
|
||||
expEmpty bool
|
||||
}{
|
||||
{
|
||||
"empty string", "", true,
|
||||
},
|
||||
{
|
||||
"zero address", ethcmn.Address{}.String(), true,
|
||||
},
|
||||
|
||||
{
|
||||
"non-empty address", ethcmn.BytesToAddress([]byte{1, 2, 3, 4}).String(), false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
require.Equal(t, tc.expEmpty, IsZeroAddress(tc.address), tc.name)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user