github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/encoding/web3hex/decoder_test.go (about)

     1  package web3hex
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func TestDecoder_Bytes(t *testing.T) {
    11  	d := new(Decoder)
    12  	assert.Equal(t, []byte{}, d.Bytes(""))
    13  	assert.Equal(t, []byte{1}, d.Bytes("0x1"))
    14  	assert.Equal(t, []byte{1}, d.Bytes("0x01"))
    15  	assert.Equal(t, []byte{1, 0xff}, d.Bytes("0x1ff"))
    16  	require.NoError(t, d.Err())
    17  }