From c0d6e3cffebf7efaf22d445b9444c734a1da4799 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Wed, 30 Sep 2020 15:03:43 -0700 Subject: [PATCH] test: add more tests for ToHex function. (#6605) --- x/x_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/x_test.go b/x/x_test.go index e88590ca8be..a95be869792 100644 --- a/x/x_test.go +++ b/x/x_test.go @@ -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)) }