github.com/0xsequence/ethkit@v1.25.0/ethcoder/hex_test.go (about) 1 package ethcoder 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestHexTrimLeadingZeros(t *testing.T) { 10 v, err := HexTrimLeadingZeros("0x00000000001") 11 assert.NoError(t, err) 12 assert.Equal(t, "0x1", v) 13 14 v, err = HexTrimLeadingZeros("0x000000000000") 15 assert.NoError(t, err) 16 assert.Equal(t, "0x0", v) 17 }