Created
October 5, 2022 22:36
-
-
Save arnabmitra/803e200c1ef7978c50fe9b0ef4be2836 to your computer and use it in GitHub Desktop.
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
package types | |
import ( | |
"testing" | |
sdk "github.com/cosmos/cosmos-sdk/types" | |
"github.com/stretchr/testify/assert" | |
) | |
func TestMarkerAddressLength(t *testing.T) { | |
config := sdk.GetConfig() | |
config.SetBech32PrefixForAccount("tp", "tp"+"pub") | |
addr, err := MarkerAddress("nhash") | |
println(addr.String()) | |
assert.NoError(t, err) | |
assert.Equal(t, 20, len(addr), "marker address should always be length of 20") | |
} | |
func TestSplitMarkerStoreKey(t *testing.T) { | |
addr, err := MarkerAddress("nhash") | |
largerLengthAddr := sdk.AccAddress("FFFFFFFFFFFFFFFFFFFFFFFF") | |
assert.NoError(t, err) | |
assert.Equal(t, addr, SplitMarkerStoreKey(MarkerStoreKey(addr)), "should parse a marker of length 20 from key") | |
assert.Equal(t, largerLengthAddr, SplitMarkerStoreKey(MarkerStoreKey(largerLengthAddr)), "should parse a marker of length 24 from key") | |
} | |
func TestMarkerAddressLength1(t *testing.T) { | |
config := sdk.GetConfig() | |
config.SetBech32PrefixForAccount("pb", "tp"+"pub") | |
addr, err := MarkerAddress("vspn") | |
println(addr.String()) | |
assert.NoError(t, err) | |
assert.Equal(t, 20, len(addr), "marker address should always be length of 20") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment