Skip to content

Commit

Permalink
test: add more tests for ToHex function. (#6605)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Sep 30, 2020
1 parent 6faa06a commit c0d6e3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/x_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@ func TestVersionString(t *testing.T) {

func TestToHex(t *testing.T) {
require.Equal(t, []byte(`"0x0"`), ToHex(0, false))
require.Equal(t, []byte(`<0x0>`), ToHex(0, true))
require.Equal(t, []byte(`"0xf"`), ToHex(15, false))
require.Equal(t, []byte(`<0xf>`), ToHex(15, true))
require.Equal(t, []byte(`"0x19"`), ToHex(25, false))
require.Equal(t, []byte(`<0x19>`), ToHex(25, true))
require.Equal(t, []byte(`"0xff"`), ToHex(255, false))
require.Equal(t, []byte(`<0xff>`), ToHex(255, true))
require.Equal(t, []byte(`"0xffffffffffffffff"`), ToHex(math.MaxUint64, false))
require.Equal(t, []byte(`<0xffffffffffffffff>`), ToHex(math.MaxUint64, true))
}

0 comments on commit c0d6e3c

Please sign in to comment.