base58: add a test for a025b9c42d

As noted by @fyrchik in #579 comments.
This commit is contained in:
Roman Khimov 2019-12-25 17:06:38 +03:00
parent e25133a385
commit 53e6fbbbf9

View file

@ -5,6 +5,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func TestCheckEncodeDecode(t *testing.T) { func TestCheckEncodeDecode(t *testing.T) {
@ -30,3 +31,11 @@ func TestCheckDecodeFailures(t *testing.T) {
_, err = CheckDecode(badcsum) _, err = CheckDecode(badcsum)
assert.NotNil(t, err) assert.NotNil(t, err)
} }
func TestBase58LeadingZeroes(t *testing.T) {
buf := []byte{0, 0, 0, 1}
b58 := CheckEncode(buf)
dec, err := CheckDecode(b58)
require.NoError(t, err)
require.Equal(t, buf, dec)
}