prysm-pulse/encoding/bytesutil/hex_test.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

30 lines
748 B
Go

package bytesutil_test
import (
"testing"
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
"github.com/prysmaticlabs/prysm/v5/testing/assert"
)
func TestIsHex(t *testing.T) {
tests := []struct {
a []byte
b bool
}{
{nil, false},
{[]byte(""), false},
{[]byte("0x"), false},
{[]byte("0x0"), true},
{[]byte("foo"), false},
{[]byte("1234567890abcDEF"), false},
{[]byte("XYZ4567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), false},
{[]byte("0x1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), true},
{[]byte("1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), false},
}
for _, tt := range tests {
isHex := bytesutil.IsHex(tt.a)
assert.Equal(t, tt.b, isHex)
}
}