1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-06-27 03:31:42 +00:00
Files
.circleci
.github
DOCKER
abci
benchmarks
blockchain
cmd
config
consensus
crypto
docs
evidence
libs
autofile
bech32
bech32.go
bech32_test.go
cli
clist
common
db
errors
events
flowrate
log
pubsub
test
version
.editorconfig
.gitignore
CHANGELOG.md
README.md
circle.yml
test.sh
lite
mempool
networks
node
p2p
privval
proxy
rpc
scripts
state
test
tools
types
version
.editorconfig
.gitignore
CHANGELOG.md
CHANGELOG_PENDING.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
ROADMAP.md
SECURITY.md
UPGRADING.md
Vagrantfile
appveyor.yml
codecov.yml
docker-compose.yml
tendermint/libs/bech32/bech32_test.go

32 lines
502 B
Go
Raw Normal View History

package bech32_test
import (
"bytes"
"crypto/sha256"
"testing"
2018-07-01 22:36:49 -04:00
"github.com/tendermint/tendermint/libs/bech32"
)
func TestEncodeAndDecode(t *testing.T) {
sum := sha256.Sum256([]byte("hello world\n"))
bech, err := bech32.ConvertAndEncode("shasum", sum[:])
if err != nil {
t.Error(err)
}
hrp, data, err := bech32.DecodeAndConvert(bech)
if err != nil {
t.Error(err)
}
if hrp != "shasum" {
t.Error("Invalid hrp")
}
2018-07-02 12:06:43 -04:00
if !bytes.Equal(data, sum[:]) {
t.Error("Invalid decode")
}
}