neoneo-go/pkg/encoding/address/address_test.go
Roman Khimov e685e9bf9a address: move into its own package
Doesn't really belong to the crypto.
2019-12-25 15:22:02 +03:00

34 lines
753 B
Go

package address
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUint160DecodeEncodeAddress(t *testing.T) {
addrs := []string{
"AMLr1CpPQtbEdiJdriX1HpRNMZUwbU2Huj",
"AKtwd3DRXj3nL5kHMUoNsdnsCEVjnuuTFF",
"AMxkaxFVG8Q1BhnB4fjTA5ZmUTEnnTMJMa",
}
for _, addr := range addrs {
val, err := DecodeUint160(addr)
if err != nil {
t.Fatal(err)
}
assert.Equal(t, addr, EncodeUint160(val))
}
}
func TestUint160DecodeKnownAddress(t *testing.T) {
address := "AJeAEsmeD6t279Dx4n2HWdUvUmmXQ4iJvP"
val, err := DecodeUint160(address)
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "b28427088a3729b2536d10122960394e8be6721f", val.StringLE())
assert.Equal(t, "1f72e68b4e39602912106d53b229378a082784b2", val.String())
}